Subscribe2 - Version 6.4

Version Description

Download this release

Release Info

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

Code changes from version 6.3 to 6.4

ReadMe.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: MattyRob, Skippy, RavanH
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2387904
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 2.8
6
- Tested up to: 3.1
7
- Stable tag: 6.3
8
 
9
  Sends a list of subscribers an email notification when new posts are published to your blog
10
 
@@ -142,6 +142,27 @@ In order to force sending you'd need to change the date of publication on the po
142
 
143
  If you opt for the latter way look in the options table for the subscribe2_options settings (it's an array) and you'll need to change the 'last_s2cron' value to a timestamp for last week. Then force the cron event to run again with [WP-Crontrol](http://wordpress.org/extend/plugins/wp-crontrol/).
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  = Can I suggest you add X as a feature =
146
 
147
  I'm open to suggestions but since the software is written by me for use on my site and then shared for free because others may find it useful as it comes don't expect your suggestion to be implemented unless I'll find it useful.
@@ -161,7 +182,7 @@ WordPress 2.0.x requires Subscribe2 from the 2.x stable branch. The most recent
161
  = Why doesn't the form appear in my WordPress page? =
162
  This is usually caused by one of two things. Firstly, it is possible that the form is there but because you haven't logged out of WordPress yourself you are seeing a message about managing your profile instead. Log out of WordPress and it will appear as the subscription form you are probably expecting.
163
 
164
- Secondly, make sure that the token ([subscribe2] or <!--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 plugin that is stripping the token from the page code.
165
 
166
  == Screenshots ==
167
 
@@ -172,6 +193,28 @@ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correc
172
 
173
  == Changelog ==
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  = Version 6.3 by Matthew Robinson =
176
 
177
  * Stopped using deprecated get_usermeta(), update_usermeta() and delete_usermeta() functions in WordPress 3.1
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 2.8
6
+ Tested up to: 3.2
7
+ Stable tag: 6.4
8
 
9
  Sends a list of subscribers an email notification when new posts are published to your blog
10
 
142
 
143
  If you opt for the latter way look in the options table for the subscribe2_options settings (it's an array) and you'll need to change the 'last_s2cron' value to a timestamp for last week. Then force the cron event to run again with [WP-Crontrol](http://wordpress.org/extend/plugins/wp-crontrol/).
144
 
145
+ = How do I make use of the support for Custom Post Types =
146
+
147
+ In a plugin file for your site or perhaps functions.php in your theme add the following code where 'my_post_type' is change to the name of your custom post type.
148
+
149
+ function my_post_types($types) {
150
+ $types[] = 'my_post_type';
151
+ return $types;
152
+ }
153
+ add_filter('s2_post_types', 'my_post_types');
154
+
155
+ = How can I make use of the support for Custom Taxonomies =
156
+
157
+ In a plugin file for your site or perhaps functions.php in your theme add the following code where 'my_
158
+ taxonomy_type' is change to the name of your custom taxonomy type.
159
+
160
+ function my_taxonomy_types($taxonomies) {
161
+ $taxonomies[] = 'my_taxonomy_type';
162
+ return $taxonomies;
163
+ }
164
+ add_filter('s2_taxonomies', 'my_taxonomy_types');
165
+
166
  = Can I suggest you add X as a feature =
167
 
168
  I'm open to suggestions but since the software is written by me for use on my site and then shared for free because others may find it useful as it comes don't expect your suggestion to be implemented unless I'll find it useful.
182
  = Why doesn't the form appear in my WordPress page? =
183
  This is usually caused by one of two things. Firstly, it is possible that the form is there but because you haven't logged out of WordPress yourself you are seeing a message about managing your profile instead. Log out of WordPress and it will appear as the subscription form you are probably expecting.
184
 
185
+ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correctly entered in your page with a blank line above and below. The easiest 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 plugin that is stripping the token from the page code.
186
 
187
  == Screenshots ==
188
 
193
 
194
  == Changelog ==
195
 
196
+ = Version 6.4 by Matthew Robinson =
197
+
198
+ * Wrapped all KEYWORDS in curly brackets {} so capitalised keywords can be used in content without being replaced
199
+ * Added support for Custom Taxonomies - thanks to Ian Dunn
200
+ * Added feature to allow commenters on your blog to subscribe when commenting (requires WordPress 2.9+)
201
+ * Improved and updated some of the jQuery ready for WordPress 3.2
202
+ * Introduced 's2_registered_subscribers' filter to allow other plugins to dynamically add or remove email addresses to the 'registered' array - thanks to Allan Tan
203
+ * Improved handling of [gallery] shortcode where no post id is defined for HTML emails - thanks to Chris Grady
204
+ * Removed trailing semi colons from the maybe_add_column function calls
205
+ * Fixed a type on the Settings page - thanks to Deborah Hanchey
206
+ * Updated editor buttons to insert shortcode instead of token
207
+ * Fixed some PHP notices about undeclared variables
208
+ * Compressed some of the javascript code includes to reduce download time
209
+ * Fixes to the Counter Widget ColorPicker jQuery code
210
+ * Fixes to the Counter Widget label tags
211
+ * Fixed a bug in the new_category function that was introduced in version 6.3 - thanks to crashtest
212
+ * Improved the user experience when clicking Subscribe and Unsubscribe links in the WordPress MultiSite interface - thanks to Huyz
213
+ * Improved the Bulk Manage section to take into account the digest notification setting
214
+ * Updated the uninstall script
215
+ * Updated some of the code comments to aid reviewing
216
+ * Other minor improvements and fixes
217
+
218
  = Version 6.3 by Matthew Robinson =
219
 
220
  * Stopped using deprecated get_usermeta(), update_usermeta() and delete_usermeta() functions in WordPress 3.1
The WordPress Subscriber User Guide.pdf DELETED
Binary file
include/colorpicker/js/colorpicker.dev.js ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *
3
+ * Color picker
4
+ * Author: Stefan Petre www.eyecon.ro
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses
7
+ *
8
+ */
9
+ (function (jQuery) {
10
+ var ColorPicker = function () {
11
+ var
12
+ ids = {},
13
+ inAction,
14
+ charMin = 65,
15
+ visible,
16
+ tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
17
+ defaults = {
18
+ eventName: 'click',
19
+ onShow: function () {},
20
+ onBeforeShow: function(){},
21
+ onHide: function () {},
22
+ onChange: function () {},
23
+ onSubmit: function () {},
24
+ color: 'ff0000',
25
+ livePreview: true,
26
+ flat: false
27
+ },
28
+ fillRGBFields = function (hsb, cal) {
29
+ var rgb = HSBToRGB(hsb);
30
+ jQuery(cal).data('colorpicker').fields
31
+ .eq(1).val(rgb.r).end()
32
+ .eq(2).val(rgb.g).end()
33
+ .eq(3).val(rgb.b).end();
34
+ },
35
+ fillHSBFields = function (hsb, cal) {
36
+ jQuery(cal).data('colorpicker').fields
37
+ .eq(4).val(hsb.h).end()
38
+ .eq(5).val(hsb.s).end()
39
+ .eq(6).val(hsb.b).end();
40
+ },
41
+ fillHexFields = function (hsb, cal) {
42
+ jQuery(cal).data('colorpicker').fields
43
+ .eq(0).val(HSBToHex(hsb)).end();
44
+ },
45
+ setSelector = function (hsb, cal) {
46
+ jQuery(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
47
+ jQuery(cal).data('colorpicker').selectorIndic.css({
48
+ left: parseInt(150 * hsb.s/100, 10),
49
+ top: parseInt(150 * (100-hsb.b)/100, 10)
50
+ });
51
+ },
52
+ setHue = function (hsb, cal) {
53
+ jQuery(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
54
+ },
55
+ setCurrentColor = function (hsb, cal) {
56
+ jQuery(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
57
+ },
58
+ setNewColor = function (hsb, cal) {
59
+ jQuery(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
60
+ },
61
+ keyDown = function (ev) {
62
+ var pressedKey = ev.charCode || ev.keyCode || -1;
63
+ if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
64
+ return false;
65
+ }
66
+ var cal = jQuery(this).parent().parent();
67
+ if (cal.data('colorpicker').livePreview === true) {
68
+ change.apply(this);
69
+ }
70
+ },
71
+ change = function (ev) {
72
+ var cal = jQuery(this).parent().parent(), col;
73
+ if (this.parentNode.className.indexOf('_hex') > 0) {
74
+ cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
75
+ } else if (this.parentNode.className.indexOf('_hsb') > 0) {
76
+ cal.data('colorpicker').color = col = fixHSB({
77
+ h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
78
+ s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
79
+ b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
80
+ });
81
+ } else {
82
+ cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
83
+ r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
84
+ g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
85
+ b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
86
+ }));
87
+ }
88
+ if (ev) {
89
+ fillRGBFields(col, cal.get(0));
90
+ fillHexFields(col, cal.get(0));
91
+ fillHSBFields(col, cal.get(0));
92
+ }
93
+ setSelector(col, cal.get(0));
94
+ setHue(col, cal.get(0));
95
+ setNewColor(col, cal.get(0));
96
+ cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
97
+ },
98
+ blur = function (ev) {
99
+ var cal = jQuery(this).parent().parent();
100
+ cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
101
+ },
102
+ focus = function () {
103
+ charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
104
+ jQuery(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
105
+ jQuery(this).parent().addClass('colorpicker_focus');
106
+ },
107
+ downIncrement = function (ev) {
108
+ var field = jQuery(this).parent().find('input').focus();
109
+ var current = {
110
+ el: jQuery(this).parent().addClass('colorpicker_slider'),
111
+ max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
112
+ y: ev.pageY,
113
+ field: field,
114
+ val: parseInt(field.val(), 10),
115
+ preview: jQuery(this).parent().parent().data('colorpicker').livePreview
116
+ };
117
+ jQuery(document).bind('mouseup', current, upIncrement);
118
+ jQuery(document).bind('mousemove', current, moveIncrement);
119
+ },
120
+ moveIncrement = function (ev) {
121
+ ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
122
+ if (ev.data.preview) {
123
+ change.apply(ev.data.field.get(0), [true]);
124
+ }
125
+ return false;
126
+ },
127
+ upIncrement = function (ev) {
128
+ change.apply(ev.data.field.get(0), [true]);
129
+ ev.data.el.removeClass('colorpicker_slider').find('input').focus();
130
+ jQuery(document).unbind('mouseup', upIncrement);
131
+ jQuery(document).unbind('mousemove', moveIncrement);
132
+ return false;
133
+ },
134
+ downHue = function (ev) {
135
+ var current = {
136
+ cal: jQuery(this).parent(),
137
+ y: jQuery(this).offset().top
138
+ };
139
+ current.preview = current.cal.data('colorpicker').livePreview;
140
+ jQuery(document).bind('mouseup', current, upHue);
141
+ jQuery(document).bind('mousemove', current, moveHue);
142
+ },
143
+ moveHue = function (ev) {
144
+ change.apply(
145
+ ev.data.cal.data('colorpicker')
146
+ .fields
147
+ .eq(4)
148
+ .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
149
+ .get(0),
150
+ [ev.data.preview]
151
+ );
152
+ return false;
153
+ },
154
+ upHue = function (ev) {
155
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
156
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
157
+ jQuery(document).unbind('mouseup', upHue);
158
+ jQuery(document).unbind('mousemove', moveHue);
159
+ return false;
160
+ },
161
+ downSelector = function (ev) {
162
+ var current = {
163
+ cal: jQuery(this).parent(),
164
+ pos: jQuery(this).offset()
165
+ };
166
+ current.preview = current.cal.data('colorpicker').livePreview;
167
+ jQuery(document).bind('mouseup', current, upSelector);
168
+ jQuery(document).bind('mousemove', current, moveSelector);
169
+ },
170
+ moveSelector = function (ev) {
171
+ change.apply(
172
+ ev.data.cal.data('colorpicker')
173
+ .fields
174
+ .eq(6)
175
+ .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
176
+ .end()
177
+ .eq(5)
178
+ .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
179
+ .get(0),
180
+ [ev.data.preview]
181
+ );
182
+ return false;
183
+ },
184
+ upSelector = function (ev) {
185
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
186
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
187
+ jQuery(document).unbind('mouseup', upSelector);
188
+ jQuery(document).unbind('mousemove', moveSelector);
189
+ return false;
190
+ },
191
+ enterSubmit = function (ev) {
192
+ jQuery(this).addClass('colorpicker_focus');
193
+ },
194
+ leaveSubmit = function (ev) {
195
+ jQuery(this).removeClass('colorpicker_focus');
196
+ },
197
+ clickSubmit = function (ev) {
198
+ var cal = jQuery(this).parent();
199
+ var col = cal.data('colorpicker').color;
200
+ cal.data('colorpicker').origColor = col;
201
+ setCurrentColor(col, cal.get(0));
202
+ cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
203
+ },
204
+ show = function (ev) {
205
+ var cal = jQuery('#' + jQuery(this).data('colorpickerId'));
206
+ cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
207
+ var pos = jQuery(this).offset();
208
+ var viewPort = getViewport();
209
+ var top = pos.top + this.offsetHeight;
210
+ var left = pos.left;
211
+ if (top + 176 > viewPort.t + viewPort.h) {
212
+ top -= this.offsetHeight + 176;
213
+ }
214
+ if (left + 356 > viewPort.l + viewPort.w) {
215
+ left -= 356;
216
+ }
217
+ cal.css({left: left + 'px', top: top + 'px'});
218
+ if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
219
+ cal.show();
220
+ }
221
+ jQuery(document).bind('mousedown', {cal: cal}, hide);
222
+ return false;
223
+ },
224
+ hide = function (ev) {
225
+ if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
226
+ if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
227
+ ev.data.cal.hide();
228
+ }
229
+ jQuery(document).unbind('mousedown', hide);
230
+ }
231
+ },
232
+ isChildOf = function(parentEl, el, container) {
233
+ if (parentEl == el) {
234
+ return true;
235
+ }
236
+ if (parentEl.contains) {
237
+ return parentEl.contains(el);
238
+ }
239
+ if ( parentEl.compareDocumentPosition ) {
240
+ return !!(parentEl.compareDocumentPosition(el) & 16);
241
+ }
242
+ var prEl = el.parentNode;
243
+ while(prEl && prEl != container) {
244
+ if (prEl == parentEl)
245
+ return true;
246
+ prEl = prEl.parentNode;
247
+ }
248
+ return false;
249
+ },
250
+ getViewport = function () {
251
+ var m = document.compatMode == 'CSS1Compat';
252
+ return {
253
+ l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
254
+ t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
255
+ w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
256
+ h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
257
+ };
258
+ },
259
+ fixHSB = function (hsb) {
260
+ return {
261
+ h: Math.min(360, Math.max(0, hsb.h)),
262
+ s: Math.min(100, Math.max(0, hsb.s)),
263
+ b: Math.min(100, Math.max(0, hsb.b))
264
+ };
265
+ },
266
+ fixRGB = function (rgb) {
267
+ return {
268
+ r: Math.min(255, Math.max(0, rgb.r)),
269
+ g: Math.min(255, Math.max(0, rgb.g)),
270
+ b: Math.min(255, Math.max(0, rgb.b))
271
+ };
272
+ },
273
+ fixHex = function (hex) {
274
+ var len = 6 - hex.length;
275
+ if (len > 0) {
276
+ var o = [];
277
+ for (var i=0; i<len; i++) {
278
+ o.push('0');
279
+ }
280
+ o.push(hex);
281
+ hex = o.join('');
282
+ }
283
+ return hex;
284
+ },
285
+ HexToRGB = function (hex) {
286
+ var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
287
+ return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
288
+ },
289
+ HexToHSB = function (hex) {
290
+ return RGBToHSB(HexToRGB(hex));
291
+ },
292
+ RGBToHSB = function (rgb) {
293
+ var hsb = {
294
+ h: 0,
295
+ s: 0,
296
+ b: 0
297
+ };
298
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
299
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
300
+ var delta = max - min;
301
+ hsb.b = max;
302
+ if (max != 0) {
303
+
304
+ }
305
+ hsb.s = max != 0 ? 255 * delta / max : 0;
306
+ if (hsb.s != 0) {
307
+ if (rgb.r == max) {
308
+ hsb.h = (rgb.g - rgb.b) / delta;
309
+ } else if (rgb.g == max) {
310
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
311
+ } else {
312
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
313
+ }
314
+ } else {
315
+ hsb.h = -1;
316
+ }
317
+ hsb.h *= 60;
318
+ if (hsb.h < 0) {
319
+ hsb.h += 360;
320
+ }
321
+ hsb.s *= 100/255;
322
+ hsb.b *= 100/255;
323
+ return hsb;
324
+ },
325
+ HSBToRGB = function (hsb) {
326
+ var rgb = {};
327
+ var h = Math.round(hsb.h);
328
+ var s = Math.round(hsb.s*255/100);
329
+ var v = Math.round(hsb.b*255/100);
330
+ if(s == 0) {
331
+ rgb.r = rgb.g = rgb.b = v;
332
+ } else {
333
+ var t1 = v;
334
+ var t2 = (255-s)*v/255;
335
+ var t3 = (t1-t2)*(h%60)/60;
336
+ if(h==360) h = 0;
337
+ if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
338
+ else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
339
+ else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
340
+ else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
341
+ else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
342
+ else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
343
+ else {rgb.r=0; rgb.g=0; rgb.b=0}
344
+ }
345
+ return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
346
+ },
347
+ RGBToHex = function (rgb) {
348
+ var hex = [
349
+ rgb.r.toString(16),
350
+ rgb.g.toString(16),
351
+ rgb.b.toString(16)
352
+ ];
353
+ jQuery.each(hex, function (nr, val) {
354
+ if (val.length == 1) {
355
+ hex[nr] = '0' + val;
356
+ }
357
+ });
358
+ return hex.join('');
359
+ },
360
+ HSBToHex = function (hsb) {
361
+ return RGBToHex(HSBToRGB(hsb));
362
+ },
363
+ restoreOriginal = function () {
364
+ var cal = jQuery(this).parent();
365
+ var col = cal.data('colorpicker').origColor;
366
+ cal.data('colorpicker').color = col;
367
+ fillRGBFields(col, cal.get(0));
368
+ fillHexFields(col, cal.get(0));
369
+ fillHSBFields(col, cal.get(0));
370
+ setSelector(col, cal.get(0));
371
+ setHue(col, cal.get(0));
372
+ setNewColor(col, cal.get(0));
373
+ };
374
+ return {
375
+ init: function (opt) {
376
+ opt = jQuery.extend({}, defaults, opt||{});
377
+ if (typeof opt.color == 'string') {
378
+ opt.color = HexToHSB(opt.color);
379
+ } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
380
+ opt.color = RGBToHSB(opt.color);
381
+ } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
382
+ opt.color = fixHSB(opt.color);
383
+ } else {
384
+ return this;
385
+ }
386
+ return this.each(function () {
387
+ if (!jQuery(this).data('colorpickerId')) {
388
+ var options = jQuery.extend({}, opt);
389
+ options.origColor = opt.color;
390
+ var id = 'collorpicker_' + parseInt(Math.random() * 1000);
391
+ jQuery(this).data('colorpickerId', id);
392
+ var cal = jQuery(tpl).attr('id', id);
393
+ if (options.flat) {
394
+ cal.appendTo(this).show();
395
+ } else {
396
+ cal.appendTo(document.body);
397
+ }
398
+ options.fields = cal
399
+ .find('input')
400
+ .bind('keyup', keyDown)
401
+ .bind('change', change)
402
+ .bind('blur', blur)
403
+ .bind('focus', focus);
404
+ cal
405
+ .find('span').bind('mousedown', downIncrement).end()
406
+ .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
407
+ options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
408
+ options.selectorIndic = options.selector.find('div div');
409
+ options.el = this;
410
+ options.hue = cal.find('div.colorpicker_hue div');
411
+ cal.find('div.colorpicker_hue').bind('mousedown', downHue);
412
+ options.newColor = cal.find('div.colorpicker_new_color');
413
+ options.currentColor = cal.find('div.colorpicker_current_color');
414
+ cal.data('colorpicker', options);
415
+ cal.find('div.colorpicker_submit')
416
+ .bind('mouseenter', enterSubmit)
417
+ .bind('mouseleave', leaveSubmit)
418
+ .bind('click', clickSubmit);
419
+ fillRGBFields(options.color, cal.get(0));
420
+ fillHSBFields(options.color, cal.get(0));
421
+ fillHexFields(options.color, cal.get(0));
422
+ setHue(options.color, cal.get(0));
423
+ setSelector(options.color, cal.get(0));
424
+ setCurrentColor(options.color, cal.get(0));
425
+ setNewColor(options.color, cal.get(0));
426
+ if (options.flat) {
427
+ cal.css({
428
+ position: 'relative',
429
+ display: 'block'
430
+ });
431
+ } else {
432
+ jQuery(this).bind(options.eventName, show);
433
+ }
434
+ }
435
+ });
436
+ },
437
+ showPicker: function() {
438
+ return this.each( function () {
439
+ if (jQuery(this).data('colorpickerId')) {
440
+ show.apply(this);
441
+ }
442
+ });
443
+ },
444
+ hidePicker: function() {
445
+ return this.each( function () {
446
+ if (jQuery(this).data('colorpickerId')) {
447
+ jQuery('#' + jQuery(this).data('colorpickerId')).hide();
448
+ }
449
+ });
450
+ },
451
+ setColor: function(col) {
452
+ if (typeof col == 'string') {
453
+ col = HexToHSB(col);
454
+ } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
455
+ col = RGBToHSB(col);
456
+ } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
457
+ col = fixHSB(col);
458
+ } else {
459
+ return this;
460
+ }
461
+ return this.each(function(){
462
+ if (jQuery(this).data('colorpickerId')) {
463
+ var cal = jQuery('#' + jQuery(this).data('colorpickerId'));
464
+ cal.data('colorpicker').color = col;
465
+ cal.data('colorpicker').origColor = col;
466
+ fillRGBFields(col, cal.get(0));
467
+ fillHSBFields(col, cal.get(0));
468
+ fillHexFields(col, cal.get(0));
469
+ setHue(col, cal.get(0));
470
+ setSelector(col, cal.get(0));
471
+ setCurrentColor(col, cal.get(0));
472
+ setNewColor(col, cal.get(0));
473
+ }
474
+ });
475
+ }
476
+ };
477
+ }();
478
+ jQuery.fn.extend({
479
+ ColorPicker: ColorPicker.init,
480
+ ColorPickerHide: ColorPicker.hidePicker,
481
+ ColorPickerShow: ColorPicker.showPicker,
482
+ ColorPickerSetColor: ColorPicker.setColor
483
+ });
484
+ })(jQuery)
include/colorpicker/js/colorpicker.js CHANGED
@@ -1,484 +1 @@
1
- /**
2
- *
3
- * Color picker
4
- * Author: Stefan Petre www.eyecon.ro
5
- *
6
- * Dual licensed under the MIT and GPL licenses
7
- *
8
- */
9
- (function (jQuery) {
10
- var ColorPicker = function () {
11
- var
12
- ids = {},
13
- inAction,
14
- charMin = 65,
15
- visible,
16
- tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
17
- defaults = {
18
- eventName: 'click',
19
- onShow: function () {},
20
- onBeforeShow: function(){},
21
- onHide: function () {},
22
- onChange: function () {},
23
- onSubmit: function () {},
24
- color: 'ff0000',
25
- livePreview: true,
26
- flat: false
27
- },
28
- fillRGBFields = function (hsb, cal) {
29
- var rgb = HSBToRGB(hsb);
30
- jQuery(cal).data('colorpicker').fields
31
- .eq(1).val(rgb.r).end()
32
- .eq(2).val(rgb.g).end()
33
- .eq(3).val(rgb.b).end();
34
- },
35
- fillHSBFields = function (hsb, cal) {
36
- jQuery(cal).data('colorpicker').fields
37
- .eq(4).val(hsb.h).end()
38
- .eq(5).val(hsb.s).end()
39
- .eq(6).val(hsb.b).end();
40
- },
41
- fillHexFields = function (hsb, cal) {
42
- jQuery(cal).data('colorpicker').fields
43
- .eq(0).val(HSBToHex(hsb)).end();
44
- },
45
- setSelector = function (hsb, cal) {
46
- jQuery(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
47
- jQuery(cal).data('colorpicker').selectorIndic.css({
48
- left: parseInt(150 * hsb.s/100, 10),
49
- top: parseInt(150 * (100-hsb.b)/100, 10)
50
- });
51
- },
52
- setHue = function (hsb, cal) {
53
- jQuery(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
54
- },
55
- setCurrentColor = function (hsb, cal) {
56
- jQuery(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
57
- },
58
- setNewColor = function (hsb, cal) {
59
- jQuery(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
60
- },
61
- keyDown = function (ev) {
62
- var pressedKey = ev.charCode || ev.keyCode || -1;
63
- if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
64
- return false;
65
- }
66
- var cal = jQuery(this).parent().parent();
67
- if (cal.data('colorpicker').livePreview === true) {
68
- change.apply(this);
69
- }
70
- },
71
- change = function (ev) {
72
- var cal = jQuery(this).parent().parent(), col;
73
- if (this.parentNode.className.indexOf('_hex') > 0) {
74
- cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
75
- } else if (this.parentNode.className.indexOf('_hsb') > 0) {
76
- cal.data('colorpicker').color = col = fixHSB({
77
- h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
78
- s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
79
- b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
80
- });
81
- } else {
82
- cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
83
- r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
84
- g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
85
- b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
86
- }));
87
- }
88
- if (ev) {
89
- fillRGBFields(col, cal.get(0));
90
- fillHexFields(col, cal.get(0));
91
- fillHSBFields(col, cal.get(0));
92
- }
93
- setSelector(col, cal.get(0));
94
- setHue(col, cal.get(0));
95
- setNewColor(col, cal.get(0));
96
- cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
97
- },
98
- blur = function (ev) {
99
- var cal = jQuery(this).parent().parent();
100
- cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
101
- },
102
- focus = function () {
103
- charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
104
- jQuery(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
105
- jQuery(this).parent().addClass('colorpicker_focus');
106
- },
107
- downIncrement = function (ev) {
108
- var field = jQuery(this).parent().find('input').focus();
109
- var current = {
110
- el: jQuery(this).parent().addClass('colorpicker_slider'),
111
- max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
112
- y: ev.pageY,
113
- field: field,
114
- val: parseInt(field.val(), 10),
115
- preview: jQuery(this).parent().parent().data('colorpicker').livePreview
116
- };
117
- jQuery(document).bind('mouseup', current, upIncrement);
118
- jQuery(document).bind('mousemove', current, moveIncrement);
119
- },
120
- moveIncrement = function (ev) {
121
- ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
122
- if (ev.data.preview) {
123
- change.apply(ev.data.field.get(0), [true]);
124
- }
125
- return false;
126
- },
127
- upIncrement = function (ev) {
128
- change.apply(ev.data.field.get(0), [true]);
129
- ev.data.el.removeClass('colorpicker_slider').find('input').focus();
130
- jQuery(document).unbind('mouseup', upIncrement);
131
- jQuery(document).unbind('mousemove', moveIncrement);
132
- return false;
133
- },
134
- downHue = function (ev) {
135
- var current = {
136
- cal: jQuery(this).parent(),
137
- y: jQuery(this).offset().top
138
- };
139
- current.preview = current.cal.data('colorpicker').livePreview;
140
- jQuery(document).bind('mouseup', current, upHue);
141
- jQuery(document).bind('mousemove', current, moveHue);
142
- },
143
- moveHue = function (ev) {
144
- change.apply(
145
- ev.data.cal.data('colorpicker')
146
- .fields
147
- .eq(4)
148
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
149
- .get(0),
150
- [ev.data.preview]
151
- );
152
- return false;
153
- },
154
- upHue = function (ev) {
155
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
156
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
157
- jQuery(document).unbind('mouseup', upHue);
158
- jQuery(document).unbind('mousemove', moveHue);
159
- return false;
160
- },
161
- downSelector = function (ev) {
162
- var current = {
163
- cal: jQuery(this).parent(),
164
- pos: jQuery(this).offset()
165
- };
166
- current.preview = current.cal.data('colorpicker').livePreview;
167
- jQuery(document).bind('mouseup', current, upSelector);
168
- jQuery(document).bind('mousemove', current, moveSelector);
169
- },
170
- moveSelector = function (ev) {
171
- change.apply(
172
- ev.data.cal.data('colorpicker')
173
- .fields
174
- .eq(6)
175
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
176
- .end()
177
- .eq(5)
178
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
179
- .get(0),
180
- [ev.data.preview]
181
- );
182
- return false;
183
- },
184
- upSelector = function (ev) {
185
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
186
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
187
- jQuery(document).unbind('mouseup', upSelector);
188
- jQuery(document).unbind('mousemove', moveSelector);
189
- return false;
190
- },
191
- enterSubmit = function (ev) {
192
- jQuery(this).addClass('colorpicker_focus');
193
- },
194
- leaveSubmit = function (ev) {
195
- jQuery(this).removeClass('colorpicker_focus');
196
- },
197
- clickSubmit = function (ev) {
198
- var cal = jQuery(this).parent();
199
- var col = cal.data('colorpicker').color;
200
- cal.data('colorpicker').origColor = col;
201
- setCurrentColor(col, cal.get(0));
202
- cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
203
- },
204
- show = function (ev) {
205
- var cal = jQuery('#' + jQuery(this).data('colorpickerId'));
206
- cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
207
- var pos = jQuery(this).offset();
208
- var viewPort = getViewport();
209
- var top = pos.top + this.offsetHeight;
210
- var left = pos.left;
211
- if (top + 176 > viewPort.t + viewPort.h) {
212
- top -= this.offsetHeight + 176;
213
- }
214
- if (left + 356 > viewPort.l + viewPort.w) {
215
- left -= 356;
216
- }
217
- cal.css({left: left + 'px', top: top + 'px'});
218
- if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
219
- cal.show();
220
- }
221
- jQuery(document).bind('mousedown', {cal: cal}, hide);
222
- return false;
223
- },
224
- hide = function (ev) {
225
- if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
226
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
227
- ev.data.cal.hide();
228
- }
229
- jQuery(document).unbind('mousedown', hide);
230
- }
231
- },
232
- isChildOf = function(parentEl, el, container) {
233
- if (parentEl == el) {
234
- return true;
235
- }
236
- if (parentEl.contains) {
237
- return parentEl.contains(el);
238
- }
239
- if ( parentEl.compareDocumentPosition ) {
240
- return !!(parentEl.compareDocumentPosition(el) & 16);
241
- }
242
- var prEl = el.parentNode;
243
- while(prEl && prEl != container) {
244
- if (prEl == parentEl)
245
- return true;
246
- prEl = prEl.parentNode;
247
- }
248
- return false;
249
- },
250
- getViewport = function () {
251
- var m = document.compatMode == 'CSS1Compat';
252
- return {
253
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
254
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
255
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
256
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
257
- };
258
- },
259
- fixHSB = function (hsb) {
260
- return {
261
- h: Math.min(360, Math.max(0, hsb.h)),
262
- s: Math.min(100, Math.max(0, hsb.s)),
263
- b: Math.min(100, Math.max(0, hsb.b))
264
- };
265
- },
266
- fixRGB = function (rgb) {
267
- return {
268
- r: Math.min(255, Math.max(0, rgb.r)),
269
- g: Math.min(255, Math.max(0, rgb.g)),
270
- b: Math.min(255, Math.max(0, rgb.b))
271
- };
272
- },
273
- fixHex = function (hex) {
274
- var len = 6 - hex.length;
275
- if (len > 0) {
276
- var o = [];
277
- for (var i=0; i<len; i++) {
278
- o.push('0');
279
- }
280
- o.push(hex);
281
- hex = o.join('');
282
- }
283
- return hex;
284
- },
285
- HexToRGB = function (hex) {
286
- var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
287
- return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
288
- },
289
- HexToHSB = function (hex) {
290
- return RGBToHSB(HexToRGB(hex));
291
- },
292
- RGBToHSB = function (rgb) {
293
- var hsb = {
294
- h: 0,
295
- s: 0,
296
- b: 0
297
- };
298
- var min = Math.min(rgb.r, rgb.g, rgb.b);
299
- var max = Math.max(rgb.r, rgb.g, rgb.b);
300
- var delta = max - min;
301
- hsb.b = max;
302
- if (max != 0) {
303
-
304
- }
305
- hsb.s = max != 0 ? 255 * delta / max : 0;
306
- if (hsb.s != 0) {
307
- if (rgb.r == max) {
308
- hsb.h = (rgb.g - rgb.b) / delta;
309
- } else if (rgb.g == max) {
310
- hsb.h = 2 + (rgb.b - rgb.r) / delta;
311
- } else {
312
- hsb.h = 4 + (rgb.r - rgb.g) / delta;
313
- }
314
- } else {
315
- hsb.h = -1;
316
- }
317
- hsb.h *= 60;
318
- if (hsb.h < 0) {
319
- hsb.h += 360;
320
- }
321
- hsb.s *= 100/255;
322
- hsb.b *= 100/255;
323
- return hsb;
324
- },
325
- HSBToRGB = function (hsb) {
326
- var rgb = {};
327
- var h = Math.round(hsb.h);
328
- var s = Math.round(hsb.s*255/100);
329
- var v = Math.round(hsb.b*255/100);
330
- if(s == 0) {
331
- rgb.r = rgb.g = rgb.b = v;
332
- } else {
333
- var t1 = v;
334
- var t2 = (255-s)*v/255;
335
- var t3 = (t1-t2)*(h%60)/60;
336
- if(h==360) h = 0;
337
- if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
338
- else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
339
- else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
340
- else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
341
- else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
342
- else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
343
- else {rgb.r=0; rgb.g=0; rgb.b=0}
344
- }
345
- return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
346
- },
347
- RGBToHex = function (rgb) {
348
- var hex = [
349
- rgb.r.toString(16),
350
- rgb.g.toString(16),
351
- rgb.b.toString(16)
352
- ];
353
- jQuery.each(hex, function (nr, val) {
354
- if (val.length == 1) {
355
- hex[nr] = '0' + val;
356
- }
357
- });
358
- return hex.join('');
359
- },
360
- HSBToHex = function (hsb) {
361
- return RGBToHex(HSBToRGB(hsb));
362
- },
363
- restoreOriginal = function () {
364
- var cal = jQuery(this).parent();
365
- var col = cal.data('colorpicker').origColor;
366
- cal.data('colorpicker').color = col;
367
- fillRGBFields(col, cal.get(0));
368
- fillHexFields(col, cal.get(0));
369
- fillHSBFields(col, cal.get(0));
370
- setSelector(col, cal.get(0));
371
- setHue(col, cal.get(0));
372
- setNewColor(col, cal.get(0));
373
- };
374
- return {
375
- init: function (opt) {
376
- opt = jQuery.extend({}, defaults, opt||{});
377
- if (typeof opt.color == 'string') {
378
- opt.color = HexToHSB(opt.color);
379
- } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
380
- opt.color = RGBToHSB(opt.color);
381
- } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
382
- opt.color = fixHSB(opt.color);
383
- } else {
384
- return this;
385
- }
386
- return this.each(function () {
387
- if (!jQuery(this).data('colorpickerId')) {
388
- var options = jQuery.extend({}, opt);
389
- options.origColor = opt.color;
390
- var id = 'collorpicker_' + parseInt(Math.random() * 1000);
391
- jQuery(this).data('colorpickerId', id);
392
- var cal = jQuery(tpl).attr('id', id);
393
- if (options.flat) {
394
- cal.appendTo(this).show();
395
- } else {
396
- cal.appendTo(document.body);
397
- }
398
- options.fields = cal
399
- .find('input')
400
- .bind('keyup', keyDown)
401
- .bind('change', change)
402
- .bind('blur', blur)
403
- .bind('focus', focus);
404
- cal
405
- .find('span').bind('mousedown', downIncrement).end()
406
- .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
407
- options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
408
- options.selectorIndic = options.selector.find('div div');
409
- options.el = this;
410
- options.hue = cal.find('div.colorpicker_hue div');
411
- cal.find('div.colorpicker_hue').bind('mousedown', downHue);
412
- options.newColor = cal.find('div.colorpicker_new_color');
413
- options.currentColor = cal.find('div.colorpicker_current_color');
414
- cal.data('colorpicker', options);
415
- cal.find('div.colorpicker_submit')
416
- .bind('mouseenter', enterSubmit)
417
- .bind('mouseleave', leaveSubmit)
418
- .bind('click', clickSubmit);
419
- fillRGBFields(options.color, cal.get(0));
420
- fillHSBFields(options.color, cal.get(0));
421
- fillHexFields(options.color, cal.get(0));
422
- setHue(options.color, cal.get(0));
423
- setSelector(options.color, cal.get(0));
424
- setCurrentColor(options.color, cal.get(0));
425
- setNewColor(options.color, cal.get(0));
426
- if (options.flat) {
427
- cal.css({
428
- position: 'relative',
429
- display: 'block'
430
- });
431
- } else {
432
- jQuery(this).bind(options.eventName, show);
433
- }
434
- }
435
- });
436
- },
437
- showPicker: function() {
438
- return this.each( function () {
439
- if (jQuery(this).data('colorpickerId')) {
440
- show.apply(this);
441
- }
442
- });
443
- },
444
- hidePicker: function() {
445
- return this.each( function () {
446
- if (jQuery(this).data('colorpickerId')) {
447
- jQuery('#' + jQuery(this).data('colorpickerId')).hide();
448
- }
449
- });
450
- },
451
- setColor: function(col) {
452
- if (typeof col == 'string') {
453
- col = HexToHSB(col);
454
- } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
455
- col = RGBToHSB(col);
456
- } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
457
- col = fixHSB(col);
458
- } else {
459
- return this;
460
- }
461
- return this.each(function(){
462
- if (jQuery(this).data('colorpickerId')) {
463
- var cal = jQuery('#' + jQuery(this).data('colorpickerId'));
464
- cal.data('colorpicker').color = col;
465
- cal.data('colorpicker').origColor = col;
466
- fillRGBFields(col, cal.get(0));
467
- fillHSBFields(col, cal.get(0));
468
- fillHexFields(col, cal.get(0));
469
- setHue(col, cal.get(0));
470
- setSelector(col, cal.get(0));
471
- setCurrentColor(col, cal.get(0));
472
- setNewColor(col, cal.get(0));
473
- }
474
- });
475
- }
476
- };
477
- }();
478
- jQuery.fn.extend({
479
- ColorPicker: ColorPicker.init,
480
- ColorPickerHide: ColorPicker.hidePicker,
481
- ColorPickerShow: ColorPicker.showPicker,
482
- ColorPickerSetColor: ColorPicker.setColor
483
- });
484
- })(jQuery)
1
+ (function(jQuery){var ColorPicker=function(){var ids={},inAction,charMin=65,visible,tpl='<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',defaults={eventName:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:"ff0000",livePreview:true,flat:false},fillRGBFields=function(hsb,cal){var rgb=HSBToRGB(hsb);jQuery(cal).data("colorpicker").fields.eq(1).val(rgb.r).end().eq(2).val(rgb.g).end().eq(3).val(rgb.b).end()},fillHSBFields=function(hsb,cal){jQuery(cal).data("colorpicker").fields.eq(4).val(hsb.h).end().eq(5).val(hsb.s).end().eq(6).val(hsb.b).end()},fillHexFields=function(hsb,cal){jQuery(cal).data("colorpicker").fields.eq(0).val(HSBToHex(hsb)).end()},setSelector=function(hsb,cal){jQuery(cal).data("colorpicker").selector.css("backgroundColor","#"+HSBToHex({h:hsb.h,s:100,b:100}));jQuery(cal).data("colorpicker").selectorIndic.css({left:parseInt(150*hsb.s/100,10),top:parseInt(150*(100-hsb.b)/100,10)})},setHue=function(hsb,cal){jQuery(cal).data("colorpicker").hue.css("top",parseInt(150-150*hsb.h/360,10))},setCurrentColor=function(hsb,cal){jQuery(cal).data("colorpicker").currentColor.css("backgroundColor","#"+HSBToHex(hsb))},setNewColor=function(hsb,cal){jQuery(cal).data("colorpicker").newColor.css("backgroundColor","#"+HSBToHex(hsb))},keyDown=function(ev){var pressedKey=ev.charCode||ev.keyCode||-1;if((pressedKey>charMin&&pressedKey<=90)||pressedKey==32){return false}var cal=jQuery(this).parent().parent();if(cal.data("colorpicker").livePreview===true){change.apply(this)}},change=function(ev){var cal=jQuery(this).parent().parent(),col;if(this.parentNode.className.indexOf("_hex")>0){cal.data("colorpicker").color=col=HexToHSB(fixHex(this.value))}else{if(this.parentNode.className.indexOf("_hsb")>0){cal.data("colorpicker").color=col=fixHSB({h:parseInt(cal.data("colorpicker").fields.eq(4).val(),10),s:parseInt(cal.data("colorpicker").fields.eq(5).val(),10),b:parseInt(cal.data("colorpicker").fields.eq(6).val(),10)})}else{cal.data("colorpicker").color=col=RGBToHSB(fixRGB({r:parseInt(cal.data("colorpicker").fields.eq(1).val(),10),g:parseInt(cal.data("colorpicker").fields.eq(2).val(),10),b:parseInt(cal.data("colorpicker").fields.eq(3).val(),10)}))}}if(ev){fillRGBFields(col,cal.get(0));fillHexFields(col,cal.get(0));fillHSBFields(col,cal.get(0))}setSelector(col,cal.get(0));setHue(col,cal.get(0));setNewColor(col,cal.get(0));cal.data("colorpicker").onChange.apply(cal,[col,HSBToHex(col),HSBToRGB(col)])},blur=function(ev){var cal=jQuery(this).parent().parent();cal.data("colorpicker").fields.parent().removeClass("colorpicker_focus")},focus=function(){charMin=this.parentNode.className.indexOf("_hex")>0?70:65;jQuery(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");jQuery(this).parent().addClass("colorpicker_focus")},downIncrement=function(ev){var field=jQuery(this).parent().find("input").focus();var current={el:jQuery(this).parent().addClass("colorpicker_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:(this.parentNode.className.indexOf("_hsb")>0?100:255),y:ev.pageY,field:field,val:parseInt(field.val(),10),preview:jQuery(this).parent().parent().data("colorpicker").livePreview};jQuery(document).bind("mouseup",current,upIncrement);jQuery(document).bind("mousemove",current,moveIncrement)},moveIncrement=function(ev){ev.data.field.val(Math.max(0,Math.min(ev.data.max,parseInt(ev.data.val+ev.pageY-ev.data.y,10))));if(ev.data.preview){change.apply(ev.data.field.get(0),[true])}return false},upIncrement=function(ev){change.apply(ev.data.field.get(0),[true]);ev.data.el.removeClass("colorpicker_slider").find("input").focus();jQuery(document).unbind("mouseup",upIncrement);jQuery(document).unbind("mousemove",moveIncrement);return false},downHue=function(ev){var current={cal:jQuery(this).parent(),y:jQuery(this).offset().top};current.preview=current.cal.data("colorpicker").livePreview;jQuery(document).bind("mouseup",current,upHue);jQuery(document).bind("mousemove",current,moveHue)},moveHue=function(ev){change.apply(ev.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,(ev.pageY-ev.data.y))))/150,10)).get(0),[ev.data.preview]);return false},upHue=function(ev){fillRGBFields(ev.data.cal.data("colorpicker").color,ev.data.cal.get(0));fillHexFields(ev.data.cal.data("colorpicker").color,ev.data.cal.get(0));jQuery(document).unbind("mouseup",upHue);jQuery(document).unbind("mousemove",moveHue);return false},downSelector=function(ev){var current={cal:jQuery(this).parent(),pos:jQuery(this).offset()};current.preview=current.cal.data("colorpicker").livePreview;jQuery(document).bind("mouseup",current,upSelector);jQuery(document).bind("mousemove",current,moveSelector)},moveSelector=function(ev){change.apply(ev.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,(ev.pageY-ev.data.pos.top))))/150,10)).end().eq(5).val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX-ev.data.pos.left))))/150,10)).get(0),[ev.data.preview]);return false},upSelector=function(ev){fillRGBFields(ev.data.cal.data("colorpicker").color,ev.data.cal.get(0));fillHexFields(ev.data.cal.data("colorpicker").color,ev.data.cal.get(0));jQuery(document).unbind("mouseup",upSelector);jQuery(document).unbind("mousemove",moveSelector);return false},enterSubmit=function(ev){jQuery(this).addClass("colorpicker_focus")},leaveSubmit=function(ev){jQuery(this).removeClass("colorpicker_focus")},clickSubmit=function(ev){var cal=jQuery(this).parent();var col=cal.data("colorpicker").color;cal.data("colorpicker").origColor=col;setCurrentColor(col,cal.get(0));cal.data("colorpicker").onSubmit(col,HSBToHex(col),HSBToRGB(col),cal.data("colorpicker").el)},show=function(ev){var cal=jQuery("#"+jQuery(this).data("colorpickerId"));cal.data("colorpicker").onBeforeShow.apply(this,[cal.get(0)]);var pos=jQuery(this).offset();var viewPort=getViewport();var top=pos.top+this.offsetHeight;var left=pos.left;if(top+176>viewPort.t+viewPort.h){top-=this.offsetHeight+176}if(left+356>viewPort.l+viewPort.w){left-=356}cal.css({left:left+"px",top:top+"px"});if(cal.data("colorpicker").onShow.apply(this,[cal.get(0)])!=false){cal.show()}jQuery(document).bind("mousedown",{cal:cal},hide);return false},hide=function(ev){if(!isChildOf(ev.data.cal.get(0),ev.target,ev.data.cal.get(0))){if(ev.data.cal.data("colorpicker").onHide.apply(this,[ev.data.cal.get(0)])!=false){ev.data.cal.hide()}jQuery(document).unbind("mousedown",hide)}},isChildOf=function(parentEl,el,container){if(parentEl==el){return true}if(parentEl.contains){return parentEl.contains(el)}if(parentEl.compareDocumentPosition){return !!(parentEl.compareDocumentPosition(el)&16)}var prEl=el.parentNode;while(prEl&&prEl!=container){if(prEl==parentEl){return true}prEl=prEl.parentNode}return false},getViewport=function(){var m=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(m?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(m?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(m?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(m?document.documentElement.clientHeight:document.body.clientHeight)}},fixHSB=function(hsb){return{h:Math.min(360,Math.max(0,hsb.h)),s:Math.min(100,Math.max(0,hsb.s)),b:Math.min(100,Math.max(0,hsb.b))}},fixRGB=function(rgb){return{r:Math.min(255,Math.max(0,rgb.r)),g:Math.min(255,Math.max(0,rgb.g)),b:Math.min(255,Math.max(0,rgb.b))}},fixHex=function(hex){var len=6-hex.length;if(len>0){var o=[];for(var i=0;i<len;i++){o.push("0")}o.push(hex);hex=o.join("")}return hex},HexToRGB=function(hex){var hex=parseInt(((hex.indexOf("#")>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&65280)>>8,b:(hex&255)}},HexToHSB=function(hex){return RGBToHSB(HexToRGB(hex))},RGBToHSB=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;if(max!=0){}hsb.s=max!=0?255*delta/max:0;if(hsb.s!=0){if(rgb.r==max){hsb.h=(rgb.g-rgb.b)/delta}else{if(rgb.g==max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb},HSBToRGB=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s==0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h==360){h=0}if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else{if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else{if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else{if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else{if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else{if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}}}}}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}},RGBToHex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];jQuery.each(hex,function(nr,val){if(val.length==1){hex[nr]="0"+val}});return hex.join("")},HSBToHex=function(hsb){return RGBToHex(HSBToRGB(hsb))},restoreOriginal=function(){var cal=jQuery(this).parent();var col=cal.data("colorpicker").origColor;cal.data("colorpicker").color=col;fillRGBFields(col,cal.get(0));fillHexFields(col,cal.get(0));fillHSBFields(col,cal.get(0));setSelector(col,cal.get(0));setHue(col,cal.get(0));setNewColor(col,cal.get(0))};return{init:function(opt){opt=jQuery.extend({},defaults,opt||{});if(typeof opt.color=="string"){opt.color=HexToHSB(opt.color)}else{if(opt.color.r!=undefined&&opt.color.g!=undefined&&opt.color.b!=undefined){opt.color=RGBToHSB(opt.color)}else{if(opt.color.h!=undefined&&opt.color.s!=undefined&&opt.color.b!=undefined){opt.color=fixHSB(opt.color)}else{return this}}}return this.each(function(){if(!jQuery(this).data("colorpickerId")){var options=jQuery.extend({},opt);options.origColor=opt.color;var id="collorpicker_"+parseInt(Math.random()*1000);jQuery(this).data("colorpickerId",id);var cal=jQuery(tpl).attr("id",id);if(options.flat){cal.appendTo(this).show()}else{cal.appendTo(document.body)}options.fields=cal.find("input").bind("keyup",keyDown).bind("change",change).bind("blur",blur).bind("focus",focus);cal.find("span").bind("mousedown",downIncrement).end().find(">div.colorpicker_current_color").bind("click",restoreOriginal);options.selector=cal.find("div.colorpicker_color").bind("mousedown",downSelector);options.selectorIndic=options.selector.find("div div");options.el=this;options.hue=cal.find("div.colorpicker_hue div");cal.find("div.colorpicker_hue").bind("mousedown",downHue);options.newColor=cal.find("div.colorpicker_new_color");options.currentColor=cal.find("div.colorpicker_current_color");cal.data("colorpicker",options);cal.find("div.colorpicker_submit").bind("mouseenter",enterSubmit).bind("mouseleave",leaveSubmit).bind("click",clickSubmit);fillRGBFields(options.color,cal.get(0));fillHSBFields(options.color,cal.get(0));fillHexFields(options.color,cal.get(0));setHue(options.color,cal.get(0));setSelector(options.color,cal.get(0));setCurrentColor(options.color,cal.get(0));setNewColor(options.color,cal.get(0));if(options.flat){cal.css({position:"relative",display:"block"})}else{jQuery(this).bind(options.eventName,show)}}})},showPicker:function(){return this.each(function(){if(jQuery(this).data("colorpickerId")){show.apply(this)}})},hidePicker:function(){return this.each(function(){if(jQuery(this).data("colorpickerId")){jQuery("#"+jQuery(this).data("colorpickerId")).hide()}})},setColor:function(col){if(typeof col=="string"){col=HexToHSB(col)}else{if(col.r!=undefined&&col.g!=undefined&&col.b!=undefined){col=RGBToHSB(col)}else{if(col.h!=undefined&&col.s!=undefined&&col.b!=undefined){col=fixHSB(col)}else{return this}}}return this.each(function(){if(jQuery(this).data("colorpickerId")){var cal=jQuery("#"+jQuery(this).data("colorpickerId"));cal.data("colorpicker").color=col;cal.data("colorpicker").origColor=col;fillRGBFields(col,cal.get(0));fillHSBFields(col,cal.get(0));fillHexFields(col,cal.get(0));setHue(col,cal.get(0));setSelector(col,cal.get(0));setCurrentColor(col,cal.get(0));setNewColor(col,cal.get(0))}})}}}();jQuery.fn.extend({ColorPicker:ColorPicker.init,ColorPickerHide:ColorPicker.hidePicker,ColorPickerShow:ColorPicker.showPicker,ColorPickerSetColor:ColorPicker.setColor})})(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
include/counterwidget.php CHANGED
@@ -39,7 +39,7 @@ class S2_Counter_widget extends WP_Widget {
39
  */
40
  function update($new_instance, $old_instance) {
41
  $instance = $old_instance;
42
- $instance['title'] = strip_tags(stripslashes($new_instance['title']));
43
  $instance['s2w_bg'] = strip_tags(stripslashes($new_instance['s2w_bg']));
44
  $instance['s2w_fg'] = strip_tags(stripslashes($new_instance['s2w_fg']));
45
  $instance['s2w_width'] = strip_tags(stripslashes($new_instance['s2w_width']));
@@ -70,27 +70,27 @@ class S2_Counter_widget extends WP_Widget {
70
  $s2w_height = htmlspecialchars($instance['s2w_height'], ENT_QUOTES);
71
  $s2w_font = htmlspecialchars($instance['s2w_font'], ENT_QUOTES);
72
  echo "<div>\r\n";
73
- echo "<fieldset><legend>" . __('Widget Title', 'subscribe2') . "</legend>\r\n";
74
- echo "<label><input type=\"text\" name=\"" . $this->get_field_name('title') . "\" id=\"" . $this->get_field_id('title') . "\" value=\"" . $s2w_title . "\" /></label>\r\n";
75
  echo "</fieldset>\r\n";
76
 
77
  echo "<fieldset>\r\n";
78
  echo "<legend>" . __('Color Scheme', 'subscribe2') . "</legend>\r\n";
79
  echo "<label>\r\n";
80
- echo "<input type=\"text\" name=\"" . $this->get_field_name('s2w_bg') . "\" id=\"" . $this->get_field_id('s2w_bg') . "\" maxlength=\"7\" value=\"" . $s2w_bg . "\" class=\"colorpickerField\" style=\"width:60px;\" /> " . __('Body', 'subscribe2') . "</label><br />\r\n";
81
  echo "<label>\r\n";
82
- echo "<input type=\"text\" name=\"" . $this->get_field_name('s2w_fg') . "\" id=\"" . $this->get_field_id('s2w_fg') . "\" maxlength=\"7\" value=\"" . $s2w_fg . "\" class=\"colorpickerField\" style=\"width:60px;\" /> " . __('Text', 'subsribe2') . "</label><br />\r\n";
83
  echo "</fieldset>";
84
 
85
  echo "<fieldset>\r\n";
86
  echo "<legend>" . __('Width, Height and Font Size', 'subscribe2') . "</legend>\r\n";
87
  echo "<table style=\"border:0; padding:0; margin:0 0 12px 0; border-collapse:collapse;\" align=\"center\">\r\n";
88
- echo "<tr><td>" . __('Width', 'subscribe2') . "</td>\r\n";
89
- echo "<td><label><input type=\"text\" name=\"" . $this->get_field_name('s2w_width') . "\" id=\"" . $this->get_field_id('s2w_width') . "\" value=\"" . $s2w_width . "\" /></label></td></tr>\r\n";
90
- echo "<tr><td>" . __('Height', 'subscribe2') . "</td>\r\n";
91
- echo "<td><label><input type=\"text\" name=\"" . $this->get_field_name('s2w_height') . "\" id=\"" . $this->get_field_id('s2w_height') . "\" value=\"" . $s2w_height . "\" /></label></td></tr>\r\n";
92
- echo "<tr><td>" . __('Font', 'subscribe2') . "</td>\r\n";
93
- echo "<td><label><input type=\"text\" name=\"" . $this->get_field_name('s2w_font') . "\" id=\"" . $this->get_field_id('s2w_font') . "\" value=\"" . $s2w_font . "\" /></label></td></tr>\r\n";
94
  echo "</table></fieldset></div>\r\n";
95
  }
96
  }// end S2_Counter_widget class
39
  */
40
  function update($new_instance, $old_instance) {
41
  $instance = $old_instance;
42
+ $instance['title'] = strip_tags(stripslashes($new_instance['title']));
43
  $instance['s2w_bg'] = strip_tags(stripslashes($new_instance['s2w_bg']));
44
  $instance['s2w_fg'] = strip_tags(stripslashes($new_instance['s2w_fg']));
45
  $instance['s2w_width'] = strip_tags(stripslashes($new_instance['s2w_width']));
70
  $s2w_height = htmlspecialchars($instance['s2w_height'], ENT_QUOTES);
71
  $s2w_font = htmlspecialchars($instance['s2w_font'], ENT_QUOTES);
72
  echo "<div>\r\n";
73
+ echo "<fieldset><legend><label for=\"" . $this->get_field_id('title') . "\">" . __('Widget Title', 'subscribe2') . "</label></legend>\r\n";
74
+ echo "<input type=\"text\" name=\"" . $this->get_field_name('title') . "\" id=\"" . $this->get_field_id('title') . "\" value=\"" . $s2w_title . "\" />\r\n";
75
  echo "</fieldset>\r\n";
76
 
77
  echo "<fieldset>\r\n";
78
  echo "<legend>" . __('Color Scheme', 'subscribe2') . "</legend>\r\n";
79
  echo "<label>\r\n";
80
+ echo "<input type=\"text\" name=\"" . $this->get_field_name('s2w_bg') . "\" id=\"" . $this->get_field_id('s2w_bg') . "\" maxlength=\"6\" value=\"" . $s2w_bg . "\" class=\"colorpickerField\" style=\"width:60px;\" /> " . __('Body', 'subscribe2') . "</label><br />\r\n";
81
  echo "<label>\r\n";
82
+ echo "<input type=\"text\" name=\"" . $this->get_field_name('s2w_fg') . "\" id=\"" . $this->get_field_id('s2w_fg') . "\" maxlength=\"6\" value=\"" . $s2w_fg . "\" class=\"colorpickerField\" style=\"width:60px;\" /> " . __('Text', 'subsribe2') . "</label><br />\r\n";
83
  echo "</fieldset>";
84
 
85
  echo "<fieldset>\r\n";
86
  echo "<legend>" . __('Width, Height and Font Size', 'subscribe2') . "</legend>\r\n";
87
  echo "<table style=\"border:0; padding:0; margin:0 0 12px 0; border-collapse:collapse;\" align=\"center\">\r\n";
88
+ echo "<tr><td><label for=\"" . $this->get_field_id('s2w_width') . "\">" . __('Width', 'subscribe2') . "</label></td>\r\n";
89
+ echo "<td><input type=\"text\" name=\"" . $this->get_field_name('s2w_width') . "\" id=\"" . $this->get_field_id('s2w_width') . "\" value=\"" . $s2w_width . "\" /></td></tr>\r\n";
90
+ echo "<tr><td><label for=\"" . $this->get_field_id('s2w_height') . "\">" . __('Height', 'subscribe2') . "</label></td>\r\n";
91
+ echo "<td><input type=\"text\" name=\"" . $this->get_field_name('s2w_height') . "\" id=\"" . $this->get_field_id('s2w_height') . "\" value=\"" . $s2w_height . "\" /></td></tr>\r\n";
92
+ echo "<tr><td><label for=\"" . $this->get_field_id('s2w_font') . "\">" . __('Font', 'subscribe2') . "</label></td>\r\n";
93
+ echo "<td><input type=\"text\" name=\"" . $this->get_field_name('s2w_font') . "\" id=\"" . $this->get_field_id('s2w_font') . "\" value=\"" . $s2w_font . "\" /></td></tr>\r\n";
94
  echo "</table></fieldset></div>\r\n";
95
  }
96
  }// end S2_Counter_widget class
include/options.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
  // include.php - Handles options 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['newreg_override'])) {
10
- $this->subscribe2_options['newreg_override'] = "no";
11
  } // option to autosubscribe registered users to new categories
12
 
13
  if (!isset($this->subscribe2_options['wpregdef'])) {
@@ -26,6 +26,10 @@ if (!isset($this->subscribe2_options['autosub_def'])) {
26
  $this->subscribe2_options['autosub_def'] = "yes";
27
  } // option for user default auto-subscription to new categories
28
 
 
 
 
 
29
  if(!isset($this->subscribe2_options['bcclimit'])) {
30
  $this->subscribe2_options['bcclimit'] = 0;
31
  } // option for default bcc limit on email notifications
@@ -58,6 +62,10 @@ if (!isset($this->subscribe2_options['email_freq'])) {
58
  $this->subscribe2_options['email_freq'] = "never";
59
  } // option for sending emails per-post or as a digest email on a cron schedule
60
 
 
 
 
 
61
  if (!isset($this->subscribe2_options['exclude'])) {
62
  $this->subscribe2_options['exclude'] = "";
63
  } // option for excluded categories
@@ -86,6 +94,10 @@ if (!isset($this->subscribe2_options['counterwidget'])) {
86
  $this->subscribe2_options['counterwidget'] = "0";
87
  } // option to enable Subscribe2 Counter Widget
88
 
 
 
 
 
89
  if (!isset($this->subscribe2_options['entries'])) {
90
  $this->subscribe2_options['entries'] = 25;
91
  } // option for the number of subscribers displayed on each page
1
+ <?php
2
  // include.php - Handles options 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['newreg_override'])) {
10
+ $this->subscribe2_options['newreg_override'] = "no";
11
  } // option to autosubscribe registered users to new categories
12
 
13
  if (!isset($this->subscribe2_options['wpregdef'])) {
26
  $this->subscribe2_options['autosub_def'] = "yes";
27
  } // option for user default auto-subscription to new categories
28
 
29
+ if (!isset($this->subscribe2_options['comment_subs'])) {
30
+ $this->subscribe2_options['comment_subs'] = "no";
31
+ } // option for commenters to subscribe as public subscribers
32
+
33
  if(!isset($this->subscribe2_options['bcclimit'])) {
34
  $this->subscribe2_options['bcclimit'] = 0;
35
  } // option for default bcc limit on email notifications
62
  $this->subscribe2_options['email_freq'] = "never";
63
  } // option for sending emails per-post or as a digest email on a cron schedule
64
 
65
+ if (!isset($this->subscribe2_options['cron_order'])) {
66
+ $this->subscribe2_options['cron_order'] = "desc";
67
+ } // option for ordering of posts in digest email
68
+
69
  if (!isset($this->subscribe2_options['exclude'])) {
70
  $this->subscribe2_options['exclude'] = "";
71
  } // option for excluded categories
94
  $this->subscribe2_options['counterwidget'] = "0";
95
  } // option to enable Subscribe2 Counter Widget
96
 
97
+ if(!isset($this->subscribe2_options['s2meta_default'])) {
98
+ $this->subscribe2_options['s2meta_default'] = "0";
99
+ } // option for Subscribe2 over ride postmeta to be checked by default
100
+
101
  if (!isset($this->subscribe2_options['entries'])) {
102
  $this->subscribe2_options['entries'] = 25;
103
  } // option for the number of subscribers displayed on each page
include/s2_checkbox.dev.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // version 1.0 - original version
2
+ // version 1.1 - Updated with function fixes and for WordPress 3.2 / jQuery 1.6
3
+ jQuery(document).ready(function(){
4
+ // function to check or uncheck all when 'checkall' box it toggled
5
+ jQuery('input[name="checkall"]').click(function(){
6
+ var checked_status = this.checked;
7
+ jQuery('input[class="' + this.value + '"]').each(function(){
8
+ this.checked = checked_status;
9
+ });
10
+ });
11
+ // function to check or uncheck 'checkall' box when individual boxes are toggled
12
+ jQuery('input[class="cat_checkall"]').click(function(){
13
+ var checked_status = true;
14
+ jQuery('input[class="' + this.className + '"]').each(function(){
15
+ if ((this.checked == true) && (checked_status == true)){
16
+ checked_status = true;
17
+ } else {
18
+ checked_status = false;
19
+ }
20
+ // jQuery 1.6.1 introduced in WordPress 3.2
21
+ // following can be simplified when WordPress 3.2 is minimum requirement
22
+ if (jQuery().jquery >= '1.6'){
23
+ jQuery('input[value="' + this.className + '"]').prop('checked', checked_status);
24
+ } else {
25
+ jQuery('input[value="' + this.className + '"]').attr('checked', checked_status);
26
+ }
27
+ });
28
+ });
29
+ // function to check or uncheck 'checkall' box when page is loaded
30
+ var checked_status = true;
31
+ jQuery('input[class="cat_checkall"]').each(function(){
32
+ if ((this.checked == true) && (checked_status == true)){
33
+ checked_status = true;
34
+ } else {
35
+ checked_status = false;
36
+ }
37
+ // jQuery 1.6.1 introduced in WordPress 3.2
38
+ // following can be simplified when WordPress 3.2 is minimum requirement
39
+ if (jQuery().jquery >= '1.6'){
40
+ jQuery('input[value="' + this.className + '"]').prop('checked', checked_status);
41
+ } else {
42
+ jQuery('input[value="' + this.className + '"]').attr('checked', checked_status);
43
+ }
44
+ });
45
+ });
include/s2_checkbox.js CHANGED
@@ -1,20 +1 @@
1
- jQuery(document).ready(function(){
2
- jQuery('input[name=checkall]').click(function(){
3
- var checked_status = this.checked;
4
- jQuery('input[class=' + this.value + ']').each(function(){
5
- this.checked = checked_status;
6
- });
7
- });
8
- jQuery('input[class*=_checkall]').click(function(){
9
- var checked_status = true;
10
- var s2_class = this.className;
11
- jQuery('input[class=' + s2_class + ']').each(function(){
12
- if ((this.checked == true) && (checked_status == true)){
13
- checked_status = true;
14
- } else {
15
- checked_status = false;
16
- }
17
- jQuery('input[@value=' + s2_class + ']').attr('checked', checked_status);
18
- });
19
- });
20
- });
1
+ jQuery(document).ready(function(){jQuery('input[name="checkall"]').click(function(){var checked_status=this.checked;jQuery('input[class="'+this.value+'"]').each(function(){this.checked=checked_status})});jQuery('input[class="cat_checkall"]').click(function(){var checked_status=true;jQuery('input[class="'+this.className+'"]').each(function(){if((this.checked==true)&&(checked_status==true)){checked_status=true}else{checked_status=false}if(jQuery().jquery>='1.6'){jQuery('input[value="'+this.className+'"]').prop('checked',checked_status)}else{jQuery('input[value="'+this.className+'"]').attr('checked',checked_status)}})});var checked_status=true;jQuery('input[class="cat_checkall"]').each(function(){if((this.checked==true)&&(checked_status==true)){checked_status=true}else{checked_status=false}if(jQuery().jquery>='1.6'){jQuery('input[value="'+this.className+'"]').prop('checked',checked_status)}else{jQuery('input[value="'+this.className+'"]').attr('checked',checked_status)}})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
include/s2_colorpicker.dev.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // version 1.0 - original inline version
2
+ // version 1.1 - Split into separate js file and amended
3
+ // version 1.2 - Improvements to the code for the colorpicker
4
+ // version 1.3 - Got colorpicker working without a page reload using .live event
5
+ jQuery(document).ready(function () {
6
+ var id;
7
+ jQuery('.colorpickerField')
8
+ // show the colorpicker when the class is focused
9
+ .live('focusin', function () {
10
+ id = this;
11
+ jQuery(this).ColorPicker({
12
+ // define some ColorPicker events
13
+ onBeforeShow: function () {
14
+ jQuery(this).ColorPickerSetColor(this.value);
15
+ },
16
+ onShow: function (el) {
17
+ jQuery(el).fadeIn(500);
18
+ return false;
19
+ },
20
+ onHide: function (el) {
21
+ jQuery(el).fadeOut(500);
22
+ return false;
23
+ },
24
+ onChange: function (hsb, hex, rgb) {
25
+ a = hex.toUpperCase();
26
+ id.value = a;
27
+ },
28
+ onSubmit: function (hsb, hex, rgb, el) {
29
+ a = hex.toUpperCase();
30
+ id.value = a;
31
+ jQuery('.colorpicker').fadeOut(500);
32
+ return false;
33
+ }
34
+ });
35
+ // bind the colorpicker to keyboard input
36
+ jQuery(this).keyup(function () {
37
+ if (this.value.length === 6) {
38
+ id.value = this.value.toUpperCase();
39
+ jQuery(this).ColorPickerSetColor(id.value);
40
+ }
41
+ });
42
+ });
43
+ });
include/s2_colorpicker.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){var id;jQuery(".colorpickerField").live("focusin",function(){id=this;jQuery(this).ColorPicker({onBeforeShow:function(){jQuery(this).ColorPickerSetColor(this.value);},onShow:function(el){jQuery(el).fadeIn(500);return false;},onHide:function(el){jQuery(el).fadeOut(500);return false;},onChange:function(hsb,hex,rgb){a=hex.toUpperCase();id.value=a;},onSubmit:function(hsb,hex,rgb,el){a=hex.toUpperCase();id.value=a;jQuery(".colorpicker").fadeOut(500);return false;}});jQuery(this).keyup(function(){if(this.value.length==6){id.value=this.value.toUpperCase();jQuery(this).ColorPickerSetColor(id.value);}});});});
include/s2_edit.dev.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ // hide our span before page loads
3
+ jQuery('#s2bcc_2').hide();
4
+ jQuery('#s2page_2').hide();
5
+ jQuery('#s2entries_2').hide();
6
+ });
7
+
8
+ //show span on clicking the edit link
9
+ function s2_show(id) {
10
+ jQuery('#s2'+id+'_2').show();
11
+ jQuery('#s2'+id+'_1').hide();
12
+ return false;
13
+ };
14
+
15
+ // hide span on clicking the hide link
16
+ function s2_hide(id) {
17
+ jQuery('#s2'+id+'_1').show();
18
+ jQuery('#s2'+id+'_2').hide();
19
+ return false;
20
+ };
21
+
22
+ function s2_update(id) {
23
+ var input = jQuery('input[name="'+id+'"]').val();
24
+ jQuery('input[name="'+id+'"]').val(input);
25
+ jQuery('#s2'+id).html(input);
26
+ s2_hide(id);
27
+ };
28
+
29
+ function s2_revert(id) {
30
+ var option = jQuery('#js'+id).val();
31
+ jQuery('input[name="'+id+'"]').val(option);
32
+ jQuery('#s2'+id).html(option);
33
+ s2_hide(id);
34
+ };
include/s2_edit.js CHANGED
@@ -1,34 +1 @@
1
- jQuery(document).ready(function() {
2
- // hide our span before page loads
3
- jQuery('#s2bcc_2').hide();
4
- jQuery('#s2page_2').hide();
5
- jQuery('#s2entries_2').hide();
6
- });
7
-
8
- //show span on clicking the edit link
9
- function s2_show(id) {
10
- jQuery('#s2'+id+'_2').show();
11
- jQuery('#s2'+id+'_1').hide();
12
- return false;
13
- };
14
-
15
- // hide span on clicking the hide link
16
- function s2_hide(id) {
17
- jQuery('#s2'+id+'_1').show();
18
- jQuery('#s2'+id+'_2').hide();
19
- return false;
20
- };
21
-
22
- function s2_update(id) {
23
- var input = jQuery('input[name="'+id+'"]').val();
24
- jQuery('input[name="'+id+'"]').val(input);
25
- jQuery('#s2'+id).html(input);
26
- s2_hide(id);
27
- };
28
-
29
- function s2_revert(id) {
30
- var option = jQuery('#js'+id).val();
31
- jQuery('input[name="'+id+'"]').val(option);
32
- jQuery('#s2'+id).html(option);
33
- s2_hide(id);
34
- };
1
+ jQuery(document).ready(function(){jQuery('#s2bcc_2').hide();jQuery('#s2page_2').hide();jQuery('#s2entries_2').hide()});function s2_show(id){jQuery('#s2'+id+'_2').show();jQuery('#s2'+id+'_1').hide();return false};function s2_hide(id){jQuery('#s2'+id+'_1').show();jQuery('#s2'+id+'_2').hide();return false};function s2_update(id){var input=jQuery('input[name="'+id+'"]').val();jQuery('input[name="'+id+'"]').val(input);jQuery('#s2'+id).html(input);s2_hide(id)};function s2_revert(id){var option=jQuery('#js'+id).val();jQuery('input[name="'+id+'"]').val(option);jQuery('#s2'+id).html(option);s2_hide(id)};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 6.3
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904
@@ -30,17 +30,20 @@ You should have received a copy of the GNU General Public License
30
  along with Subscribe2. If not, see <http://www.gnu.org/licenses/>.
31
  */
32
 
33
-
34
  global $wp_version;
35
  if ( version_compare($wp_version, '2.8', '<') ) {
36
  // Subscribe2 needs WordPress 2.8 or above, exit if not on a compatible version
37
  $exit_msg = sprintf(__('This version of Subscribe2 requires WordPress 2.8 or greater. Please update %1$s or use an older version of %2$s.', 'subscribe2'), '<a href="http://codex.wordpress.org/Updating_WordPress">Wordpress</a>', '<a href="http://wordpress.org/extend/plugins/subscribe2/download/">Subscribe2</a>');
38
  exit($exit_msg);
39
  }
 
 
 
 
40
 
41
  // our version number. Don't touch this or any line below
42
  // unless you know exactly what you are doing
43
- define( 'S2VERSION', '6.3' );
44
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
45
  define( 'S2DIR', trailingslashit(plugin_basename(dirname(__FILE__))) );
46
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
@@ -153,10 +156,10 @@ class s2class {
153
  } // end ozh_s2_icon()
154
 
155
  /**
156
- Insert Javascript into admin_header
157
  */
158
  function checkbox_form_js() {
159
- wp_enqueue_script('s2_checkbox', S2URL . 'include/s2_checkbox.js', array('jquery'), '1.0');
160
  } //end checkbox_form_js()
161
 
162
  function user_admin_css() {
@@ -164,7 +167,7 @@ class s2class {
164
  }
165
 
166
  function option_form_js() {
167
- wp_enqueue_script('s2_edit', S2URL . 'include/s2_edit.js', array('jquery'), '1.0');
168
  } // end option_form_js()
169
 
170
  /* ===== Install, upgrade, reset ===== */
@@ -195,7 +198,7 @@ class s2class {
195
  } // end install()
196
 
197
  /**
198
- Upgrade the database
199
  */
200
  function upgrade() {
201
  global $wpdb, $wp_version, $wpmu_version;
@@ -204,15 +207,31 @@ class s2class {
204
  require_once(ABSPATH . 'wp-admin/install-helper.php');
205
  }
206
  $date = date('Y-m-d');
207
- maybe_add_column($this->public, 'date', "ALTER TABLE $this->public ADD date DATE DEFAULT '$date' NOT NULL AFTER active;");
208
- maybe_add_column($this->public, 'ip', "ALTER TABLE $this->public ADD ip char(64) DEFAULT 'admin' NOT NULL AFTER date;");
209
 
210
  // let's take the time to check process registered users
211
  // existing public subscribers are subscribed to all categories
212
  $users = $this->get_all_registered('ID');
213
  if ( !empty($users) ) {
214
- foreach ( $users as $user ) {
215
- $this->register($user);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
217
  }
218
  // update the options table to serialized format
@@ -236,41 +255,62 @@ class s2class {
236
  if ( $this->subscribe2_options['autoformat'] == 'full' ) {
237
  $this->subscribe2_options['autoformat'] = 'post';
238
  }
 
 
 
 
 
 
 
 
 
 
 
239
  update_option('subscribe2_options', $this->subscribe2_options);
240
 
241
  // upgrade old wpmu user meta data to new
242
  if ( $this->s2_mu === true ) {
243
  $this->namechange_subscribe2_widget();
244
  // loop through all users
245
- foreach ( $users as $user ) {
246
  // get categories which the user is subscribed to (old ones)
247
- $categories = $this->get_user_meta($user, 's2_subscribed');
248
  $categories = explode(',', $categories);
 
 
249
 
250
  // load blogs of user (only if we need them)
251
  $blogs = array();
252
  if ( count($categories) > 0 && !in_array('-1', $categories) ) {
253
- $blogs = get_blogs_of_user($user, true);
254
  }
255
 
256
- foreach ( $blogs as $blog_id => $blog ) {
257
- switch_to_blog($blog_id);
258
 
259
  $blog_categories = (array)$wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category'");
260
  $subscribed_categories = array_intersect($categories, $blog_categories);
261
  if ( !empty($subscribed_categories) ) {
262
  foreach ( $subscribed_categories as $subscribed_category ) {
263
- $this->update_user_meta($user, $this->get_usermeta_keyname('s2_cat') . $subscribed_category, $subscribed_category);
264
  }
265
- $this->update_user_meta($user, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $subscribed_categories));
 
 
 
 
 
 
266
  }
267
  restore_current_blog();
268
  }
269
 
270
  // delete old user meta keys
271
- $this->delete_user_meta($user, 's2_subscribed');
 
 
272
  foreach ( $categories as $cat ) {
273
- $this->delete_user_meta($user, 's2_cat' . $cat);
274
  }
275
  }
276
  }
@@ -286,6 +326,7 @@ class s2class {
286
  $wpdb->get_results("UPDATE $this->public SET email='$new_email' WHERE CAST(email as binary)='$email'");
287
  }
288
  }
 
289
  } // end upgrade()
290
 
291
  /**
@@ -301,34 +342,34 @@ class s2class {
301
 
302
  /* ===== mail handling ===== */
303
  /**
304
- Performs string substitutions for subscribe2 mail texts
305
  */
306
  function substitute($string = '') {
307
  if ( '' == $string ) {
308
  return;
309
  }
310
- $string = str_replace("BLOGNAME", html_entity_decode(get_option('blogname'), ENT_QUOTES), $string);
311
- $string = str_replace("BLOGLINK", get_option('home'), $string);
312
- $string = str_replace("TITLE", stripslashes($this->post_title), $string);
313
  $link = "<a href=\"" . $this->permalink . "\">" . $this->permalink . "</a>";
314
- $string = str_replace("PERMALINK", $link, $string);
315
- if ( strstr($string, "TINYLINK") ) {
316
  $tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->permalink));
317
  if ( $tinylink !== 'Error' || $tinylink != false ) {
318
  $tlink = "<a href=\"" . $tinylink . "\">" . $tinylink . "</a>";
319
- $string = str_replace("TINYLINK", $tlink, $string);
320
  } else {
321
- $string = str_replace("TINYLINK", $link, $string);
322
  }
323
  }
324
- $string = str_replace("DATE", $this->post_date, $string);
325
- $string = str_replace("TIME", $this->post_time, $string);
326
- $string = str_replace("MYNAME", stripslashes($this->myname), $string);
327
- $string = str_replace("EMAIL", $this->myemail, $string);
328
- $string = str_replace("AUTHORNAME", stripslashes($this->authorname), $string);
329
- $string = str_replace("CATS", $this->post_cat_names, $string);
330
- $string = str_replace("TAGS", $this->post_tag_names, $string);
331
- $string = str_replace("COUNT", $this->post_count, $string);
332
 
333
  return $string;
334
  } // end substitute()
@@ -590,8 +631,8 @@ class s2class {
590
  if ( function_exists('strip_shortcodes') ) {
591
  $plaintext = strip_shortcodes($plaintext);
592
  }
593
- $gallid = '[gallery id="' . $post->ID . '"]';
594
- $content = str_replace('[gallery]', $gallid, $post->post_content);
595
  $content = apply_filters('the_content', $content);
596
  $content = str_replace("]]>", "]]&gt", $content);
597
  $excerpt = $post->post_excerpt;
@@ -618,9 +659,8 @@ class s2class {
618
  // no excerpt, is there a <!--more--> ?
619
  if ( false !== strpos($content, '<!--more-->') ) {
620
  list($html_excerpt, $more) = explode('<!--more-->', $content, 2);
621
- // strip leading and trailing whitespace
622
- $html_excerpt = balanceTags($html_excerpt);
623
- $html_excerpt = trim($html_excerpt);
624
  } else {
625
  // no <!--more-->, so grab the first 55 words
626
  $words = explode(' ', $content, $this->excerpt_length + 1);
@@ -628,18 +668,19 @@ class s2class {
628
  array_pop($words);
629
  array_push($words, '[...]');
630
  $html_excerpt = implode(' ', $words);
631
- $html_excerpt = trim(balanceTags($html_excerpt));
 
632
  }
633
  }
634
  }
635
 
636
  // prepare mail body texts
637
- $excerpt_body = str_replace("POST", $excerpt, $mailtext);
638
- $full_body = str_replace("POST", strip_tags($plaintext), $mailtext);
639
  $html_body = str_replace("\r\n", "<br />\r\n", $mailtext);
640
- $html_body = str_replace("POST", $content, $html_body);
641
  $html_excerpt_body = str_replace("\r\n", "<br />\r\n", $mailtext);
642
- $html_excerpt_body = str_replace("POST", $html_excerpt, $html_excerpt_body);
643
 
644
  if ( $preview != '' ) {
645
  $this->myemail = $preview;
@@ -686,13 +727,11 @@ class s2class {
686
  } // end publish_phone()
687
 
688
  /**
689
- Send confirmation email to the user
690
  */
691
  function send_confirm($what = '', $is_remind = false) {
692
  if ( $this->filtered == 1 ) { return true; }
693
- if ( !$this->email || !$what ) {
694
- return false;
695
- }
696
  $id = $this->get_id($this->email);
697
  if ( !$id ) {
698
  return false;
@@ -722,16 +761,16 @@ class s2class {
722
  } else {
723
  $body = $this->substitute(stripslashes($this->subscribe2_options['confirm_email']));
724
  if ( 'add' == $what ) {
725
- $body = str_replace("ACTION", $this->subscribe, $body);
726
- $subject = str_replace("ACTION", $this->subscribe, $this->subscribe2_options['confirm_subject']);
727
  } elseif ( 'del' == $what ) {
728
- $body = str_replace("ACTION", $this->unsubscribe, $body);
729
- $subject = str_replace("ACTION", $this->unsubscribe, $this->subscribe2_options['confirm_subject']);
730
  }
731
  $subject = html_entity_decode($this->substitute(stripslashes($subject)), ENT_QUOTES);
732
  }
733
 
734
- $body = str_replace("LINK", $link, $body);
735
 
736
  if ( $is_remind == true && function_exists('wpmq_mail') ) {
737
  // could be sending lots of reminders so queue them if wpmq is enabled
@@ -1098,7 +1137,7 @@ class s2class {
1098
  // text or HTML subscribers
1099
  if ( 'all' != $r['format'] ) {
1100
  $JOIN .= "INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id ";
1101
- $AND .= " AND b.meta_key='s2_format' AND b.meta_value=";
1102
  if ( 'html' == $r['format'] ) {
1103
  $AND .= "'html'";
1104
  } elseif ( 'html_excerpt' == $r['format'] ) {
@@ -1128,8 +1167,14 @@ class s2class {
1128
  $result = $wpdb->get_col($sql);
1129
  if ( $result ) {
1130
  $ids = implode(',', $result);
1131
- return $wpdb->get_col("SELECT user_email FROM $wpdb->users WHERE ID IN ($ids)");
1132
  }
 
 
 
 
 
 
1133
  } // end get_registered()
1134
 
1135
  /**
@@ -1183,24 +1228,20 @@ class s2class {
1183
  Create the appropriate usermeta values when a user registers
1184
  If the registering user had previously subscribed to notifications, this function will delete them from the public subscriber list first
1185
  */
1186
- function register($user_ID = 0) {
1187
  global $wpdb;
1188
 
1189
  if ( 0 == $user_ID ) { return $user_ID; }
1190
  $user = get_userdata($user_ID);
1191
- $all_cats = get_categories(array('hide_empty' => false));
1192
 
1193
- // Are registered users are allowed to subscribe to excluded categories?
1194
  if ( 0 == $this->subscribe2_options['reg_override'] || 'no' == $this->subscribe2_options['newreg_override'] ) {
1195
- $exclude = explode(',', $this->subscribe2_options['exclude']);
1196
- foreach ( $all_cats as $cat => $term_id ) {
1197
- if ( in_array($all_cats[$cat]->term_id, $exclude) ) {
1198
- $cat = (int)$cat;
1199
- unset($all_cats[$cat]);
1200
- }
1201
- }
1202
  }
1203
 
 
1204
  foreach ( $all_cats as $cat ) {
1205
  ('' == $cats) ? $cats = "$cat->term_id" : $cats .= ",$cat->term_id";
1206
  }
@@ -1218,43 +1259,22 @@ class s2class {
1218
  foreach ( explode(',', $cats) as $cat ) {
1219
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
1220
  }
1221
- $this->update_user_meta($user_ID, 's2_format', 'excerpt');
1222
- $this->update_user_meta($user_ID, 's2_autosub', $this->subscribe2_options['autosub_def']);
1223
  } else {
1224
  // create post format entries for all users
1225
- $check_format = $this->get_user_meta($user_ID, 's2_format');
1226
- if ( empty($check_format) ) {
1227
- // ensure existing subscription options are not overwritten on upgrade
1228
- if ( in_array($this->subscribe2_options['autoformat'], array('html', 'html_excerpt', 'post', 'excerpt')) ) {
1229
- $this->update_user_meta($user_ID, 's2_format', $this->subscribe2_options['autoformat']);
1230
- } else {
1231
- $this->update_user_meta($user_ID, 's2_format', 'excerpt');
1232
- }
1233
- $this->update_user_meta($user_ID, 's2_autosub', $this->subscribe2_options['autosub_def']);
1234
- // if the are no existing subscriptions, create them if, by default if autosub is on
1235
- if ( 'yes' == $this->subscribe2_options['autosub'] || ( 'wpreg' == $this->subscribe2_options['autosub'] && 'on' == $_POST['subscribe'] ) ) {
1236
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats);
1237
- foreach ( explode(',', $cats) as $cat ) {
1238
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
1239
- }
1240
- }
1241
  } else {
1242
- // if user is already registered update format remove 's2_excerpt' field and update 's2_format'
1243
- if ( 'html' == $check_format ) {
1244
- $this->delete_user_meta($user_ID, 's2_excerpt');
1245
- } elseif ( 'text' == $check_format ) {
1246
- $this->update_user_meta($user_ID, 's2_format', $this->get_user_meta($user_ID, 's2_excerpt'), true);
1247
- $this->delete_user_meta($user_ID, 's2_excerpt');
1248
- }
1249
  }
1250
- $subscribed = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1251
- if ( strstr($subscribed, '-1') ) {
1252
- // make sure we remove '-1' from any settings
1253
- $old_cats = explode(',', $subscribed);
1254
- $pos = array_search('-1', $old_cats);
1255
- unset($old_cats[$pos]);
1256
- $cats = implode(',', $old_cats);
1257
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats);
 
 
 
1258
  }
1259
  }
1260
  return $user_ID;
@@ -1319,7 +1339,7 @@ class s2class {
1319
  foreach ( $cats as $id ) {
1320
  $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1321
  }
1322
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '');
1323
  }
1324
  unset($remain);
1325
  }
@@ -1339,66 +1359,96 @@ class s2class {
1339
  }
1340
  $ids = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_email IN ($emails)");
1341
  $ids = implode(',', $ids);
1342
- $sql = "UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='s2_format' AND user_id IN ($ids)";
1343
- $wpdb->get_results("UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='s2_format' AND user_id IN ($ids)");
1344
- } // end bulk_manage()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1345
 
1346
  /**
1347
  Handles subscriptions and unsubscriptions for different blogs on WPMU installs
1348
  */
1349
  function wpmu_subscribe() {
1350
- $redirect_to_subscriptionpage = false;
1351
-
1352
  // subscribe to new blog
1353
  if ( !empty($_GET['s2mu_subscribe']) ) {
1354
- $blog_id = intval($_GET['s2mu_subscribe']);
1355
- if ( $blog_id >= 0 ) {
1356
- switch_to_blog($blog_id);
1357
 
1358
  $user_ID = get_current_user_id();
1359
 
1360
  // if user is not a user of the current blog
1361
- if ( !is_blog_user($blog_id) ) {
1362
  // add user to current blog as subscriber
1363
- add_user_to_blog($blog_id, $user_ID, 'subscriber');
1364
  // add an action hook for external manipulation of blog and user data
1365
- do_action_ref_array('subscribe2_wpmu_subscribe', array($user_ID, $blog_id));
1366
  }
1367
 
1368
- // subscribe to all categories by default
1369
- $all_cats = get_categories(array('hide_empty' => false));
1370
-
1371
  if ( 0 == $this->subscribe2_options['reg_override'] ) {
1372
- // registered users are not allowed to subscribe to excluded categories
1373
- $exclude = explode(',', $this->subscribe2_options['exclude']);
1374
- foreach ( $all_cats as $cat => $term ) {
1375
- if ( in_array($all_cats[$cat]->term_id, $exclude) ) {
1376
- $cat = (int)$cat;
1377
- unset($all_cats[$cat]);
1378
- }
1379
- }
1380
  }
1381
 
1382
- $cats = array();
1383
- foreach ( $all_cats as $cat => $term ) {
1384
- $term_id = $term->term_id;
1385
- $cats[] = $term_id;
1386
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $term_id, $term_id);
1387
  }
1388
- if ( empty($cats) ) {
1389
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '');
1390
  } else {
1391
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $cats));
1392
  }
1393
-
1394
- // don't restore_current_blog(); -> redirect to new subscription page
1395
- $redirect_to_subscriptionpage = true;
1396
  }
1397
  } elseif ( !empty($_GET['s2mu_unsubscribe']) ) {
1398
  // unsubscribe from a blog
1399
- $blog_id = intval($_GET['s2mu_unsubscribe']);
1400
- if ( $blog_id >= 0 ) {
1401
- switch_to_blog($blog_id);
1402
 
1403
  $user_ID = get_current_user_id();
1404
 
@@ -1412,39 +1462,36 @@ class s2class {
1412
  foreach ( $cats as $id ) {
1413
  $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1414
  }
1415
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '');
1416
 
1417
  // add an action hook for external manipulation of blog and user data
1418
- do_action_ref_array('subscribe2_wpmu_unsubscribe', array($user_ID, $blog_id));
1419
 
1420
  restore_current_blog();
1421
- $redirect_to_subscriptionpage = true;
1422
  }
1423
  }
1424
 
1425
- if ( $redirect_to_subscriptionpage == true ) {
1426
- if ( !is_user_member_of_blog($user_ID) ) {
1427
- $user_blogs = get_active_blog_for_user($user_ID);
1428
- if ( is_array($user_blogs) ) {
1429
- switch_to_blog(key($user_blogs));
1430
- } else {
1431
- // no longer a member of a blog
1432
- wp_redirect(get_option('siteurl')); // redirect to front page
1433
- exit();
1434
- }
1435
- }
1436
-
1437
- // redirect to profile page
1438
- if ( current_user_can('manage_options') ) {
1439
- $url = get_option('siteurl') . '/wp-admin/users.php?page=s2_users';
1440
- wp_redirect($url);
1441
- exit();
1442
  } else {
1443
- $url = get_option('siteurl') . '/wp-admin/profile.php?page=s2_users';
1444
- wp_redirect($url);
1445
- exit();
1446
  }
1447
  }
 
 
 
 
 
 
 
 
 
 
 
1448
  } // end wpmu_subscribe()
1449
 
1450
  /**
@@ -1487,6 +1534,61 @@ class s2class {
1487
  return $user_meta;
1488
  } // end delete_user_meta()
1489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1490
  /**
1491
  Autosubscribe registered users to newly created categories
1492
  if registered user has selected this option
@@ -1498,32 +1600,42 @@ class s2class {
1498
  global $wpdb;
1499
 
1500
  if ( 'yes' == $this->subscribe2_options['show_autosub'] ) {
1501
- $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key='s2_autosub' AND $wpdb->usermeta.meta_value='yes'";
 
 
 
 
1502
  $user_IDs = $wpdb->get_col($sql);
1503
  if ( '' == $user_IDs ) { return; }
1504
 
1505
  foreach ( $user_IDs as $user_ID ) {
1506
- $old_cats = explode(',', $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed')));
1507
- if ( !is_array($old_cats) ) {
1508
- $old_cats = array($old_cats);
 
 
 
1509
  }
1510
  // add subscription to these cat IDs
1511
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $new_category, "$new_category");
1512
- $newcats = array_merge($old_cats, (array)$new_category);
1513
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $newcats));
1514
  }
1515
  } elseif ( 'exclude' == $this->subscribe2_options['show_autosub'] ) {
1516
  $excluded_cats = explode(',', $this->subscribe2_options['exclude']);
1517
  $excluded_cats[] = $new_category;
1518
  $this->subscribe2_options['exclude'] = implode(',', $excluded_cats);
1519
- $this->update_option('subscribe2_options', $this->subscribe2_options);
1520
  }
1521
  } // end new_category()
1522
 
1523
  function delete_category($deleted_category='') {
1524
  global $wpdb;
1525
 
1526
- $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$deleted_category'";
 
 
 
 
1527
  $user_IDs = $wpdb->get_col($sql);
1528
  if ( '' == $user_IDs ) { return; }
1529
 
@@ -1533,7 +1645,7 @@ class s2class {
1533
  $old_cats = array($old_cats);
1534
  }
1535
  // add subscription to these cat IDs
1536
- $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $deleted_category, '');
1537
  $remain = array_diff($old_cats, (array)$deleted_category);
1538
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
1539
  }
@@ -1670,6 +1782,9 @@ class s2class {
1670
  } elseif ( $_POST['sub_format'] ) {
1671
  $this->format_change( $_POST['format'], $_POST['emails'] );
1672
  echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Format updated for Selected Registered Users!', 'subscribe2') . "</strong></p></div>";
 
 
 
1673
  }
1674
  }
1675
 
@@ -1810,7 +1925,8 @@ class s2class {
1810
  // show the selected subscribers
1811
  $alternate = '';
1812
  echo "<table cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">";
1813
- echo "<tr class=\"alternate\"><td width=\"50%\"><input type=\"text\" name=\"searchterm\" value=\"\" />&nbsp;\r\n";
 
1814
  echo "<input type=\"submit\" class=\"button-secondary\" name=\"search\" value=\"" . __('Search Subscribers', 'subscribe2') . "\" /></td>\r\n";
1815
  if ( $reminderform ) {
1816
  echo "<td width=\"25%\" align=\"right\"><input type=\"hidden\" name=\"reminderemails\" value=\"" . $reminderemails . "\" />\r\n";
@@ -1893,22 +2009,34 @@ class s2class {
1893
  // show bulk managment form if filtered in some Registered Users
1894
  if ( in_array($what, array('registered', 'all_users')) || is_numeric($what) ) {
1895
  $subscribers_string = implode(',', $subscribers);
1896
- echo "<h2>" . __('Categories', 'subscribe2') . "</h2>\r\n";
1897
- echo __('Preferences for Registered Users selected in the filter above can be changed using this section.', 'subscribe2') . "<br />\r\n";
1898
- echo "<strong><em style=\"color: red\">" . __('Consider User Privacy as changes cannot be undone', 'subscribe2') . "</em></strong><br />\r\n";
1899
- echo "<br />" . __('Action to perform', 'subscribe2') . ":\r\n";
1900
- echo "<label><input type=\"radio\" name=\"manage\" value=\"subscribe\" checked=\"checked\" /> " . __('Subscribe', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
1901
- echo "<label><input type=\"radio\" name=\"manage\" value=\"unsubscribe\" /> " . __('Unsubscribe', 'subscribe2') . "</label><br /><br />\r\n";
1902
- echo "<input type=\"hidden\" name=\"emails\" value=\"$subscribers_string\" />\r\n";
1903
- $this->display_category_form();
1904
- echo "<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"sub_categories\" value=\"" . __('Bulk Update Categories', 'subscribe2') . "\" /></p>";
1905
-
1906
- echo "<br />" . __('Send email as', 'subscribe2') . ":\r\n";
1907
- echo "<label><input type=\"radio\" name=\"format\" value=\"html\" /> " . __('HTML - Full', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
1908
- echo "<label><input type=\"radio\" name=\"format\" value=\"html_excerpt\" /> " . __('HTML - Excerpt', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
1909
- echo "<label><input type=\"radio\" name=\"format\" value=\"post\" /> " . __('Plain Text - Full', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
1910
- echo "<label><input type=\"radio\" name=\"format\" value=\"excerpt\" checked=\"checked\" /> " . __('Plain Text - Excerpt', 'subscribe2') . "</label>\r\n";
1911
- echo "<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"sub_format\" value=\"" . __('Bulk Update Format', 'subscribe2') . "\" /></p>";
 
 
 
 
 
 
 
 
 
 
 
 
1912
  }
1913
  echo "</form></div>\r\n";
1914
 
@@ -1921,7 +2049,7 @@ class s2class {
1921
  Our options page
1922
  */
1923
  function options_menu() {
1924
- global $s2nonce, $wpdb;
1925
 
1926
  // send error message if no WordPress page exists
1927
  $sql = "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status='publish' LIMIT 1";
@@ -1982,6 +2110,11 @@ class s2class {
1982
  $email_freq = $_POST['email_freq'];
1983
  $scheduled_time = wp_next_scheduled('s2_digest_cron');
1984
  if ( $email_freq != $this->subscribe2_options['email_freq'] || $_POST['hour'] != date('H', $scheduled_time) ) {
 
 
 
 
 
1985
  $this->subscribe2_options['email_freq'] = $email_freq;
1986
  wp_clear_scheduled_hook('s2_digest_cron');
1987
  $scheds = (array)wp_get_schedules();
@@ -2042,6 +2175,7 @@ class s2class {
2042
 
2043
  // excluded categories
2044
  if ( !empty($_POST['category']) ) {
 
2045
  $exclude_cats = implode(',', $_POST['category']);
2046
  } else {
2047
  $exclude_cats = '';
@@ -2088,6 +2222,7 @@ class s2class {
2088
  $this->subscribe2_options['autoformat'] = $_POST['autoformat'];
2089
  $this->subscribe2_options['show_autosub'] = $_POST['show_autosub'];
2090
  $this->subscribe2_options['autosub_def'] = $_POST['autosub_def'];
 
2091
 
2092
  //barred domains
2093
  $this->subscribe2_options['barred'] = $_POST['barred'];
@@ -2220,28 +2355,28 @@ class s2class {
2220
  echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><br /><br />\r\n";
2221
  echo "</td><td valign=\"top\" rowspan=\"3\">";
2222
  echo "<p class=\"submit\"><input type=\"submit\" class=\"button-secondary\" name=\"preview\" value=\"" . __('Send Email Preview', 'subscribe2') . "\" /></p>\r\n";
2223
- echo "<h3>" . __('Message substitions', 'subscribe2') . "</h3>\r\n";
2224
  echo "<dl>";
2225
  echo "<dt><b><em style=\"color: red\">" . __('IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED' ,'subscribe2') . "</em></b></dt><dd></dd>\r\n";
2226
- echo "<dt><b>BLOGNAME</b></dt><dd>" . get_option('blogname') . "</dd>\r\n";
2227
- echo "<dt><b>BLOGLINK</b></dt><dd>" . get_option('home') . "</dd>\r\n";
2228
- echo "<dt><b>TITLE</b></dt><dd>" . __("the post's title<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
2229
- 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";
2230
- echo "<dt><b>POSTTIME</b></dt><dd>" . __("the excerpt of the post and the time it was posted<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2231
- echo "<dt><b>TABLE</b></dt><dd>" . __("a list of post titles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2232
- echo "<dt><b>TABLELINKS</b></dt><dd>" . __("a list of post titles followed by links to the atricles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2233
- echo "<dt><b>PERMALINK</b></dt><dd>" . __("the post's permalink<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
2234
- echo "<dt><b>TINYLINK</b></dt><dd>" . __("the post's permalink after conversion by TinyURL<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
2235
- echo "<dt><b>DATE</b></dt><dd>" . __("the date the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
2236
- echo "<dt><b>TIME</b></dt><dd>" . __("the time the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
2237
- echo "<dt><b>MYNAME</b></dt><dd>" . __("the admin or post author's name", 'subscribe2') . "</dd>\r\n";
2238
- echo "<dt><b>EMAIL</b></dt><dd>" . __("the admin or post author's email", 'subscribe2') . "</dd>\r\n";
2239
- echo "<dt><b>AUTHORNAME</b></dt><dd>" . __("the post author's name", 'subscribe2') . "</dd>\r\n";
2240
- 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";
2241
- 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";
2242
- echo "<dt><b>CATS</b></dt><dd>" . __("the post's assigned categories", 'subscribe2') . "</dd>\r\n";
2243
- echo "<dt><b>TAGS</b></dt><dd>" . __("the post's assigned Tags", 'subscribe2') . "</dd>\r\n";
2244
- echo "<dt><b>COUNT</b></dt><dd>" . __("the number of posts included in the digest email<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2245
  echo "</dl></td></tr><tr><td>";
2246
  echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
2247
  echo __('Subject Line', 'subscribe2') . ": ";
@@ -2345,23 +2480,23 @@ class s2class {
2345
  if ( 'yes' == $this->subscribe2_options['newreg_override'] ) {
2346
  echo " checked=\"checked\"";
2347
  }
2348
- echo " />" . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2349
  echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"no\"";
2350
  if ( 'no' == $this->subscribe2_options['newreg_override'] ) {
2351
  echo " checked=\"checked\"";
2352
  }
2353
- echo " />" . __('No', 'subscribe2') . "</label><br /><br />\r\n";
2354
  echo __('Registration Form option is checked by default', 'subscribe2') . ":<br />\r\n";
2355
  echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"yes\"";
2356
  if ( 'yes' == $this->subscribe2_options['wpregdef'] ) {
2357
  echo " checked=\"checked\"";
2358
  }
2359
- echo " />" . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2360
  echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"no\"";
2361
  if ( 'no' == $this->subscribe2_options['wpregdef'] ) {
2362
  echo " checked=\"checked\"";
2363
  }
2364
- echo " />" . __('No', 'subscribe2') . "</label><br /><br />\r\n";
2365
  echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
2366
  echo "<label><input type=\"radio\" name=\"autoformat\" value=\"html\"";
2367
  if ( 'html' == $this->subscribe2_options['autoformat'] ) {
@@ -2388,28 +2523,50 @@ class s2class {
2388
  if ( 'yes' == $this->subscribe2_options['show_autosub'] ) {
2389
  echo " checked=\"checked\"";
2390
  }
2391
- echo " />" . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2392
  echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"no\"";
2393
  if ( 'no' == $this->subscribe2_options['show_autosub'] ) {
2394
  echo " checked=\"checked\"";
2395
  }
2396
- echo " />" . __('No', 'subscribe2') . "</label>&nbsp;&nbsp;";
2397
  echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"exclude\"";
2398
  if ( 'exclude' == $this->subscribe2_options['show_autosub'] ) {
2399
  echo " checked=\"checked\"";
2400
  }
2401
- echo " />" .__('New categories are immediately excluded', 'subscribe2') . "</label><br /><br />";
2402
  echo __('Option for Registered Users to auto-subscribe to new categories is checked by default', 'subscribe2') . ": <br />\r\n";
2403
  echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"yes\"";
2404
  if ( 'yes' == $this->subscribe2_options['autosub_def'] ) {
2405
  echo " checked=\"checked\"";
2406
  }
2407
- echo " />" . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2408
  echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"no\"";
2409
  if ( 'no' == $this->subscribe2_options['autosub_def'] ) {
2410
  echo " checked=\"checked\"";
2411
  }
2412
- echo " />" . __('No', 'subscribe2');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2413
  echo"</label></p>";
2414
 
2415
  //barred domains
@@ -2452,11 +2609,25 @@ class s2class {
2452
  if ( isset($_POST['s2_admin']) && 'user' == $_POST['s2_admin'] ) {
2453
  check_admin_referer('subscribe2-user_subscribers' . $s2nonce);
2454
 
2455
- echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Subscription preferences updated.', 'subscribe2') . "</strong></p></div>\n";
2456
- $this->update_user_meta($user_ID, 's2_format', $_POST['s2_format']);
2457
- $this->update_user_meta($user_ID, 's2_autosub', $_POST['new_category']);
 
 
 
 
 
 
 
 
 
 
 
 
 
2458
 
2459
  $cats = $_POST['category'];
 
2460
 
2461
  if ( empty($cats) || $cats == '-1' ) {
2462
  $oldcats = explode(',', $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed')));
@@ -2467,7 +2638,7 @@ class s2class {
2467
  }
2468
  $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2469
  } elseif ( $cats == 'digest' ) {
2470
- $all_cats = get_categories(array('hide_empty' => false));
2471
  foreach ( $all_cats as $cat ) {
2472
  ('' == $catids) ? $catids = "$cat->term_id" : $catids .= ",$cat->term_id";
2473
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat->term_id, $cat->term_id);
@@ -2494,6 +2665,7 @@ class s2class {
2494
  }
2495
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $cats));
2496
  }
 
2497
  }
2498
 
2499
  // show our form
@@ -2513,22 +2685,22 @@ class s2class {
2513
  if ( $this->subscribe2_options['email_freq'] == 'never' ) {
2514
  echo __('Receive email as', 'subscribe2') . ": &nbsp;&nbsp;";
2515
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"html\"";
2516
- if ( 'html' == $this->get_user_meta($user_ID, 's2_format') ) {
2517
  echo "checked=\"checked\" ";
2518
  }
2519
  echo "/> " . __('HTML - Full', 'subscribe2') ."</label>&nbsp;&nbsp;";
2520
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"html_excerpt\" ";
2521
- if ( 'html_excerpt' == $this->get_user_meta($user_ID, 's2_format') ) {
2522
  echo "checked=\"checked\" ";
2523
  }
2524
  echo "/> " . __('HTML - Excerpt', 'subscribe2') . "</label>&nbsp;&nbsp;";
2525
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"post\" ";
2526
- if ( 'post' == $this->get_user_meta($user_ID, 's2_format') ) {
2527
  echo "checked=\"checked\" ";
2528
  }
2529
  echo "/> " . __('Plain Text - Full', 'subscribe2') . "</label>&nbsp;&nbsp;";
2530
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"excerpt\" ";
2531
- if ( 'excerpt' == $this->get_user_meta($user_ID, 's2_format') ) {
2532
  echo "checked=\"checked\" ";
2533
  }
2534
  echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . "</label><br /><br />\r\n";
@@ -2536,12 +2708,12 @@ class s2class {
2536
  if ( $this->subscribe2_options['show_autosub'] == 'yes' ) {
2537
  echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
2538
  echo "<label><input type=\"radio\" name=\"new_category\" value=\"yes\" ";
2539
- if ( 'yes' == $this->get_user_meta($user_ID, 's2_autosub') ) {
2540
  echo "checked=\"checked\" ";
2541
  }
2542
  echo "/> " . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2543
  echo "<label><input type=\"radio\" name=\"new_category\" value=\"no\" ";
2544
- if ( 'no' == $this->get_user_meta($user_ID, 's2_autosub') ) {
2545
  echo "checked=\"checked\" ";
2546
  }
2547
  echo "/> " . __('No', 'subscribe2') . "</label>";
@@ -2554,11 +2726,11 @@ class s2class {
2554
  $subscribed = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2555
  // if we are subscribed to the current blog display an "unsubscribe" link
2556
  if ( !empty($subscribed) ) {
2557
- $unsubscribe_link = get_option('home') . "/wp-admin/?s2mu_unsubscribe=". $blog_id;
2558
  echo "<p><a href=\"". $unsubscribe_link ."\" class=\"button\">" . __('Unsubscribe me from this blog', 'subscribe2') . "</a></p>";
2559
  } else {
2560
  // else we show a "subscribe" link
2561
- $subscribe_link = get_option('home') . "/wp-admin/?s2mu_subscribe=". $blog_id;
2562
  echo "<p><a href=\"". $subscribe_link ."\" class=\"button\">" . __('Subscribe to all categories', 'subscribe2') . "</a></p>";
2563
  }
2564
  echo "<h2>" . __('Subscribed Categories on', 'subscribe2') . " " . get_option('blogname') . " </h2>\r\n";
@@ -2645,7 +2817,7 @@ class s2class {
2645
  if ( is_user_member_of_blog($current_user->id, $blog['blog_id']) ) {
2646
  echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
2647
  }
2648
- echo "<a href=\"" . $blog['blogurl'] . "/wp-admin/?s2mu_unsubscribe=" . $blog['blog_id'] . "\">" . __('Unsubscribe', 'subscribe2') . "</a></span>\r\n";
2649
  }
2650
  echo "<div class=\"additional_info\">" . $blog['description'] . "</div>\r\n";
2651
  echo "</li>";
@@ -2666,7 +2838,7 @@ class s2class {
2666
  if ( is_user_member_of_blog($current_user->id, $blog['blog_id']) ) {
2667
  echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
2668
  }
2669
- echo "<a href=\"" . $blog['blogurl'] . "/wp-admin/?s2mu_subscribe=" . $blog['blog_id'] . "\">" . __('Subscribe', 'subscribe2') . "</a></span>\r\n";
2670
  }
2671
  echo "<div class=\"additional_info\">" . $blog['description'] . "</div>\r\n";
2672
  echo "</li>";
@@ -2725,11 +2897,9 @@ class s2class {
2725
  global $phpmailer;
2726
  $message = $this->mail_failed . $phpmailer->ErrorInfo;
2727
  }
2728
- }
2729
-
2730
- if ( '' != $message ) {
2731
  echo "<div id=\"message\" class=\"updated\"><strong><p>" . $message . "</p></strong></div>\r\n";
2732
  }
 
2733
  // show our form
2734
  echo "<div class=\"wrap\">";
2735
  screen_icon();
@@ -2743,6 +2913,9 @@ class s2class {
2743
  } else {
2744
  $subject = __('A message from', 'subscribe2') . " " . get_option('blogname');
2745
  }
 
 
 
2746
  echo "<p>" . __('Subject', 'subscribe2') . ": <input type=\"text\" size=\"69\" name=\"subject\" value=\"" . $subject . "\" /> <br /><br />";
2747
  echo "<textarea rows=\"12\" cols=\"75\" name=\"content\">" . $body . "</textarea>";
2748
  echo "<br /><br />\r\n";
@@ -2760,6 +2933,37 @@ class s2class {
2760
  } // end write_menu()
2761
 
2762
  /* ===== helper functions: forms and stuff ===== */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2763
  /**
2764
  Display a table of categories with checkboxes
2765
  Optionally pre-select those categories specified
@@ -2767,18 +2971,10 @@ class s2class {
2767
  function display_category_form($selected = array(), $override = 1) {
2768
  global $wpdb;
2769
 
2770
- $all_cats = get_categories(array('hide_empty' => false, 'orderby' => 'slug'));
2771
- $exclude = explode(',', $this->subscribe2_options['exclude']);
2772
-
2773
- if ( 0 == $override ) {
2774
- // registered users are not allowed to subscribe to
2775
- // excluded categories
2776
- foreach ( $all_cats as $cat => $term_id ) {
2777
- if ( in_array($all_cats[$cat]->term_id, $exclude) ) {
2778
- $cat = (int)$cat;
2779
- unset($all_cats[$cat]);
2780
- }
2781
- }
2782
  }
2783
 
2784
  $half = (count($all_cats) / 2);
@@ -2791,23 +2987,33 @@ class s2class {
2791
  echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
2792
  foreach ( $all_cats as $cat ) {
2793
  if ( $i >= $half && 0 == $j ){
2794
- echo "</td><td width=\"50%\" align=\"left\">\r\n";
2795
- $j++;
 
 
 
 
 
 
 
2796
  }
2797
- if ( 0 == $j ) {
2798
- echo "<label><input class=\"cat_checkall\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
2799
- if ( in_array($cat->term_id, $selected) ) {
2800
- echo " checked=\"checked\"";
2801
- }
2802
- echo " /> <abbr title=\"" . $cat->slug . "\">" . rtrim(get_category_parents($cat->term_id, false, ' &#187; '), ' &#187; ') . "</abbr></label><br />\r\n";
2803
- } else {
2804
- echo "<label><input class=\"cat_checkall\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
2805
- if ( in_array($cat->term_id, $selected) ) {
2806
- echo " checked=\"checked\"";
2807
- }
2808
- echo " /> <abbr title=\"" . $cat->slug . "\">" . rtrim(get_category_parents($cat->term_id, false, ' &#187; '), ' &#187; ') . "</abbr></label><br />\r\n";
 
2809
  }
2810
- $i++;
 
 
2811
  }
2812
  echo "</td></tr>\r\n";
2813
  echo "</table>\r\n";
@@ -2828,7 +3034,7 @@ class s2class {
2828
  'all_users' => __('All Registered Users', 'subscribe2'),
2829
  'registered' => __('Registered Subscribers', 'subscribe2'));
2830
 
2831
- $all_cats = get_categories(array('hide_empty' => false));
2832
 
2833
  // count the number of subscribers
2834
  $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
@@ -3042,7 +3248,8 @@ class s2class {
3042
  natcasesort($subscribers);
3043
 
3044
  $exportcsv = "User Email,User Name";
3045
- $all_cats = get_categories(array('hide_empty' => false, 'orderby' => 'ID'));
 
3046
  foreach ($all_cats as $cat) {
3047
  $exportcsv .= "," . $cat->cat_name;
3048
  $cat_ids[] = $cat->term_id;
@@ -3057,7 +3264,7 @@ class s2class {
3057
  $cats = explode(',', $this->get_user_meta($user_info->ID, $this->get_usermeta_keyname('s2_subscribed')));
3058
  $subscribed_cats = '';
3059
  foreach ( $cat_ids as $cat ) {
3060
- (in_array($cat, $cats)) ? $subscribed_cats .= ",Yes" : $subscribed_cats .= ", No";
3061
  }
3062
 
3063
  $exportcsv .= $user_info->user_email . ',';
@@ -3086,6 +3293,8 @@ class s2class {
3086
  switch( $metaname ) {
3087
  case 's2_subscribed':
3088
  case 's2_cat':
 
 
3089
  return $wpdb->prefix . $metaname;
3090
  break;
3091
  }
@@ -3129,10 +3338,11 @@ class s2class {
3129
  Adds information to the WordPress registration screen for new users
3130
  */
3131
  function register_form() {
 
3132
  if ( 'wpreg' == $this->subscribe2_options['autosub'] ) {
3133
  echo "<p>\r\n<label>";
3134
  echo __('Check here to Subscribe to email notifications for new posts', 'subscribe2') . ":<br />\r\n";
3135
- echo "<input type=\"checkbox\" name=\"subscribe\"";
3136
  if ( 'yes' == $this->subscribe2_options['wpregdef'] ) {
3137
  echo " checked=\"checked\"";
3138
  }
@@ -3143,18 +3353,49 @@ class s2class {
3143
  echo __('By registering with this blog you are also agreeing to receive email notifications for new posts but you can unsubscribe at anytime', 'subscribe2') . ".<br />\r\n";
3144
  echo "</center></p>\r\n";
3145
  }
3146
- }
3147
 
3148
  /**
3149
  Process function to add action if user selects to subscribe to posts during registration
3150
  */
3151
- function register_post() {
3152
- if ( 'on' == $_POST['subscribe'] ) {
3153
- $user = get_userdatabylogin($_POST['user_login']);
3154
- if ( 0 == $user->ID ) { return; }
3155
- $this->register($user->ID);
 
 
3156
  }
3157
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3158
 
3159
  /**
3160
  Create meta box on write pages
@@ -3198,6 +3439,64 @@ class s2class {
3198
  }
3199
  } // end s2_meta_box_handler()
3200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3201
  /* ===== template and filter functions ===== */
3202
  /**
3203
  Display our form; also handles (un)subscribe requests
@@ -3355,40 +3654,16 @@ class s2class {
3355
  } // end counter_widget()
3356
 
3357
  /**
3358
- Function to add js files to admin header
3359
- */
3360
- function widget_s2counter_js() {
3361
- echo '<script type="text/javascript" src="' . S2URL . 'include/colorpicker/js/colorpicker.js"></script>' . "\r\n";
3362
- echo "<script type=\"text/javascript\">
3363
- jQuery(document).ready(function() {
3364
- jQuery('.colorpickerField').focusin(function() {
3365
- jQuery(this).ColorPickerShow();
3366
- });
3367
- jQuery('.colorpickerField').focusout(function() {
3368
- jQuery(this).ColorPickerHide();
3369
- });
3370
- jQuery('.colorpickerField').ColorPicker({
3371
- onSubmit: function(hsb, hex, rgb, el) {
3372
- jQuery(el).val(hex);
3373
- jQuery(el).ColorPickerHide();
3374
- },
3375
- onBeforeShow: function () {
3376
- jQuery(this).ColorPickerSetColor(this.value);
3377
- }
3378
- })
3379
- .bind('keyup', function(){
3380
- jQuery(this).ColorPickerSetColor(this.value);
3381
- });
3382
- });
3383
- </script>";
3384
- } // end widget_s2_counter_js()
3385
-
3386
- /**
3387
- Function to add css files to admin header
3388
  */
3389
- function widget_s2counter_css() {
3390
- echo '<link rel="stylesheet" href="' . S2URL . 'include/colorpicker/css/colorpicker.css" type="text/css" />' . "\r\n";
3391
- } // end widget_s2counter_css
 
 
 
 
 
3392
 
3393
  function namechange_subscribe2_widget() {
3394
  // rename WPMU widgets without requiring user to re-enable
@@ -3427,7 +3702,6 @@ class s2class {
3427
  } // end add_minimeta()
3428
 
3429
  /* ===== Write Toolbar Button Functions ===== */
3430
-
3431
  /**
3432
  Register our button in the QuickTags bar
3433
  */
@@ -3462,7 +3736,7 @@ class s2class {
3462
  echo "<script type=\"text/javascript\">\r\n";
3463
  echo "//<![CDATA[\r\n";
3464
  echo "function s2_insert_token() {
3465
- buttonsnap_settext('<!--subscribe2-->');
3466
  }\r\n";
3467
  echo "//]]>\r\n";
3468
  echo "</script>\r\n";
@@ -3585,7 +3859,7 @@ class s2class {
3585
  ('' == $tablelinks) ? $tablelinks .= "* " . $post_title : $tablelinks .= "\r\n* " . $post_title;
3586
  $message_post .= $post_title;
3587
  $message_posttime .= $post_title;
3588
- if ( strstr($mailtext, "AUTHORNAME") ) {
3589
  $author = get_userdata($post->post_author);
3590
  if ( $author->display_name != '' ) {
3591
  $message_post .= " (" . __('Author', 'subscribe2') . ": " . $author->display_name . ")";
@@ -3599,12 +3873,12 @@ class s2class {
3599
  $message_post .= get_permalink($post->ID) . "\r\n";
3600
  $message_posttime .= __('Posted on', 'subscribe2') . ": " . mysql2date($datetime, $post->post_date) . "\r\n";
3601
  $message_posttime .= get_permalink($post->ID) . "\r\n";
3602
- if ( strstr($mailtext, "CATS") ) {
3603
  $post_cat_names = implode(', ', wp_get_post_categories($post->ID, array('fields' => 'names')));
3604
  $message_post .= __('Posted in', 'subscribe2') . ": " . $post_cat_names . "\r\n";
3605
  $message_posttime .= __('Posted in', 'subscribe2') . ": " . $post_cat_names . "\r\n";
3606
  }
3607
- if ( strstr($mailtext, "TAGS") ) {
3608
  $post_tag_names = implode(', ', wp_get_post_tags($post->ID, array('fields' => 'names')));
3609
  if ( $post_tag_names != '' ) {
3610
  $message_post .= __('Tagged as', 'subscribe2') . ": " . $post_tag_names . "\r\n";
@@ -3670,10 +3944,10 @@ class s2class {
3670
  $display = $scheds[$email_freq]['display'];
3671
  ( '' == get_option('blogname') ) ? $subject = "" : $subject = "[" . stripslashes(get_option('blogname')) . "] ";
3672
  $subject .= $display . " " . __('Digest Email', 'subscribe2');
3673
- $mailtext = str_replace("TABLELINKS", $tablelinks, $mailtext);
3674
- $mailtext = str_replace("TABLE", $table, $mailtext);
3675
- $mailtext = str_replace("POSTTIME", $message_posttime, $mailtext);
3676
- $mailtext = str_replace("POST", $message_post, $mailtext);
3677
  $mailtext = stripslashes($this->substitute($mailtext));
3678
 
3679
  // prepare recipients
@@ -3697,6 +3971,8 @@ class s2class {
3697
  function s2init() {
3698
  // load the options
3699
  $this->subscribe2_options = get_option('subscribe2_options');
 
 
3700
 
3701
  add_action('init', array(&$this, 'subscribe2'));
3702
  if ( '1' == $this->subscribe2_options['show_button'] ) {
@@ -3710,8 +3986,7 @@ class s2class {
3710
 
3711
  // add action to display counter widget if option is enabled
3712
  if ( '1' == $this->subscribe2_options['counterwidget'] ) {
3713
- add_action('admin_print_styles', array(&$this, 'widget_s2counter_css'), 20);
3714
- add_action('admin_print_scripts', array(&$this, 'widget_s2counter_js'), 20);
3715
  add_action('widgets_init', array(&$this, 'counter_widget'));
3716
  }
3717
 
@@ -3760,7 +4035,6 @@ class s2class {
3760
  header("Pragma: no-cache");
3761
  header("Expires: 0");
3762
  echo $this->prepare_export($_POST['exportcsv']);
3763
-
3764
  exit(0);
3765
  }
3766
 
@@ -3779,10 +4053,12 @@ class s2class {
3779
  add_action('wp_meta', array(&$this, 'add_minimeta'), 0);
3780
  }
3781
  // Add filters for Ozh Admin Menu
3782
- add_filter('ozh_adminmenu_icon_s2_posts', array(&$this, 'ozh_s2_icon'));
3783
- add_filter('ozh_adminmenu_icon_s2_users', array(&$this, 'ozh_s2_icon'));
3784
- add_filter('ozh_adminmenu_icon_s2_tools', array(&$this, 'ozh_s2_icon'));
3785
- add_filter('ozh_adminmenu_icon_s2_settings', array(&$this, 'ozh_s2_icon'));
 
 
3786
 
3787
  // add action to display editor buttons if option is enabled
3788
  if ( '1' == $this->subscribe2_options['show_button'] ) {
@@ -3792,8 +4068,11 @@ class s2class {
3792
 
3793
  // add actions for automatic subscription based on option settings
3794
  add_action('register_form', array(&$this, 'register_form'));
3795
- add_action('user_register', array(&$this, 'register'));
3796
- add_action('add_user_to_blog', array(&$this, 'register'), 10, 1);
 
 
 
3797
 
3798
  // add actions for processing posts based on per-post or cron email settings
3799
  if ( $this->subscribe2_options['email_freq'] != 'never' ) {
@@ -3810,6 +4089,19 @@ class s2class {
3810
  add_action('pending_to_private', array(&$this, 'publish'));
3811
  }
3812
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
3813
 
3814
  // load our strings
3815
  $this->load_strings();
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
+ Version: 6.4
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904
30
  along with Subscribe2. If not, see <http://www.gnu.org/licenses/>.
31
  */
32
 
 
33
  global $wp_version;
34
  if ( version_compare($wp_version, '2.8', '<') ) {
35
  // Subscribe2 needs WordPress 2.8 or above, exit if not on a compatible version
36
  $exit_msg = sprintf(__('This version of Subscribe2 requires WordPress 2.8 or greater. Please update %1$s or use an older version of %2$s.', 'subscribe2'), '<a href="http://codex.wordpress.org/Updating_WordPress">Wordpress</a>', '<a href="http://wordpress.org/extend/plugins/subscribe2/download/">Subscribe2</a>');
37
  exit($exit_msg);
38
  }
39
+ if ( version_compare($wp_version, '3.0', '<') && is_multisite() ) {
40
+ // Subscribe2 needs WordPress MultiSite 3.0 or above, exit if not on a compatible version
41
+ $exit_msg = sprintf(__('This version of Subscribe2 requires WordPress Multisite 3.0 or greater. Please update %1$s or use an older version of %2$s.', 'subscribe2'), '<a href="http://codex.wordpress.org/Updating_WordPress">Wordpress</a>', '<a href="http://wordpress.org/extend/plugins/subscribe2/download/">Subscribe2</a>');
42
+ }
43
 
44
  // our version number. Don't touch this or any line below
45
  // unless you know exactly what you are doing
46
+ define( 'S2VERSION', '6.4' );
47
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
48
  define( 'S2DIR', trailingslashit(plugin_basename(dirname(__FILE__))) );
49
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
156
  } // end ozh_s2_icon()
157
 
158
  /**
159
+ Insert Javascript and CSS into admin_header
160
  */
161
  function checkbox_form_js() {
162
+ wp_enqueue_script('s2_checkbox', S2URL . 'include/s2_checkbox' . $this->script_debug . '.js', array('jquery'), '1.1');
163
  } //end checkbox_form_js()
164
 
165
  function user_admin_css() {
167
  }
168
 
169
  function option_form_js() {
170
+ wp_enqueue_script('s2_edit', S2URL . 'include/s2_edit' . $this->script_debug . '.js', array('jquery'), '1.0');
171
  } // end option_form_js()
172
 
173
  /* ===== Install, upgrade, reset ===== */
198
  } // end install()
199
 
200
  /**
201
+ Upgrade function for the database and settings
202
  */
203
  function upgrade() {
204
  global $wpdb, $wp_version, $wpmu_version;
207
  require_once(ABSPATH . 'wp-admin/install-helper.php');
208
  }
209
  $date = date('Y-m-d');
210
+ maybe_add_column($this->public, 'date', "ALTER TABLE $this->public ADD date DATE DEFAULT '$date' NOT NULL AFTER active");
211
+ maybe_add_column($this->public, 'ip', "ALTER TABLE $this->public ADD ip char(64) DEFAULT 'admin' NOT NULL AFTER date");
212
 
213
  // let's take the time to check process registered users
214
  // existing public subscribers are subscribed to all categories
215
  $users = $this->get_all_registered('ID');
216
  if ( !empty($users) ) {
217
+ foreach ( $users as $user_ID ) {
218
+ $check_format = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'));
219
+ // if user is already registered update format remove 's2_excerpt' field and update 's2_format'
220
+ if ( 'html' == $check_format ) {
221
+ $this->delete_user_meta($user_ID, 's2_excerpt');
222
+ } elseif ( 'text' == $check_format ) {
223
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), $this->get_user_meta($user_ID, 's2_excerpt'), true);
224
+ $this->delete_user_meta($user_ID, 's2_excerpt');
225
+ }
226
+ $subscribed = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
227
+ if ( strstr($subscribed, '-1') ) {
228
+ // make sure we remove '-1' from any settings
229
+ $old_cats = explode(',', $subscribed);
230
+ $pos = array_search('-1', $old_cats);
231
+ unset($old_cats[$pos]);
232
+ $cats = implode(',', $old_cats);
233
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats);
234
+ }
235
  }
236
  }
237
  // update the options table to serialized format
255
  if ( $this->subscribe2_options['autoformat'] == 'full' ) {
256
  $this->subscribe2_options['autoformat'] = 'post';
257
  }
258
+ // change old CAPITALISED keywords to those in {PARENTHESES}; since version 6.4
259
+ $keywords = array('BLOGNAME', 'BLOGLINK', 'TITLE', 'POST', 'POSTTIME', 'TABLE', 'TABLELINKS', 'PERMALINK', 'TINYLINK', 'DATE', 'TIME', 'MYNAME', 'EMAIL', 'AUTHORNAME', 'LINK', 'CATS', 'TAGS', 'COUNT', 'ACTION');
260
+ $keyword = implode('|', $keywords);
261
+ $regex = '/(?<!\{)\b('.$keyword.')\b(?!\{)/xm';
262
+ $replace = '{\1}';
263
+ $this->subscribe2_options['mailtext'] = preg_replace($regex, $replace, $this->subscribe2_options['mailtext']);
264
+ $this->subscribe2_options['notification_subject'] = preg_replace($regex, $replace, $this->subscribe2_options['notification_subject']);
265
+ $this->subscribe2_options['confirm_email'] = preg_replace($regex, $replace, $this->subscribe2_options['confirm_email']);
266
+ $this->subscribe2_options['confirm_subject'] = preg_replace($regex, $replace, $this->subscribe2_options['confirm_subject']);
267
+ $this->subscribe2_options['remind_email'] = preg_replace($regex, $replace, $this->subscribe2_options['remind_email']);
268
+ $this->subscribe2_options['remind_subject'] = preg_replace($regex, $replace, $this->subscribe2_options['remind_subject']);
269
  update_option('subscribe2_options', $this->subscribe2_options);
270
 
271
  // upgrade old wpmu user meta data to new
272
  if ( $this->s2_mu === true ) {
273
  $this->namechange_subscribe2_widget();
274
  // loop through all users
275
+ foreach ( $users as $user_ID ) {
276
  // get categories which the user is subscribed to (old ones)
277
+ $categories = $this->get_user_meta($user_ID, 's2_subscribed');
278
  $categories = explode(',', $categories);
279
+ $format = $this->get_user_meta($user_ID, 's2_format');
280
+ $autosub = $this->get_user_meta($user_ID, 's2_autosub');
281
 
282
  // load blogs of user (only if we need them)
283
  $blogs = array();
284
  if ( count($categories) > 0 && !in_array('-1', $categories) ) {
285
+ $blogs = get_blogs_of_user($user_ID, true);
286
  }
287
 
288
+ foreach ( $blogs as $blog ) {
289
+ switch_to_blog($blog->userblog_id);
290
 
291
  $blog_categories = (array)$wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category'");
292
  $subscribed_categories = array_intersect($categories, $blog_categories);
293
  if ( !empty($subscribed_categories) ) {
294
  foreach ( $subscribed_categories as $subscribed_category ) {
295
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $subscribed_category, $subscribed_category);
296
  }
297
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $subscribed_categories));
298
+ }
299
+ if ( !empty($format) ) {
300
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), $format);
301
+ }
302
+ if ( !empty($autosub) ) {
303
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'), $autosub);
304
  }
305
  restore_current_blog();
306
  }
307
 
308
  // delete old user meta keys
309
+ $this->delete_user_meta($user_ID, 's2_subscribed');
310
+ $this->delete_user_meta($user_ID, 's2_format');
311
+ $this->delete_user_meta($user_ID, 's2_autosub');
312
  foreach ( $categories as $cat ) {
313
+ $this->delete_user_meta($user_ID, 's2_cat' . $cat);
314
  }
315
  }
316
  }
326
  $wpdb->get_results("UPDATE $this->public SET email='$new_email' WHERE CAST(email as binary)='$email'");
327
  }
328
  }
329
+ return;
330
  } // end upgrade()
331
 
332
  /**
342
 
343
  /* ===== mail handling ===== */
344
  /**
345
+ Performs string substitutions for subscribe2 mail tags
346
  */
347
  function substitute($string = '') {
348
  if ( '' == $string ) {
349
  return;
350
  }
351
+ $string = str_replace("{BLOGNAME}", html_entity_decode(get_option('blogname'), ENT_QUOTES), $string);
352
+ $string = str_replace("{BLOGLINK}", get_option('home'), $string);
353
+ $string = str_replace("{TITLE}", stripslashes($this->post_title), $string);
354
  $link = "<a href=\"" . $this->permalink . "\">" . $this->permalink . "</a>";
355
+ $string = str_replace("{PERMALINK}", $link, $string);
356
+ if ( strstr($string, "{TINYLINK}") ) {
357
  $tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->permalink));
358
  if ( $tinylink !== 'Error' || $tinylink != false ) {
359
  $tlink = "<a href=\"" . $tinylink . "\">" . $tinylink . "</a>";
360
+ $string = str_replace("{TINYLINK}", $tlink, $string);
361
  } else {
362
+ $string = str_replace("{TINYLINK}", $link, $string);
363
  }
364
  }
365
+ $string = str_replace("{DATE}", $this->post_date, $string);
366
+ $string = str_replace("{TIME}", $this->post_time, $string);
367
+ $string = str_replace("{MYNAME}", stripslashes($this->myname), $string);
368
+ $string = str_replace("{EMAIL}", $this->myemail, $string);
369
+ $string = str_replace("{AUTHORNAME}", stripslashes($this->authorname), $string);
370
+ $string = str_replace("{CATS}", $this->post_cat_names, $string);
371
+ $string = str_replace("{TAGS}", $this->post_tag_names, $string);
372
+ $string = str_replace("{COUNT}", $this->post_count, $string);
373
 
374
  return $string;
375
  } // end substitute()
631
  if ( function_exists('strip_shortcodes') ) {
632
  $plaintext = strip_shortcodes($plaintext);
633
  }
634
+ $gallid = '[gallery id="' . $post->ID . '"';
635
+ $content = str_replace('[gallery', $gallid, $post->post_content);
636
  $content = apply_filters('the_content', $content);
637
  $content = str_replace("]]>", "]]&gt", $content);
638
  $excerpt = $post->post_excerpt;
659
  // no excerpt, is there a <!--more--> ?
660
  if ( false !== strpos($content, '<!--more-->') ) {
661
  list($html_excerpt, $more) = explode('<!--more-->', $content, 2);
662
+ // balance HTML tags and then strip leading and trailing whitespace
663
+ $html_excerpt = trim(balanceTags($html_excerpt, 1));
 
664
  } else {
665
  // no <!--more-->, so grab the first 55 words
666
  $words = explode(' ', $content, $this->excerpt_length + 1);
668
  array_pop($words);
669
  array_push($words, '[...]');
670
  $html_excerpt = implode(' ', $words);
671
+ // balance HTML tags and then strip leading and trailing whitespace
672
+ $html_excerpt = trim(balanceTags($html_excerpt, 1));
673
  }
674
  }
675
  }
676
 
677
  // prepare mail body texts
678
+ $excerpt_body = str_replace("{POST}", $excerpt, $mailtext);
679
+ $full_body = str_replace("{POST}", strip_tags($plaintext), $mailtext);
680
  $html_body = str_replace("\r\n", "<br />\r\n", $mailtext);
681
+ $html_body = str_replace("{POST}", $content, $html_body);
682
  $html_excerpt_body = str_replace("\r\n", "<br />\r\n", $mailtext);
683
+ $html_excerpt_body = str_replace("{POST}", $html_excerpt, $html_excerpt_body);
684
 
685
  if ( $preview != '' ) {
686
  $this->myemail = $preview;
727
  } // end publish_phone()
728
 
729
  /**
730
+ Send confirmation email to a public subscriber
731
  */
732
  function send_confirm($what = '', $is_remind = false) {
733
  if ( $this->filtered == 1 ) { return true; }
734
+ if ( !$this->email || !$what ) { return false; }
 
 
735
  $id = $this->get_id($this->email);
736
  if ( !$id ) {
737
  return false;
761
  } else {
762
  $body = $this->substitute(stripslashes($this->subscribe2_options['confirm_email']));
763
  if ( 'add' == $what ) {
764
+ $body = str_replace("{ACTION}", $this->subscribe, $body);
765
+ $subject = str_replace("{ACTION}", $this->subscribe, $this->subscribe2_options['confirm_subject']);
766
  } elseif ( 'del' == $what ) {
767
+ $body = str_replace("{ACTION}", $this->unsubscribe, $body);
768
+ $subject = str_replace("{ACTION}", $this->unsubscribe, $this->subscribe2_options['confirm_subject']);
769
  }
770
  $subject = html_entity_decode($this->substitute(stripslashes($subject)), ENT_QUOTES);
771
  }
772
 
773
+ $body = str_replace("{LINK}", $link, $body);
774
 
775
  if ( $is_remind == true && function_exists('wpmq_mail') ) {
776
  // could be sending lots of reminders so queue them if wpmq is enabled
1137
  // text or HTML subscribers
1138
  if ( 'all' != $r['format'] ) {
1139
  $JOIN .= "INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id ";
1140
+ $AND .= " AND b.meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND b.meta_value=";
1141
  if ( 'html' == $r['format'] ) {
1142
  $AND .= "'html'";
1143
  } elseif ( 'html_excerpt' == $r['format'] ) {
1167
  $result = $wpdb->get_col($sql);
1168
  if ( $result ) {
1169
  $ids = implode(',', $result);
1170
+ $registered = $wpdb->get_col("SELECT user_email FROM $wpdb->users WHERE ID IN ($ids)");
1171
  }
1172
+
1173
+ if ( empty($registered) ) { return false; }
1174
+
1175
+ // apply filter to registered users to add or remove additional addresses, pass args too for additional control
1176
+ $registered = apply_filters('s2_registered_subscribers', $registered, $args);
1177
+ return $registered;
1178
  } // end get_registered()
1179
 
1180
  /**
1228
  Create the appropriate usermeta values when a user registers
1229
  If the registering user had previously subscribed to notifications, this function will delete them from the public subscriber list first
1230
  */
1231
+ function register($user_ID = 0, $consent = false) {
1232
  global $wpdb;
1233
 
1234
  if ( 0 == $user_ID ) { return $user_ID; }
1235
  $user = get_userdata($user_ID);
 
1236
 
1237
+ // Subscribe registered users to categories obeying excluded categories
1238
  if ( 0 == $this->subscribe2_options['reg_override'] || 'no' == $this->subscribe2_options['newreg_override'] ) {
1239
+ $all_cats = $this->all_cats(true, 'ID');
1240
+ } else {
1241
+ $all_cats = $this->all_cats(false, 'ID');
 
 
 
 
1242
  }
1243
 
1244
+ $cats = '';
1245
  foreach ( $all_cats as $cat ) {
1246
  ('' == $cats) ? $cats = "$cat->term_id" : $cats .= ",$cat->term_id";
1247
  }
1259
  foreach ( explode(',', $cats) as $cat ) {
1260
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
1261
  }
1262
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), 'excerpt');
1263
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'), $this->subscribe2_options['autosub_def']);
1264
  } else {
1265
  // create post format entries for all users
1266
+ if ( in_array($this->subscribe2_options['autoformat'], array('html', 'html_excerpt', 'post', 'excerpt')) ) {
1267
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), $this->subscribe2_options['autoformat']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1268
  } else {
1269
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), 'excerpt');
 
 
 
 
 
 
1270
  }
1271
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'), $this->subscribe2_options['autosub_def']);
1272
+ // if the are no existing subscriptions, create them if we have consent
1273
+ if ( true === $consent ) {
 
 
 
 
1274
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats);
1275
+ foreach ( explode(',', $cats) as $cat ) {
1276
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
1277
+ }
1278
  }
1279
  }
1280
  return $user_ID;
1339
  foreach ( $cats as $id ) {
1340
  $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1341
  }
1342
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1343
  }
1344
  unset($remain);
1345
  }
1359
  }
1360
  $ids = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_email IN ($emails)");
1361
  $ids = implode(',', $ids);
1362
+ $sql = "UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND user_id IN ($ids)";
1363
+ $wpdb->get_results("UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND user_id IN ($ids)");
1364
+ } // end format_change()
1365
+
1366
+ /**
1367
+ Handles bulk update to digest preferences
1368
+ */
1369
+ function digest_change($digest, $emails) {
1370
+ if ( empty($digest) ) { return; }
1371
+
1372
+ global $wpdb;
1373
+ $useremails = explode(",", $emails);
1374
+ $useremails = implode("', '", $useremails);
1375
+
1376
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
1377
+ $user_IDs = $wpdb->get_col($sql);
1378
+
1379
+ if ( $digest == 'digest' ) {
1380
+ $exclude = explode(',', $this->subscribe2_options['exclude']);
1381
+ if ( !empty($exclude) ) {
1382
+ $all_cats = $this->all_cats(true, 'ID');
1383
+ } else {
1384
+ $all_cats = $this->all_cats(false, 'ID');
1385
+ }
1386
+
1387
+ $cats_string = '';
1388
+ foreach ( $all_cats as $cat ) {
1389
+ ('' == $cats_string) ? $cats_string = "$cat->term_id" : $cats_string .= ",$cat->term_id";
1390
+ }
1391
+
1392
+ foreach ( $user_IDs as $user_ID ) {
1393
+ foreach ( $all_cats as $cat ) {
1394
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat->term_id);
1395
+ }
1396
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats_string);
1397
+ }
1398
+ } elseif ( $digest == '-1' ) {
1399
+ foreach ( $user_IDs as $user_ID ) {
1400
+ $cats = explode(',', $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed')));
1401
+ foreach ( $cats as $id ) {
1402
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1403
+ }
1404
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1405
+ }
1406
+ }
1407
+ } // end digest_change()
1408
 
1409
  /**
1410
  Handles subscriptions and unsubscriptions for different blogs on WPMU installs
1411
  */
1412
  function wpmu_subscribe() {
 
 
1413
  // subscribe to new blog
1414
  if ( !empty($_GET['s2mu_subscribe']) ) {
1415
+ $sub_id = intval($_GET['s2mu_subscribe']);
1416
+ if ( $sub_id >= 0 ) {
1417
+ switch_to_blog($sub_id);
1418
 
1419
  $user_ID = get_current_user_id();
1420
 
1421
  // if user is not a user of the current blog
1422
+ if ( !is_blog_user($sub_id) ) {
1423
  // add user to current blog as subscriber
1424
+ add_user_to_blog($sub_id, $user_ID, 'subscriber');
1425
  // add an action hook for external manipulation of blog and user data
1426
+ do_action_ref_array('subscribe2_wpmu_subscribe', array($user_ID, $sub_id));
1427
  }
1428
 
1429
+ // get categories, remove excluded ones if override is off
 
 
1430
  if ( 0 == $this->subscribe2_options['reg_override'] ) {
1431
+ $all_cats = $this->all_cats(true, 'ID');
1432
+ } else {
1433
+ $all_cats = $this->all_cats(false, 'ID');
 
 
 
 
 
1434
  }
1435
 
1436
+ $cats_string = '';
1437
+ foreach ( $all_cats as $cat ) {
1438
+ ('' == $cats_string) ? $cats_string = "$cat->term_id" : $cats_string .= ",$cat->term_id";
1439
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat->term_id, $cat->term_id);
 
1440
  }
1441
+ if ( empty($cats_string) ) {
1442
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1443
  } else {
1444
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats_string);
1445
  }
 
 
 
1446
  }
1447
  } elseif ( !empty($_GET['s2mu_unsubscribe']) ) {
1448
  // unsubscribe from a blog
1449
+ $unsub_id = intval($_GET['s2mu_unsubscribe']);
1450
+ if ( $unsub_id >= 0 ) {
1451
+ switch_to_blog($unsub_id);
1452
 
1453
  $user_ID = get_current_user_id();
1454
 
1462
  foreach ( $cats as $id ) {
1463
  $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1464
  }
1465
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1466
 
1467
  // add an action hook for external manipulation of blog and user data
1468
+ do_action_ref_array('subscribe2_wpmu_unsubscribe', array($user_ID, $unsub_id));
1469
 
1470
  restore_current_blog();
 
1471
  }
1472
  }
1473
 
1474
+ if ( !is_user_member_of_blog($user_ID) ) {
1475
+ $user_blogs = get_active_blog_for_user($user_ID);
1476
+ if ( is_array($user_blogs) ) {
1477
+ switch_to_blog(key($user_blogs));
 
 
 
 
 
 
 
 
 
 
 
 
 
1478
  } else {
1479
+ // no longer a member of a blog
1480
+ wp_redirect(get_option('siteurl')); // redirect to front page
1481
+ exit(0);
1482
  }
1483
  }
1484
+
1485
+ // redirect to profile page
1486
+ if ( current_user_can('manage_options') ) {
1487
+ $url = get_option('siteurl') . '/wp-admin/users.php?page=s2_users';
1488
+ wp_redirect($url);
1489
+ exit(0);
1490
+ } else {
1491
+ $url = get_option('siteurl') . '/wp-admin/profile.php?page=s2_users';
1492
+ wp_redirect($url);
1493
+ exit(0);
1494
+ }
1495
  } // end wpmu_subscribe()
1496
 
1497
  /**
1534
  return $user_meta;
1535
  } // end delete_user_meta()
1536
 
1537
+ /**
1538
+ Get objects parents
1539
+ Uses get_ancestors in WordPress 3.1+ and copies this function in lower versions
1540
+ Can be dropped and calls substituted when Subscribe2 requires WordPress 3.1+
1541
+ */
1542
+ function get_parents($object_id = 0, $object_type = '') {
1543
+ if ( function_exists('get_ancestors') ) {
1544
+ return get_ancestors($object_id, $object_type);
1545
+ } else {
1546
+ // code copied directly from wp-includes/taxonomy.php
1547
+ // get_ancestors() function
1548
+ $object_id = (int) $object_id;
1549
+
1550
+ $ancestors = array();
1551
+
1552
+ if ( empty( $object_id ) ) {
1553
+ return apply_filters('get_ancestors', $ancestors, $object_id, $object_type);
1554
+ }
1555
+
1556
+ if ( is_taxonomy_hierarchical( $object_type ) ) {
1557
+ $term = get_term($object_id, $object_type);
1558
+ while ( ! is_wp_error($term) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors ) ) {
1559
+ $ancestors[] = (int) $term->parent;
1560
+ $term = get_term($term->parent, $object_type);
1561
+ }
1562
+ } elseif ( null !== get_post_type_object( $object_type ) ) {
1563
+ $object = get_post($object_id);
1564
+ if ( ! is_wp_error( $object ) && isset( $object->ancestors ) && is_array( $object->ancestors ) )
1565
+ $ancestors = $object->ancestors;
1566
+ else {
1567
+ while ( ! is_wp_error($object) && ! empty( $object->post_parent ) && ! in_array( $object->post_parent, $ancestors ) ) {
1568
+ $ancestors[] = (int) $object->post_parent;
1569
+ $object = get_post($object->post_parent);
1570
+ }
1571
+ }
1572
+ }
1573
+
1574
+ return apply_filters('get_ancestors', $ancestors, $object_id, $object_type);
1575
+ }
1576
+ } // end get_parents()
1577
+
1578
+ /**
1579
+ Check if taxonomy exists
1580
+ Uses taxonomy_exists in WordPress 3.0+ and copies this function in lower versions
1581
+ Can be dropped and calls substituted when Subscribe2 requires WordPress 3.0+
1582
+ */
1583
+ function s2_taxonomy_exists($taxonomy) {
1584
+ if ( function_exists('taxonomy_exists') ) {
1585
+ return taxonomy_exists($taxonomy);
1586
+ } else {
1587
+ global $wp_taxonomies;
1588
+ return isset( $wp_taxonomies[$taxonomy] );
1589
+ }
1590
+ } // end s2_taxonomy_exists()
1591
+
1592
  /**
1593
  Autosubscribe registered users to newly created categories
1594
  if registered user has selected this option
1600
  global $wpdb;
1601
 
1602
  if ( 'yes' == $this->subscribe2_options['show_autosub'] ) {
1603
+ if ( $this->s2_mu ) {
1604
+ $sql = "SELECT DISTINCT a.user_id FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS b WHERE a.user_id = b.user_id AND a.meta_key='" . $this->get_usermeta_keyname('s2_autosub') . "' AND a.meta_value='yes' AND b.meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'";
1605
+ } else {
1606
+ $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key='" . $this->get_usermeta_keyname('s2_autosub') . "' AND $wpdb->usermeta.meta_value='yes'";
1607
+ }
1608
  $user_IDs = $wpdb->get_col($sql);
1609
  if ( '' == $user_IDs ) { return; }
1610
 
1611
  foreach ( $user_IDs as $user_ID ) {
1612
+ $old_cats = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1613
+ if ( empty($old_cats) ) {
1614
+ $newcats = (array)$new_category;
1615
+ } else {
1616
+ $old_cats = explode(',', $old_cats);
1617
+ $newcats = array_merge($old_cats, (array)$new_category);
1618
  }
1619
  // add subscription to these cat IDs
1620
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $new_category, "$new_category");
 
1621
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $newcats));
1622
  }
1623
  } elseif ( 'exclude' == $this->subscribe2_options['show_autosub'] ) {
1624
  $excluded_cats = explode(',', $this->subscribe2_options['exclude']);
1625
  $excluded_cats[] = $new_category;
1626
  $this->subscribe2_options['exclude'] = implode(',', $excluded_cats);
1627
+ update_option('subscribe2_options', $this->subscribe2_options);
1628
  }
1629
  } // end new_category()
1630
 
1631
  function delete_category($deleted_category='') {
1632
  global $wpdb;
1633
 
1634
+ if ( $this->s2_mu ) {
1635
+ $sql = "SELECT DISTINCT a.user_id FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS b WHERE a.user_id = b.user_id AND a.meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$deleted_category' AND b.meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'";
1636
+ } else {
1637
+ $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$deleted_category'";
1638
+ }
1639
  $user_IDs = $wpdb->get_col($sql);
1640
  if ( '' == $user_IDs ) { return; }
1641
 
1645
  $old_cats = array($old_cats);
1646
  }
1647
  // add subscription to these cat IDs
1648
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $deleted_category);
1649
  $remain = array_diff($old_cats, (array)$deleted_category);
1650
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
1651
  }
1782
  } elseif ( $_POST['sub_format'] ) {
1783
  $this->format_change( $_POST['format'], $_POST['emails'] );
1784
  echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Format updated for Selected Registered Users!', 'subscribe2') . "</strong></p></div>";
1785
+ } elseif ( $_POST['sub_digest'] ) {
1786
+ $this->digest_change( $_POST['sub_category'], $_POST['emails'] );
1787
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Digest Subscription updated for Selected Registered Users!', 'subscribe2') . "</strong></p></div>";
1788
  }
1789
  }
1790
 
1925
  // show the selected subscribers
1926
  $alternate = '';
1927
  echo "<table cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">";
1928
+ $searchterm = ( $_POST['searchterm'] ) ? $_POST['searchterm'] : '';
1929
+ echo "<tr class=\"alternate\"><td width=\"50%\"><input type=\"text\" name=\"searchterm\" value=\"" . $searchterm . "\" />&nbsp;\r\n";
1930
  echo "<input type=\"submit\" class=\"button-secondary\" name=\"search\" value=\"" . __('Search Subscribers', 'subscribe2') . "\" /></td>\r\n";
1931
  if ( $reminderform ) {
1932
  echo "<td width=\"25%\" align=\"right\"><input type=\"hidden\" name=\"reminderemails\" value=\"" . $reminderemails . "\" />\r\n";
2009
  // show bulk managment form if filtered in some Registered Users
2010
  if ( in_array($what, array('registered', 'all_users')) || is_numeric($what) ) {
2011
  $subscribers_string = implode(',', $subscribers);
2012
+ echo "<h2>" . __('Bulk Management', 'subscribe2') . "</h2>\r\n";
2013
+ if ( $this->subscribe2_options['email_freq'] == 'never' ) {
2014
+ echo __('Preferences for Registered Users selected in the filter above can be changed using this section.', 'subscribe2') . "<br />\r\n";
2015
+ echo "<strong><em style=\"color: red\">" . __('Consider User Privacy as changes cannot be undone', 'subscribe2') . "</em></strong><br />\r\n";
2016
+ echo "<br />" . __('Action to perform', 'subscribe2') . ":\r\n";
2017
+ echo "<label><input type=\"radio\" name=\"manage\" value=\"subscribe\" checked=\"checked\" /> " . __('Subscribe', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
2018
+ echo "<label><input type=\"radio\" name=\"manage\" value=\"unsubscribe\" /> " . __('Unsubscribe', 'subscribe2') . "</label><br /><br />\r\n";
2019
+ echo "<input type=\"hidden\" name=\"emails\" value=\"$subscribers_string\" />\r\n";
2020
+ $this->display_category_form();
2021
+ echo "<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"sub_categories\" value=\"" . __('Bulk Update Categories', 'subscribe2') . "\" /></p>";
2022
+
2023
+ echo "<br />" . __('Send email as', 'subscribe2') . ":\r\n";
2024
+ echo "<label><input type=\"radio\" name=\"format\" value=\"html\" /> " . __('HTML - Full', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
2025
+ echo "<label><input type=\"radio\" name=\"format\" value=\"html_excerpt\" /> " . __('HTML - Excerpt', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
2026
+ echo "<label><input type=\"radio\" name=\"format\" value=\"post\" /> " . __('Plain Text - Full', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
2027
+ echo "<label><input type=\"radio\" name=\"format\" value=\"excerpt\" checked=\"checked\" /> " . __('Plain Text - Excerpt', 'subscribe2') . "</label>\r\n";
2028
+ echo "<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"sub_format\" value=\"" . __('Bulk Update Format', 'subscribe2') . "\" /></p>";
2029
+ } else {
2030
+ echo __('Preferences for Registered Users selected in the filter above can be changed using this section.', 'subscribe2') . "<br />\r\n";
2031
+ echo "<strong><em style=\"color: red\">" . __('Consider User Privacy as changes cannot be undone', 'subscribe2') . "</em></strong><br />\r\n";
2032
+ echo "<br />" . __('Subscribe Selected Users to recieve a periodic digest notification', 'subscribe2') . ":\r\n";
2033
+ echo "<label><input type=\"radio\" name=\"sub_category\" value=\"digest\" checked=\"checked\" /> ";
2034
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;\r\n";
2035
+ echo "<label><input type=\"radio\" name=\"sub_category\" value=\"-1\" /> ";
2036
+ echo __('No', 'subscribe2') . "</label>";
2037
+ echo "<input type=\"hidden\" name=\"emails\" value=\"$subscribers_string\" />\r\n";
2038
+ echo "<p class=\"submit\"><input type=\"submit\" class=\"button-primary\" name=\"sub_digest\" value=\"" . __('Bulk Update Digest Subscription', 'subscribe2') . "\" /></p>";
2039
+ }
2040
  }
2041
  echo "</form></div>\r\n";
2042
 
2049
  Our options page
2050
  */
2051
  function options_menu() {
2052
+ global $s2nonce, $wpdb, $wp_version;
2053
 
2054
  // send error message if no WordPress page exists
2055
  $sql = "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status='publish' LIMIT 1";
2110
  $email_freq = $_POST['email_freq'];
2111
  $scheduled_time = wp_next_scheduled('s2_digest_cron');
2112
  if ( $email_freq != $this->subscribe2_options['email_freq'] || $_POST['hour'] != date('H', $scheduled_time) ) {
2113
+ // make sure the timezone strings are right
2114
+ if ( date_default_timezone_get() != get_option('timezone_string') ) {
2115
+ date_default_timezone_set(get_option('timezone_string'));
2116
+ }
2117
+
2118
  $this->subscribe2_options['email_freq'] = $email_freq;
2119
  wp_clear_scheduled_hook('s2_digest_cron');
2120
  $scheds = (array)wp_get_schedules();
2175
 
2176
  // excluded categories
2177
  if ( !empty($_POST['category']) ) {
2178
+ sort($_POST['category']);
2179
  $exclude_cats = implode(',', $_POST['category']);
2180
  } else {
2181
  $exclude_cats = '';
2222
  $this->subscribe2_options['autoformat'] = $_POST['autoformat'];
2223
  $this->subscribe2_options['show_autosub'] = $_POST['show_autosub'];
2224
  $this->subscribe2_options['autosub_def'] = $_POST['autosub_def'];
2225
+ $this->subscribe2_options['comment_subs'] = $_POST['comment_subs'];
2226
 
2227
  //barred domains
2228
  $this->subscribe2_options['barred'] = $_POST['barred'];
2355
  echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><br /><br />\r\n";
2356
  echo "</td><td valign=\"top\" rowspan=\"3\">";
2357
  echo "<p class=\"submit\"><input type=\"submit\" class=\"button-secondary\" name=\"preview\" value=\"" . __('Send Email Preview', 'subscribe2') . "\" /></p>\r\n";
2358
+ echo "<h3>" . __('Message substitutions', 'subscribe2') . "</h3>\r\n";
2359
  echo "<dl>";
2360
  echo "<dt><b><em style=\"color: red\">" . __('IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED' ,'subscribe2') . "</em></b></dt><dd></dd>\r\n";
2361
+ echo "<dt><b>{BLOGNAME}</b></dt><dd>" . get_option('blogname') . "</dd>\r\n";
2362
+ echo "<dt><b>{BLOGLINK}</b></dt><dd>" . get_option('home') . "</dd>\r\n";
2363
+ echo "<dt><b>{TITLE}</b></dt><dd>" . __("the post's title<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
2364
+ 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";
2365
+ echo "<dt><b>{POSTTIME}</b></dt><dd>" . __("the excerpt of the post and the time it was posted<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2366
+ echo "<dt><b>{TABLE}</b></dt><dd>" . __("a list of post titles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2367
+ echo "<dt><b>{TABLELINKS}</b></dt><dd>" . __("a list of post titles followed by links to the atricles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2368
+ echo "<dt><b>{PERMALINK}</b></dt><dd>" . __("the post's permalink<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
2369
+ echo "<dt><b>{TINYLINK}</b></dt><dd>" . __("the post's permalink after conversion by TinyURL<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
2370
+ echo "<dt><b>{DATE}</b></dt><dd>" . __("the date the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
2371
+ echo "<dt><b>{TIME}</b></dt><dd>" . __("the time the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
2372
+ echo "<dt><b>{MYNAME}</b></dt><dd>" . __("the admin or post author's name", 'subscribe2') . "</dd>\r\n";
2373
+ echo "<dt><b>{EMAIL}</b></dt><dd>" . __("the admin or post author's email", 'subscribe2') . "</dd>\r\n";
2374
+ echo "<dt><b>{AUTHORNAME}</b></dt><dd>" . __("the post author's name", 'subscribe2') . "</dd>\r\n";
2375
+ 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";
2376
+ 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";
2377
+ echo "<dt><b>{CATS}</b></dt><dd>" . __("the post's assigned categories", 'subscribe2') . "</dd>\r\n";
2378
+ echo "<dt><b>{TAGS}</b></dt><dd>" . __("the post's assigned Tags", 'subscribe2') . "</dd>\r\n";
2379
+ echo "<dt><b>{COUNT}</b></dt><dd>" . __("the number of posts included in the digest email<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
2380
  echo "</dl></td></tr><tr><td>";
2381
  echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
2382
  echo __('Subject Line', 'subscribe2') . ": ";
2480
  if ( 'yes' == $this->subscribe2_options['newreg_override'] ) {
2481
  echo " checked=\"checked\"";
2482
  }
2483
+ echo " /> " . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2484
  echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"no\"";
2485
  if ( 'no' == $this->subscribe2_options['newreg_override'] ) {
2486
  echo " checked=\"checked\"";
2487
  }
2488
+ echo " /> " . __('No', 'subscribe2') . "</label><br /><br />\r\n";
2489
  echo __('Registration Form option is checked by default', 'subscribe2') . ":<br />\r\n";
2490
  echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"yes\"";
2491
  if ( 'yes' == $this->subscribe2_options['wpregdef'] ) {
2492
  echo " checked=\"checked\"";
2493
  }
2494
+ echo " /> " . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2495
  echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"no\"";
2496
  if ( 'no' == $this->subscribe2_options['wpregdef'] ) {
2497
  echo " checked=\"checked\"";
2498
  }
2499
+ echo " /> " . __('No', 'subscribe2') . "</label><br /><br />\r\n";
2500
  echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
2501
  echo "<label><input type=\"radio\" name=\"autoformat\" value=\"html\"";
2502
  if ( 'html' == $this->subscribe2_options['autoformat'] ) {
2523
  if ( 'yes' == $this->subscribe2_options['show_autosub'] ) {
2524
  echo " checked=\"checked\"";
2525
  }
2526
+ echo " /> " . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2527
  echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"no\"";
2528
  if ( 'no' == $this->subscribe2_options['show_autosub'] ) {
2529
  echo " checked=\"checked\"";
2530
  }
2531
+ echo " /> " . __('No', 'subscribe2') . "</label>&nbsp;&nbsp;";
2532
  echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"exclude\"";
2533
  if ( 'exclude' == $this->subscribe2_options['show_autosub'] ) {
2534
  echo " checked=\"checked\"";
2535
  }
2536
+ echo " /> " .__('New categories are immediately excluded', 'subscribe2') . "</label><br /><br />";
2537
  echo __('Option for Registered Users to auto-subscribe to new categories is checked by default', 'subscribe2') . ": <br />\r\n";
2538
  echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"yes\"";
2539
  if ( 'yes' == $this->subscribe2_options['autosub_def'] ) {
2540
  echo " checked=\"checked\"";
2541
  }
2542
+ echo " /> " . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2543
  echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"no\"";
2544
  if ( 'no' == $this->subscribe2_options['autosub_def'] ) {
2545
  echo " checked=\"checked\"";
2546
  }
2547
+ echo " /> " . __('No', 'subscribe2');
2548
+ if ( version_compare($wp_version, '2.9', '>') ) {
2549
+ // comment meta was introduced in WP2.9, don't display this if we are on a lower version
2550
+ echo"</label><br /><br />";
2551
+ echo __('Display checkbox to allow subscriptions from the comment form', 'subscribe2') . ": <br />\r\n";
2552
+ if ( version_compare($wp_version, '3.0', '>') ) {
2553
+ echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"before\"";
2554
+ if ( 'before' == $this->subscribe2_options['comment_subs'] ) {
2555
+ echo " checked=\"checked\"";
2556
+ }
2557
+ echo " /> " . __('Before the Comment Submit button', 'subscribe2') . "</label>&nbsp;&nbsp;";
2558
+ }
2559
+ echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"after\"";
2560
+ if ( 'after' == $this->subscribe2_options['comment_subs'] ) {
2561
+ echo " checked=\"checked\"";
2562
+ }
2563
+ echo " /> " . __('After the Comment Submit button', 'subscribe2') . "</label>&nbsp;&nbsp;";
2564
+ echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"no\"";
2565
+ if ( 'no' == $this->subscribe2_options['comment_subs'] ) {
2566
+ echo " checked=\"checked\"";
2567
+ }
2568
+ echo " /> " . __('No', 'subscribe2');
2569
+ }
2570
  echo"</label></p>";
2571
 
2572
  //barred domains
2609
  if ( isset($_POST['s2_admin']) && 'user' == $_POST['s2_admin'] ) {
2610
  check_admin_referer('subscribe2-user_subscribers' . $s2nonce);
2611
 
2612
+ if ( isset($_POST['s2_format']) ) {
2613
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), $_POST['s2_format']);
2614
+ } else {
2615
+ // value has not been set so use default
2616
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), 'excerpt');
2617
+ }
2618
+ if ( isset($_POST['new_category']) ) {
2619
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'), $_POST['new_category']);
2620
+ } else {
2621
+ // value has not been passed so use Settings defaults
2622
+ if ( $this->subscribe2_options['show_autosub'] == 'yes' && $this->subscribe2_options['autosub_def'] == 'yes' ) {
2623
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'), 'yes');
2624
+ } else {
2625
+ $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'), 'no');
2626
+ }
2627
+ }
2628
 
2629
  $cats = $_POST['category'];
2630
+ sort($cats);
2631
 
2632
  if ( empty($cats) || $cats == '-1' ) {
2633
  $oldcats = explode(',', $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed')));
2638
  }
2639
  $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2640
  } elseif ( $cats == 'digest' ) {
2641
+ $all_cats = $this->all_cats(false, 'ID');
2642
  foreach ( $all_cats as $cat ) {
2643
  ('' == $catids) ? $catids = "$cat->term_id" : $catids .= ",$cat->term_id";
2644
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat->term_id, $cat->term_id);
2665
  }
2666
  $this->update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $cats));
2667
  }
2668
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Subscription preferences updated.', 'subscribe2') . "</strong></p></div>\n";
2669
  }
2670
 
2671
  // show our form
2685
  if ( $this->subscribe2_options['email_freq'] == 'never' ) {
2686
  echo __('Receive email as', 'subscribe2') . ": &nbsp;&nbsp;";
2687
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"html\"";
2688
+ if ( 'html' == $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_format')) ) {
2689
  echo "checked=\"checked\" ";
2690
  }
2691
  echo "/> " . __('HTML - Full', 'subscribe2') ."</label>&nbsp;&nbsp;";
2692
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"html_excerpt\" ";
2693
+ if ( 'html_excerpt' == $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_format')) ) {
2694
  echo "checked=\"checked\" ";
2695
  }
2696
  echo "/> " . __('HTML - Excerpt', 'subscribe2') . "</label>&nbsp;&nbsp;";
2697
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"post\" ";
2698
+ if ( 'post' == $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_format')) ) {
2699
  echo "checked=\"checked\" ";
2700
  }
2701
  echo "/> " . __('Plain Text - Full', 'subscribe2') . "</label>&nbsp;&nbsp;";
2702
  echo "<label><input type=\"radio\" name=\"s2_format\" value=\"excerpt\" ";
2703
+ if ( 'excerpt' == $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_format')) ) {
2704
  echo "checked=\"checked\" ";
2705
  }
2706
  echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . "</label><br /><br />\r\n";
2708
  if ( $this->subscribe2_options['show_autosub'] == 'yes' ) {
2709
  echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
2710
  echo "<label><input type=\"radio\" name=\"new_category\" value=\"yes\" ";
2711
+ if ( 'yes' == $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub')) ) {
2712
  echo "checked=\"checked\" ";
2713
  }
2714
  echo "/> " . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
2715
  echo "<label><input type=\"radio\" name=\"new_category\" value=\"no\" ";
2716
+ if ( 'no' == $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub')) ) {
2717
  echo "checked=\"checked\" ";
2718
  }
2719
  echo "/> " . __('No', 'subscribe2') . "</label>";
2726
  $subscribed = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2727
  // if we are subscribed to the current blog display an "unsubscribe" link
2728
  if ( !empty($subscribed) ) {
2729
+ $unsubscribe_link = esc_url( add_query_arg('s2mu_unsubscribe', $blog_id) );
2730
  echo "<p><a href=\"". $unsubscribe_link ."\" class=\"button\">" . __('Unsubscribe me from this blog', 'subscribe2') . "</a></p>";
2731
  } else {
2732
  // else we show a "subscribe" link
2733
+ $subscribe_link = esc_url( add_query_arg('s2mu_subscribe', $blog_id) );
2734
  echo "<p><a href=\"". $subscribe_link ."\" class=\"button\">" . __('Subscribe to all categories', 'subscribe2') . "</a></p>";
2735
  }
2736
  echo "<h2>" . __('Subscribed Categories on', 'subscribe2') . " " . get_option('blogname') . " </h2>\r\n";
2817
  if ( is_user_member_of_blog($current_user->id, $blog['blog_id']) ) {
2818
  echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
2819
  }
2820
+ echo "<a href=\"" . esc_url( add_query_arg('s2mu_unsubscribe', $blog['blog_id']) ) . "\">" . __('Unsubscribe', 'subscribe2') . "</a></span>\r\n";
2821
  }
2822
  echo "<div class=\"additional_info\">" . $blog['description'] . "</div>\r\n";
2823
  echo "</li>";
2838
  if ( is_user_member_of_blog($current_user->id, $blog['blog_id']) ) {
2839
  echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
2840
  }
2841
+ echo "<a href=\"" . esc_url( add_query_arg('s2mu_subscribe', $blog['blog_id']) ) . "\">" . __('Subscribe', 'subscribe2') . "</a></span>\r\n";
2842
  }
2843
  echo "<div class=\"additional_info\">" . $blog['description'] . "</div>\r\n";
2844
  echo "</li>";
2897
  global $phpmailer;
2898
  $message = $this->mail_failed . $phpmailer->ErrorInfo;
2899
  }
 
 
 
2900
  echo "<div id=\"message\" class=\"updated\"><strong><p>" . $message . "</p></strong></div>\r\n";
2901
  }
2902
+
2903
  // show our form
2904
  echo "<div class=\"wrap\">";
2905
  screen_icon();
2913
  } else {
2914
  $subject = __('A message from', 'subscribe2') . " " . get_option('blogname');
2915
  }
2916
+ if ( !isset($_POST['content']) ) {
2917
+ $body = '';
2918
+ }
2919
  echo "<p>" . __('Subject', 'subscribe2') . ": <input type=\"text\" size=\"69\" name=\"subject\" value=\"" . $subject . "\" /> <br /><br />";
2920
  echo "<textarea rows=\"12\" cols=\"75\" name=\"content\">" . $body . "</textarea>";
2921
  echo "<br /><br />\r\n";
2933
  } // end write_menu()
2934
 
2935
  /* ===== helper functions: forms and stuff ===== */
2936
+ /**
2937
+ Get an object of all categories, include default and custom type
2938
+ */
2939
+ function all_cats($exclude = false, $orderby = 'slug') {
2940
+ $all_cats = array();
2941
+ $s2_taxonomies = array('category');
2942
+ $s2_taxonomies = apply_filters('s2_taxonomies', $s2_taxonomies);
2943
+
2944
+ foreach( $s2_taxonomies as $taxonomy ) {
2945
+ if ( $this->s2_taxonomy_exists($taxonomy) ) {
2946
+ $all_cats = array_merge($all_cats, get_categories(array('hide_empty' => false, 'orderby' => $orderby, 'taxonomy' => $taxonomy)));
2947
+ }
2948
+ }
2949
+
2950
+ if ( $exclude === true ) {
2951
+ // remove excluded categories from the returned object
2952
+ $excluded = explode(',', $this->subscribe2_options['exclude']);
2953
+
2954
+ // need to use $id like this as this is a mixed array / object
2955
+ $id = 0;
2956
+ foreach ( $all_cats as $cat) {
2957
+ if ( in_array($cat->term_id, $excluded) ) {
2958
+ unset($all_cats[$id]);
2959
+ }
2960
+ $id++;
2961
+ }
2962
+ }
2963
+
2964
+ return $all_cats;
2965
+ } // end all_cats()
2966
+
2967
  /**
2968
  Display a table of categories with checkboxes
2969
  Optionally pre-select those categories specified
2971
  function display_category_form($selected = array(), $override = 1) {
2972
  global $wpdb;
2973
 
2974
+ if ( $override == 0 ) {
2975
+ $all_cats = $this->all_cats(true);
2976
+ } else {
2977
+ $all_cats = $this->all_cats(false);
 
 
 
 
 
 
 
 
2978
  }
2979
 
2980
  $half = (count($all_cats) / 2);
2987
  echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
2988
  foreach ( $all_cats as $cat ) {
2989
  if ( $i >= $half && 0 == $j ){
2990
+ echo "</td><td width=\"50%\" align=\"left\">\r\n";
2991
+ $j++;
2992
+ }
2993
+ $catName = '';
2994
+ $parents = array_reverse( $this->get_parents($cat->term_id, $cat->taxonomy) );
2995
+ if ( $parents ) {
2996
+ foreach ( $parents as $parent ) {
2997
+ $parent = get_term($parent, $cat->taxonomy);
2998
+ $catName .= $parent->name . ' &raquo; ';
2999
  }
3000
+ }
3001
+ $catName .= $cat->name;
3002
+
3003
+ if ( 0 == $j ) {
3004
+ echo "<label><input class=\"cat_checkall\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
3005
+ if ( in_array($cat->term_id, $selected) ) {
3006
+ echo " checked=\"checked\"";
3007
+ }
3008
+ echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
3009
+ } else {
3010
+ echo "<label><input class=\"cat_checkall\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
3011
+ if ( in_array($cat->term_id, $selected) ) {
3012
+ echo " checked=\"checked\"";
3013
  }
3014
+ echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
3015
+ }
3016
+ $i++;
3017
  }
3018
  echo "</td></tr>\r\n";
3019
  echo "</table>\r\n";
3034
  'all_users' => __('All Registered Users', 'subscribe2'),
3035
  'registered' => __('Registered Subscribers', 'subscribe2'));
3036
 
3037
+ $all_cats = $this->all_cats(false);
3038
 
3039
  // count the number of subscribers
3040
  $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
3248
  natcasesort($subscribers);
3249
 
3250
  $exportcsv = "User Email,User Name";
3251
+ $all_cats = $this->all_cats(false, 'ID');
3252
+
3253
  foreach ($all_cats as $cat) {
3254
  $exportcsv .= "," . $cat->cat_name;
3255
  $cat_ids[] = $cat->term_id;
3264
  $cats = explode(',', $this->get_user_meta($user_info->ID, $this->get_usermeta_keyname('s2_subscribed')));
3265
  $subscribed_cats = '';
3266
  foreach ( $cat_ids as $cat ) {
3267
+ (in_array($cat, $cats)) ? $subscribed_cats .= ",Yes" : $subscribed_cats .= ",No";
3268
  }
3269
 
3270
  $exportcsv .= $user_info->user_email . ',';
3293
  switch( $metaname ) {
3294
  case 's2_subscribed':
3295
  case 's2_cat':
3296
+ case 's2_format':
3297
+ case 's2_autosub':
3298
  return $wpdb->prefix . $metaname;
3299
  break;
3300
  }
3338
  Adds information to the WordPress registration screen for new users
3339
  */
3340
  function register_form() {
3341
+ if ( 'no' == $this->subscribe2_options['autosub'] ) { return; }
3342
  if ( 'wpreg' == $this->subscribe2_options['autosub'] ) {
3343
  echo "<p>\r\n<label>";
3344
  echo __('Check here to Subscribe to email notifications for new posts', 'subscribe2') . ":<br />\r\n";
3345
+ echo "<input type=\"checkbox\" name=\"reg_subscribe\"";
3346
  if ( 'yes' == $this->subscribe2_options['wpregdef'] ) {
3347
  echo " checked=\"checked\"";
3348
  }
3353
  echo __('By registering with this blog you are also agreeing to receive email notifications for new posts but you can unsubscribe at anytime', 'subscribe2') . ".<br />\r\n";
3354
  echo "</center></p>\r\n";
3355
  }
3356
+ } // end register_form()
3357
 
3358
  /**
3359
  Process function to add action if user selects to subscribe to posts during registration
3360
  */
3361
+ function register_post($user_ID = 0) {
3362
+ global $_POST;
3363
+ if ( 0 == $user_ID ) { return; }
3364
+ if ( 'yes' == $this->subscribe2_options['autosub'] || ( 'on' == $_POST['reg_subscribe'] && 'wpreg' == $this->subscribe2_options['autosub'] ) ) {
3365
+ $this->register($user_ID, true);
3366
+ } else {
3367
+ $this->register($user_ID, false);
3368
  }
3369
+ } // end register_post()
3370
+
3371
+ /**
3372
+ Register user details when new user is added to a multisite blog
3373
+ */
3374
+ function wpmu_add_user($user_ID = 0) {
3375
+ if ( 0 == $user_ID ) { return; }
3376
+ if ( 'yes' == $this->subscribe2_options['autosub'] ) {
3377
+ $this->register($user_ID, true);
3378
+ } else {
3379
+ $this->register($user_ID, false);
3380
+ }
3381
+ } // end wpmu_add_user()
3382
+
3383
+ /**
3384
+ Delete user details when a user is removed from a multisite blog
3385
+ */
3386
+ function wpmu_remove_user($user_ID) {
3387
+ if ( 0 == $user_ID ) { return; }
3388
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'));
3389
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_autosub'));
3390
+ $cats = $this->get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
3391
+ if ( !empty($cats) ) {
3392
+ $cats = explode(',', $cats);
3393
+ foreach ( $cats as $cat ) {
3394
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat);
3395
+ }
3396
+ }
3397
+ $this->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
3398
+ } // end wpmu_remove_user()
3399
 
3400
  /**
3401
  Create meta box on write pages
3439
  }
3440
  } // end s2_meta_box_handler()
3441
 
3442
+ /* ===== comment subscriber functions ===== */
3443
+ /**
3444
+ Display check box on comment page
3445
+ */
3446
+ function s2_comment_meta_form() {
3447
+ if ( is_user_logged_in() ) {
3448
+ echo $this->use_profile_admin;
3449
+ } else {
3450
+ echo "<label><input type=\"checkbox\" name=\"s2_comment_request\" value=\"1\" />" . __('Check here to Subscribe to notifications for new posts', 'subscribe2') . "</label>";
3451
+ }
3452
+ } // end s2_comment_meta_form()
3453
+
3454
+ /**
3455
+ Process comment meta data
3456
+ */
3457
+ function s2_comment_meta($comment_ID) {
3458
+ if ( $_POST['s2_comment_request'] == '1' ) {
3459
+ add_comment_meta($comment_ID, 's2_comment_request', $_POST['s2_comment_request']);
3460
+ }
3461
+ } // end s2_comment_meta()
3462
+
3463
+ /**
3464
+ Action subscribe requests made on comment forms when comments are approved
3465
+ */
3466
+ function comment_status($comment_ID = 0, $comment_status = 0){
3467
+ global $wpdb;
3468
+
3469
+ // get meta data
3470
+ $subscribe = get_comment_meta($comment_ID, 's2_comment_request', true);
3471
+ if ( $subscribe != '1' ) { return $comment_ID; }
3472
+
3473
+ // Retrieve the information about the comment
3474
+ $sql = "SELECT comment_author_email, comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_ID' LIMIT 1";
3475
+ $comment = $wpdb->get_row($sql, OBJECT);
3476
+ if ( empty($comment) ) { return $comment_ID; }
3477
+
3478
+ switch ($comment->comment_approved){
3479
+ case '0': // Unapproved
3480
+ break;
3481
+ case '1': // Approved
3482
+ $is_public = $this->is_public($comment->comment_author_email);
3483
+ if ( $is_public == 0 ) {
3484
+ $this->toggle($comment->comment_author_email);
3485
+ }
3486
+ $is_registered = $this->is_registered($comment->comment_author_email);
3487
+ if ( !$is_public && !$is_registered ) {
3488
+ $this->activate($comment->comment_author_email);
3489
+ }
3490
+ delete_comment_meta($comment_ID, 's2_comment_request');
3491
+ break;
3492
+ default: // post is trash, spam or deleted
3493
+ delete_comment_meta($comment_ID, 's2_comment_request');
3494
+ break;
3495
+ }
3496
+
3497
+ return $comment_ID;
3498
+ } // end comment_status()
3499
+
3500
  /* ===== template and filter functions ===== */
3501
  /**
3502
  Display our form; also handles (un)subscribe requests
3654
  } // end counter_widget()
3655
 
3656
  /**
3657
+ Function to add css and js files to admin header
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3658
  */
3659
+ function widget_s2counter_css_and_js() {
3660
+ // ensure we only add colorpicker js to widgets page
3661
+ if ( stripos($_SERVER['REQUEST_URI'], 'widgets.php' ) !== false ) {
3662
+ wp_enqueue_style('colorpicker', S2URL . 'include/colorpicker/css/colorpicker.css', '', '20090523'); // colorpicker css
3663
+ wp_enqueue_script('colorpicker_js', S2URL . 'include/colorpicker/js/colorpicker' . $this->script_debug . '.js', array('jquery'), '20090523'); // colorpicker js
3664
+ wp_enqueue_script('s2_colorpicker', S2URL . 'include/s2_colorpicker' . $this->script_debug . '.js', array('colorpicker_js'), '1.3'); //my js
3665
+ }
3666
+ } // end widget_s2_counter_css_and_js()
3667
 
3668
  function namechange_subscribe2_widget() {
3669
  // rename WPMU widgets without requiring user to re-enable
3702
  } // end add_minimeta()
3703
 
3704
  /* ===== Write Toolbar Button Functions ===== */
 
3705
  /**
3706
  Register our button in the QuickTags bar
3707
  */
3736
  echo "<script type=\"text/javascript\">\r\n";
3737
  echo "//<![CDATA[\r\n";
3738
  echo "function s2_insert_token() {
3739
+ buttonsnap_settext('[subscribe2]');
3740
  }\r\n";
3741
  echo "//]]>\r\n";
3742
  echo "</script>\r\n";
3859
  ('' == $tablelinks) ? $tablelinks .= "* " . $post_title : $tablelinks .= "\r\n* " . $post_title;
3860
  $message_post .= $post_title;
3861
  $message_posttime .= $post_title;
3862
+ if ( strstr($mailtext, "{AUTHORNAME}") ) {
3863
  $author = get_userdata($post->post_author);
3864
  if ( $author->display_name != '' ) {
3865
  $message_post .= " (" . __('Author', 'subscribe2') . ": " . $author->display_name . ")";
3873
  $message_post .= get_permalink($post->ID) . "\r\n";
3874
  $message_posttime .= __('Posted on', 'subscribe2') . ": " . mysql2date($datetime, $post->post_date) . "\r\n";
3875
  $message_posttime .= get_permalink($post->ID) . "\r\n";
3876
+ if ( strstr($mailtext, "{CATS}") ) {
3877
  $post_cat_names = implode(', ', wp_get_post_categories($post->ID, array('fields' => 'names')));
3878
  $message_post .= __('Posted in', 'subscribe2') . ": " . $post_cat_names . "\r\n";
3879
  $message_posttime .= __('Posted in', 'subscribe2') . ": " . $post_cat_names . "\r\n";
3880
  }
3881
+ if ( strstr($mailtext, "{TAGS}") ) {
3882
  $post_tag_names = implode(', ', wp_get_post_tags($post->ID, array('fields' => 'names')));
3883
  if ( $post_tag_names != '' ) {
3884
  $message_post .= __('Tagged as', 'subscribe2') . ": " . $post_tag_names . "\r\n";
3944
  $display = $scheds[$email_freq]['display'];
3945
  ( '' == get_option('blogname') ) ? $subject = "" : $subject = "[" . stripslashes(get_option('blogname')) . "] ";
3946
  $subject .= $display . " " . __('Digest Email', 'subscribe2');
3947
+ $mailtext = str_replace("{TABLELINKS}", $tablelinks, $mailtext);
3948
+ $mailtext = str_replace("{TABLE}", $table, $mailtext);
3949
+ $mailtext = str_replace("{POSTTIME}", $message_posttime, $mailtext);
3950
+ $mailtext = str_replace("{POST}", $message_post, $mailtext);
3951
  $mailtext = stripslashes($this->substitute($mailtext));
3952
 
3953
  // prepare recipients
3971
  function s2init() {
3972
  // load the options
3973
  $this->subscribe2_options = get_option('subscribe2_options');
3974
+ // if SCRIPT_DEBUG is true, use dev scripts
3975
+ $this->script_debug = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '.dev' : '';
3976
 
3977
  add_action('init', array(&$this, 'subscribe2'));
3978
  if ( '1' == $this->subscribe2_options['show_button'] ) {
3986
 
3987
  // add action to display counter widget if option is enabled
3988
  if ( '1' == $this->subscribe2_options['counterwidget'] ) {
3989
+ add_action('admin_init', array(&$this, 'widget_s2counter_css_and_js'));
 
3990
  add_action('widgets_init', array(&$this, 'counter_widget'));
3991
  }
3992
 
4035
  header("Pragma: no-cache");
4036
  header("Expires: 0");
4037
  echo $this->prepare_export($_POST['exportcsv']);
 
4038
  exit(0);
4039
  }
4040
 
4053
  add_action('wp_meta', array(&$this, 'add_minimeta'), 0);
4054
  }
4055
  // Add filters for Ozh Admin Menu
4056
+ if ( function_exists('wp_ozh_adminmenu') ) {
4057
+ add_filter('ozh_adminmenu_icon_s2_posts', array(&$this, 'ozh_s2_icon'));
4058
+ add_filter('ozh_adminmenu_icon_s2_users', array(&$this, 'ozh_s2_icon'));
4059
+ add_filter('ozh_adminmenu_icon_s2_tools', array(&$this, 'ozh_s2_icon'));
4060
+ add_filter('ozh_adminmenu_icon_s2_settings', array(&$this, 'ozh_s2_icon'));
4061
+ }
4062
 
4063
  // add action to display editor buttons if option is enabled
4064
  if ( '1' == $this->subscribe2_options['show_button'] ) {
4068
 
4069
  // add actions for automatic subscription based on option settings
4070
  add_action('register_form', array(&$this, 'register_form'));
4071
+ add_action('user_register', array(&$this, 'register_post'));
4072
+ if ( $this->s2_mu ) {
4073
+ add_action('add_user_to_blog', array(&$this, 'wpmu_add_user'), 10);
4074
+ add_action('remove_user_from_blog', array(&$this, 'wpmu_remove_user'), 10);
4075
+ }
4076
 
4077
  // add actions for processing posts based on per-post or cron email settings
4078
  if ( $this->subscribe2_options['email_freq'] != 'never' ) {
4089
  add_action('pending_to_private', array(&$this, 'publish'));
4090
  }
4091
  }
4092
+ // Enable notifications for blogs made via email
4093
+ add_action('publish_phone', array(&$this, 'publish_phone'));
4094
+
4095
+ // add actions for comment subscribers
4096
+ if ( 'no' != $this->subscribe2_options['comment_subs'] ) {
4097
+ if ( 'before' == $this->subscribe2_options['comment_subs'] ) {
4098
+ add_action('comment_form_after_fields', array(&$this, 's2_comment_meta_form'));
4099
+ } else {
4100
+ add_action('comment_form', array(&$this, 's2_comment_meta_form'));
4101
+ }
4102
+ add_action('comment_post', array(&$this, 's2_comment_meta'), 1);
4103
+ add_action('wp_set_comment_status', array(&$this, 'comment_status'));
4104
+ }
4105
 
4106
  // load our strings
4107
  $this->load_strings();
subscribe2.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2011-03-17 20:26+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,887 +17,923 @@ msgstr ""
17
  "Content-Type: text/plain; charset=CHARSET\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
 
20
- #: subscribe2.php:37
21
  #, php-format
22
  msgid ""
23
  "This version of Subscribe2 requires WordPress 2.8 or greater. Please update "
24
  "%1$s or use an older version of %2$s."
25
  msgstr ""
26
 
27
- #: subscribe2.php:72
 
 
 
 
 
 
 
28
  msgid "To manage your subscription options please"
29
  msgstr ""
30
 
31
- #: subscribe2.php:72
32
  msgid "login"
33
  msgstr ""
34
 
35
- #: subscribe2.php:74 subscribe2.php:83
36
  msgid "You may manage your subscription options from your"
37
  msgstr ""
38
 
39
- #: subscribe2.php:74 subscribe2.php:83
40
  msgid "profile"
41
  msgstr ""
42
 
43
- #: subscribe2.php:79 subscribe2.php:88 subscribe2.php:1803 subscribe2.php:1900
44
- #: subscribe2.php:2669 subscribe2.php:3216 subscribe2.php:3219
45
  #: include/widget.php:96
46
  msgid "Subscribe"
47
  msgstr ""
48
 
49
- #: subscribe2.php:79 subscribe2.php:88
50
  msgid "to email notifications when this blog posts new content"
51
  msgstr ""
52
 
53
- #: subscribe2.php:92
54
  msgid "A confirmation message is on its way!"
55
  msgstr ""
56
 
57
- #: subscribe2.php:94
58
  msgid "That email address is already subscribed."
59
  msgstr ""
60
 
61
- #: subscribe2.php:96
62
  msgid "That email address is not subscribed."
63
  msgstr ""
64
 
65
- #: subscribe2.php:98
66
  msgid "Sorry, but that does not look like an email address to me."
67
  msgstr ""
68
 
69
- #: subscribe2.php:100
70
  msgid ""
71
  "Sorry, email addresses at that domain are currently barred due to spam, "
72
  "please use an alternative email address."
73
  msgstr ""
74
 
75
- #: subscribe2.php:102
76
  msgid ""
77
  "Sorry, there seems to be an error on the server. Please try again later."
78
  msgstr ""
79
 
80
- #: subscribe2.php:104
81
  msgid "You must to create a WordPress page for this plugin to work correctly."
82
  msgstr ""
83
 
84
- #: subscribe2.php:106
85
  msgid "Message sent!"
86
  msgstr ""
87
 
88
- #: subscribe2.php:108
89
  msgid ""
90
  "Message failed! Check your settings and check with your hosting provider"
91
  msgstr ""
92
 
93
- #: subscribe2.php:111
94
  msgid "No such email address is registered."
95
  msgstr ""
96
 
97
- #: subscribe2.php:113
98
  msgid "You have successfully subscribed!"
99
  msgstr ""
100
 
101
- #: subscribe2.php:115
102
  msgid "You have successfully unsubscribed."
103
  msgstr ""
104
 
105
- #: subscribe2.php:117
106
  msgid "subscribe"
107
  msgstr ""
108
 
109
- #: subscribe2.php:119
110
  msgid "unsubscribe"
111
  msgstr ""
112
 
113
- #: subscribe2.php:122
114
  msgid "Options saved!"
115
  msgstr ""
116
 
117
- #: subscribe2.php:123
118
  msgid "Options reset!"
119
  msgstr ""
120
 
121
- #: subscribe2.php:131
122
  msgid "Subscribers"
123
  msgstr ""
124
 
125
- #: subscribe2.php:134
126
  msgid "Subscribe2 Options"
127
  msgstr ""
128
 
129
- #: subscribe2.php:134 subscribe2.php:3442 include/widget.php:17
130
  msgid "Subscribe2"
131
  msgstr ""
132
 
133
- #: subscribe2.php:139
134
  msgid "Your Subscriptions"
135
  msgstr ""
136
 
137
- #: subscribe2.php:143
138
  msgid "Mail Subscribers"
139
  msgstr ""
140
 
141
- #: subscribe2.php:646
142
  msgid "Plain Text Excerpt Preview"
143
  msgstr ""
144
 
145
- #: subscribe2.php:648
146
  msgid "Plain Text Full Preview"
147
  msgstr ""
148
 
149
- #: subscribe2.php:650
150
  msgid "HTML Excerpt Preview"
151
  msgstr ""
152
 
153
- #: subscribe2.php:652
154
  msgid "HTML Full Preview"
155
  msgstr ""
156
 
157
- #: subscribe2.php:917
158
  msgid "New Subscription"
159
  msgstr ""
160
 
161
- #: subscribe2.php:919
162
  msgid "subscribed to email notifications!"
163
  msgstr ""
164
 
165
- #: subscribe2.php:955
166
  msgid "New Unsubscription"
167
  msgstr ""
168
 
169
- #: subscribe2.php:957
170
  msgid "unsubscribed from email notifications!"
171
  msgstr ""
172
 
173
- #: subscribe2.php:1614
174
  msgid "Address(es) subscribed!"
175
  msgstr ""
176
 
177
- #: subscribe2.php:1621
178
  msgid "Address(es) unsubscribed!"
179
  msgstr ""
180
 
181
- #: subscribe2.php:1625
182
  msgid "Some emails were not processed, the following were already subscribed"
183
  msgstr ""
184
 
185
- #: subscribe2.php:1628
186
  msgid "Some emails were not processed, the following were not in the database"
187
  msgstr ""
188
 
189
- #: subscribe2.php:1637
190
  msgid "Address(es) deleted!"
191
  msgstr ""
192
 
193
- #: subscribe2.php:1643 subscribe2.php:1649
194
  msgid "Status changed!"
195
  msgstr ""
196
 
197
- #: subscribe2.php:1663
198
  msgid "Reminder Email(s) Sent!"
199
  msgstr ""
200
 
201
- #: subscribe2.php:1666
202
  msgid "Registered Users Subscribed!"
203
  msgstr ""
204
 
205
- #: subscribe2.php:1669
206
  msgid "Registered Users Unsubscribed!"
207
  msgstr ""
208
 
209
- #: subscribe2.php:1672
210
  msgid "Format updated for Selected Registered Users!"
211
  msgstr ""
212
 
213
- #: subscribe2.php:1767
 
 
 
 
214
  msgid "Previous Page"
215
  msgstr ""
216
 
217
- #: subscribe2.php:1787
218
  msgid "Next Page"
219
  msgstr ""
220
 
221
- #: subscribe2.php:1794
222
  msgid "Manage Subscribers"
223
  msgstr ""
224
 
225
- #: subscribe2.php:1799
226
  msgid "Add/Remove Subscribers"
227
  msgstr ""
228
 
229
- #: subscribe2.php:1800
230
  msgid "Enter addresses, one per line or comma-separated"
231
  msgstr ""
232
 
233
- #: subscribe2.php:1804 subscribe2.php:1901 subscribe2.php:2648
234
- #: subscribe2.php:3214 subscribe2.php:3219 include/widget.php:96
235
  msgid "Unsubscribe"
236
  msgstr ""
237
 
238
- #: subscribe2.php:1807
239
  msgid "Current Subscribers"
240
  msgstr ""
241
 
242
- #: subscribe2.php:1809
243
  msgid "Filter"
244
  msgstr ""
245
 
246
- #: subscribe2.php:1814
247
  msgid "Search Subscribers"
248
  msgstr ""
249
 
250
- #: subscribe2.php:1817
251
  msgid "Send Reminder Email"
252
  msgstr ""
253
 
254
- #: subscribe2.php:1824
255
  msgid "Save Emails to CSV File"
256
  msgstr ""
257
 
258
- #: subscribe2.php:1830 subscribe2.php:1888
259
  msgid "Process"
260
  msgstr ""
261
 
262
- #: subscribe2.php:1843 subscribe2.php:1865
263
  msgid "Confirm this email address"
264
  msgstr ""
265
 
266
- #: subscribe2.php:1845 subscribe2.php:1858
267
  msgid "Unconfirm this email address"
268
  msgstr ""
269
 
270
- #: subscribe2.php:1847 subscribe2.php:1860 subscribe2.php:1868
271
  msgid "Delete this email address"
272
  msgstr ""
273
 
274
- #: subscribe2.php:1851 subscribe2.php:2789
275
  msgid "Select / Unselect All"
276
  msgstr ""
277
 
278
- #: subscribe2.php:1875
279
  msgid "edit"
280
  msgstr ""
281
 
282
- #: subscribe2.php:1882
283
  msgid "No matching subscribers found"
284
  msgstr ""
285
 
286
- #: subscribe2.php:1884
287
  msgid "NONE"
288
  msgstr ""
289
 
290
- #: subscribe2.php:1896
291
- msgid "Categories"
292
  msgstr ""
293
 
294
- #: subscribe2.php:1897
295
  msgid ""
296
  "Preferences for Registered Users selected in the filter above can be changed "
297
  "using this section."
298
  msgstr ""
299
 
300
- #: subscribe2.php:1898
301
  msgid "Consider User Privacy as changes cannot be undone"
302
  msgstr ""
303
 
304
- #: subscribe2.php:1899
305
  msgid "Action to perform"
306
  msgstr ""
307
 
308
- #: subscribe2.php:1904
309
  msgid "Bulk Update Categories"
310
  msgstr ""
311
 
312
- #: subscribe2.php:1906
313
  msgid "Send email as"
314
  msgstr ""
315
 
316
- #: subscribe2.php:1907 subscribe2.php:2370 subscribe2.php:2519
317
  msgid "HTML - Full"
318
  msgstr ""
319
 
320
- #: subscribe2.php:1908 subscribe2.php:2375 subscribe2.php:2524
321
  msgid "HTML - Excerpt"
322
  msgstr ""
323
 
324
- #: subscribe2.php:1909 subscribe2.php:2380 subscribe2.php:2529
325
  msgid "Plain Text - Full"
326
  msgstr ""
327
 
328
- #: subscribe2.php:1910 subscribe2.php:2385 subscribe2.php:2534
329
  msgid "Plain Text - Excerpt"
330
  msgstr ""
331
 
332
- #: subscribe2.php:1911
333
  msgid "Bulk Update Format"
334
  msgstr ""
335
 
336
- #: subscribe2.php:1948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  msgid "Preview message(s) sent to logged in user"
338
  msgstr ""
339
 
340
- #: subscribe2.php:1952
341
  msgid ""
342
  "The Digest Notification email contained no post information. No email was "
343
  "sent"
344
  msgstr ""
345
 
346
- #: subscribe2.php:1954
347
  msgid "Attempt made to resend the Digest Notification email"
348
  msgstr ""
349
 
350
- #: subscribe2.php:2102
351
  msgid "Subscribe2 Settings"
352
  msgstr ""
353
 
354
- #: subscribe2.php:2103
355
  msgid "Plugin Blog"
356
  msgstr ""
357
 
358
- #: subscribe2.php:2104
359
  msgid "Make a donation via PayPal"
360
  msgstr ""
361
 
362
- #: subscribe2.php:2115 subscribe2.php:2502
363
  msgid "Notification Settings"
364
  msgstr ""
365
 
366
- #: subscribe2.php:2116
367
  msgid "Restrict the number of recipients per email to (0 for unlimited)"
368
  msgstr ""
369
 
370
- #: subscribe2.php:2118 subscribe2.php:2282
371
  msgid "Edit"
372
  msgstr ""
373
 
374
- #: subscribe2.php:2121 subscribe2.php:2285
375
  msgid "Update"
376
  msgstr ""
377
 
378
- #: subscribe2.php:2122 subscribe2.php:2286
379
  msgid "Revert"
380
  msgstr ""
381
 
382
- #: subscribe2.php:2124
383
  msgid "Send Admins notifications for new"
384
  msgstr ""
385
 
386
- #: subscribe2.php:2129
387
  msgid "Subscriptions"
388
  msgstr ""
389
 
390
- #: subscribe2.php:2134
391
  msgid "Unsubscriptions"
392
  msgstr ""
393
 
394
- #: subscribe2.php:2139
395
  msgid "Both"
396
  msgstr ""
397
 
398
- #: subscribe2.php:2144
399
  msgid "Neither"
400
  msgstr ""
401
 
402
- #: subscribe2.php:2146
403
  msgid "Include theme CSS stylesheet in HTML notifications"
404
  msgstr ""
405
 
406
- #: subscribe2.php:2151 subscribe2.php:2163 subscribe2.php:2174
407
- #: subscribe2.php:2185 subscribe2.php:2348 subscribe2.php:2359
408
- #: subscribe2.php:2391 subscribe2.php:2407 subscribe2.php:2542
409
- #: subscribe2.php:2578
410
- msgid "Yes"
411
- msgstr ""
412
-
413
- #: subscribe2.php:2156 subscribe2.php:2168 subscribe2.php:2179
414
- #: subscribe2.php:2190 subscribe2.php:2342 subscribe2.php:2353
415
- #: subscribe2.php:2364 subscribe2.php:2396 subscribe2.php:2412
416
- #: subscribe2.php:2547 subscribe2.php:2582
417
- msgid "No"
418
- msgstr ""
419
-
420
- #: subscribe2.php:2158
421
  msgid "Send Emails for Pages"
422
  msgstr ""
423
 
424
- #: subscribe2.php:2169
425
  msgid "Send Emails for Password Protected Posts"
426
  msgstr ""
427
 
428
- #: subscribe2.php:2180
429
  msgid "Send Emails for Private Posts"
430
  msgstr ""
431
 
432
- #: subscribe2.php:2191
433
  msgid "Send Email From"
434
  msgstr ""
435
 
436
- #: subscribe2.php:2196
437
  msgid "Send Emails"
438
  msgstr ""
439
 
440
- #: subscribe2.php:2198
441
  msgid "For digest notifications, date order for posts is"
442
  msgstr ""
443
 
444
- #: subscribe2.php:2203
445
  msgid "Descending"
446
  msgstr ""
447
 
448
- #: subscribe2.php:2208
449
  msgid "Ascending"
450
  msgstr ""
451
 
452
- #: subscribe2.php:2212
453
  msgid "Email Templates"
454
  msgstr ""
455
 
456
- #: subscribe2.php:2216
457
  msgid "New Post email (must not be empty)"
458
  msgstr ""
459
 
460
- #: subscribe2.php:2217 subscribe2.php:2247 subscribe2.php:2252
461
  msgid "Subject Line"
462
  msgstr ""
463
 
464
- #: subscribe2.php:2222
465
  msgid "Send Email Preview"
466
  msgstr ""
467
 
468
- #: subscribe2.php:2223
469
- msgid "Message substitions"
470
  msgstr ""
471
 
472
- #: subscribe2.php:2225
473
  msgid ""
474
  "IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED"
475
  msgstr ""
476
 
477
- #: subscribe2.php:2228
478
  msgid "the post's title<br />(<i>for per-post emails only</i>)"
479
  msgstr ""
480
 
481
- #: subscribe2.php:2229
482
  msgid ""
483
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
484
  "preferences</i>)"
485
  msgstr ""
486
 
487
- #: subscribe2.php:2230
488
  msgid ""
489
  "the excerpt of the post and the time it was posted<br />(<i>for digest "
490
  "emails only</i>)"
491
  msgstr ""
492
 
493
- #: subscribe2.php:2231
494
  msgid "a list of post titles<br />(<i>for digest emails only</i>)"
495
  msgstr ""
496
 
497
- #: subscribe2.php:2232
498
  msgid ""
499
  "a list of post titles followed by links to the atricles<br />(<i>for digest "
500
  "emails only</i>)"
501
  msgstr ""
502
 
503
- #: subscribe2.php:2233
504
  msgid "the post's permalink<br />(<i>for per-post emails only</i>)"
505
  msgstr ""
506
 
507
- #: subscribe2.php:2234
508
  msgid ""
509
  "the post's permalink after conversion by TinyURL<br />(<i>for per-post "
510
  "emails only</i>)"
511
  msgstr ""
512
 
513
- #: subscribe2.php:2235
514
  msgid "the date the post was made<br />(<i>for per-post emails only</i>)"
515
  msgstr ""
516
 
517
- #: subscribe2.php:2236
518
  msgid "the time the post was made<br />(<i>for per-post emails only</i>)"
519
  msgstr ""
520
 
521
- #: subscribe2.php:2237
522
  msgid "the admin or post author's name"
523
  msgstr ""
524
 
525
- #: subscribe2.php:2238
526
  msgid "the admin or post author's email"
527
  msgstr ""
528
 
529
- #: subscribe2.php:2239
530
  msgid "the post author's name"
531
  msgstr ""
532
 
533
- #: subscribe2.php:2240
534
  msgid ""
535
  "the generated link to confirm a request<br />(<i>only used in the "
536
  "confirmation email template</i>)"
537
  msgstr ""
538
 
539
- #: subscribe2.php:2241
540
  msgid ""
541
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
542
  "confirmation email template</i>)"
543
  msgstr ""
544
 
545
- #: subscribe2.php:2242
546
  msgid "the post's assigned categories"
547
  msgstr ""
548
 
549
- #: subscribe2.php:2243
550
  msgid "the post's assigned Tags"
551
  msgstr ""
552
 
553
- #: subscribe2.php:2244
554
  msgid ""
555
  "the number of posts included in the digest email<br />(<i>for digest emails "
556
  "only</i>)"
557
  msgstr ""
558
 
559
- #: subscribe2.php:2246
560
  msgid "Subscribe / Unsubscribe confirmation email"
561
  msgstr ""
562
 
563
- #: subscribe2.php:2251
564
  msgid "Reminder email to Unconfirmed Subscribers"
565
  msgstr ""
566
 
567
- #: subscribe2.php:2258
568
  msgid "Excluded Categories"
569
  msgstr ""
570
 
571
- #: subscribe2.php:2260
572
  msgid ""
573
  "Posts assigned to any Excluded Category do not generate notifications and "
574
  "are not included in digest notifications"
575
  msgstr ""
576
 
577
- #: subscribe2.php:2267
578
  msgid "Allow registered users to subscribe to excluded categories?"
579
  msgstr ""
580
 
581
- #: subscribe2.php:2270
582
  msgid "Appearance"
583
  msgstr ""
584
 
585
- #: subscribe2.php:2274
586
  msgid "Set default Subscribe2 page as ID"
587
  msgstr ""
588
 
589
- #: subscribe2.php:2280
590
  msgid "Set the number of Subscribers displayed per page"
591
  msgstr ""
592
 
593
- #: subscribe2.php:2293
594
  msgid "Show a link to your subscription page in \"meta\"?"
595
  msgstr ""
596
 
597
- #: subscribe2.php:2300
598
  msgid "Show the Subscribe2 button on the Write toolbar?"
599
  msgstr ""
600
 
601
- #: subscribe2.php:2307
602
  msgid "Enable Subscribe2 Widget?"
603
  msgstr ""
604
 
605
- #: subscribe2.php:2314
606
  msgid "Enable Subscribe2 Counter Widget?"
607
  msgstr ""
608
 
609
- #: subscribe2.php:2321
610
  msgid "Disable email notifications is checked by default on authoring pages?"
611
  msgstr ""
612
 
613
- #: subscribe2.php:2325
614
  msgid "Auto Subscribe"
615
  msgstr ""
616
 
617
- #: subscribe2.php:2327
618
  msgid "Subscribe new users registering with your blog"
619
  msgstr ""
620
 
621
- #: subscribe2.php:2332
622
  msgid "Automatically"
623
  msgstr ""
624
 
625
- #: subscribe2.php:2337
626
  msgid "Display option on Registration Form"
627
  msgstr ""
628
 
629
- #: subscribe2.php:2343
630
  msgid "Auto-subscribe includes any excluded categories"
631
  msgstr ""
632
 
633
- #: subscribe2.php:2354
634
  msgid "Registration Form option is checked by default"
635
  msgstr ""
636
 
637
- #: subscribe2.php:2365
638
  msgid "Auto-subscribe users to receive email as"
639
  msgstr ""
640
 
641
- #: subscribe2.php:2386
642
  msgid "Registered Users have the option to auto-subscribe to new categories"
643
  msgstr ""
644
 
645
- #: subscribe2.php:2401
646
  msgid "New categories are immediately excluded"
647
  msgstr ""
648
 
649
- #: subscribe2.php:2402
650
  msgid ""
651
  "Option for Registered Users to auto-subscribe to new categories is checked "
652
  "by default"
653
  msgstr ""
654
 
655
- #: subscribe2.php:2416
 
 
 
 
 
 
 
 
 
 
 
 
656
  msgid "Barred Domains"
657
  msgstr ""
658
 
659
- #: subscribe2.php:2418
660
  msgid ""
661
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
662
  "each entry and omit the \"@\" symbol, for example email.com)"
663
  msgstr ""
664
 
665
- #: subscribe2.php:2423
666
  msgid "Submit"
667
  msgstr ""
668
 
669
- #: subscribe2.php:2426
670
  msgid "Reset Default"
671
  msgstr ""
672
 
673
- #: subscribe2.php:2427
674
  msgid ""
675
  "Use this to reset all options to their defaults. This <strong><em>will not</"
676
  "em></strong> modify your list of subscribers."
677
  msgstr ""
678
 
679
- #: subscribe2.php:2429
680
  msgid "RESET"
681
  msgstr ""
682
 
683
- #: subscribe2.php:2455
684
  msgid "Subscription preferences updated."
685
  msgstr ""
686
 
687
- #: subscribe2.php:2505
688
  msgid "Editing Subscribe2 preferences for user"
689
  msgstr ""
690
 
691
- #: subscribe2.php:2514
692
  msgid "Receive email as"
693
  msgstr ""
694
 
695
- #: subscribe2.php:2537
696
  msgid "Automatically subscribe me to newly created categories"
697
  msgstr ""
698
 
699
- #: subscribe2.php:2558
700
  msgid "Unsubscribe me from this blog"
701
  msgstr ""
702
 
703
- #: subscribe2.php:2562
704
  msgid "Subscribe to all categories"
705
  msgstr ""
706
 
707
- #: subscribe2.php:2564
708
  msgid "Subscribed Categories on"
709
  msgstr ""
710
 
711
- #: subscribe2.php:2566
712
  msgid "Subscribed Categories"
713
  msgstr ""
714
 
715
- #: subscribe2.php:2572
716
  msgid "Receive periodic summaries of new posts?"
717
  msgstr ""
718
 
719
- #: subscribe2.php:2587
720
  msgid "Update Preferences"
721
  msgstr ""
722
 
723
- #: subscribe2.php:2637
724
  msgid "Subscribed Blogs"
725
  msgstr ""
726
 
727
- #: subscribe2.php:2642 subscribe2.php:2663
728
  msgid "Viewing Settings Now"
729
  msgstr ""
730
 
731
- #: subscribe2.php:2646 subscribe2.php:2667
732
  msgid "View Settings"
733
  msgstr ""
734
 
735
- #: subscribe2.php:2658
736
  msgid "Subscribe to new blogs"
737
  msgstr ""
738
 
739
- #: subscribe2.php:2736
740
  msgid "Send an email to subscribers"
741
  msgstr ""
742
 
743
- #: subscribe2.php:2744
744
  msgid "A message from"
745
  msgstr ""
746
 
747
- #: subscribe2.php:2746
748
  msgid "Subject"
749
  msgstr ""
750
 
751
- #: subscribe2.php:2749
752
  msgid "Recipients:"
753
  msgstr ""
754
 
755
- #: subscribe2.php:2753
756
  msgid "Preview"
757
  msgstr ""
758
 
759
- #: subscribe2.php:2753
760
  msgid "Send"
761
  msgstr ""
762
 
763
- #: subscribe2.php:2824
764
  msgid "All Users and Subscribers"
765
  msgstr ""
766
 
767
- #: subscribe2.php:2825
768
  msgid "Public Subscribers"
769
  msgstr ""
770
 
771
- #: subscribe2.php:2826
772
  msgid "Confirmed"
773
  msgstr ""
774
 
775
- #: subscribe2.php:2827
776
  msgid "Unconfirmed"
777
  msgstr ""
778
 
779
- #: subscribe2.php:2828
780
  msgid "All Registered Users"
781
  msgstr ""
782
 
783
- #: subscribe2.php:2829
784
  msgid "Registered Subscribers"
785
  msgstr ""
786
 
787
- #: subscribe2.php:2951
788
  msgid "For each Post"
789
  msgstr ""
790
 
791
- #: subscribe2.php:2968
792
  msgid "Send Digest Notification at"
793
  msgstr ""
794
 
795
- #: subscribe2.php:2980
796
  msgid ""
797
  "This option will be ignored if the time selected is not in the future in "
798
  "relation to the current time"
799
  msgstr ""
800
 
801
- #: subscribe2.php:2983
802
  msgid "Current UTC time is"
803
  msgstr ""
804
 
805
- #: subscribe2.php:2985
806
  msgid "Current blog time is"
807
  msgstr ""
808
 
809
- #: subscribe2.php:2987
810
  msgid "Next email notification will be sent when your blog time is after"
811
  msgstr ""
812
 
813
- #: subscribe2.php:2990
814
  msgid "Attempt to resend the last Digest Notification email"
815
  msgstr ""
816
 
817
- #: subscribe2.php:2991
818
  msgid "Resend Digest"
819
  msgstr ""
820
 
821
- #: subscribe2.php:3068
822
  msgid "Confirmed Public Subscriber"
823
  msgstr ""
824
 
825
- #: subscribe2.php:3070
826
  msgid "Unconfirmed Public Subscriber"
827
  msgstr ""
828
 
829
- #: subscribe2.php:3122
830
  msgid "Settings"
831
  msgstr ""
832
 
833
- #: subscribe2.php:3123
834
  msgid "Donate"
835
  msgstr ""
836
 
837
- #: subscribe2.php:3134
838
  msgid "Check here to Subscribe to email notifications for new posts"
839
  msgstr ""
840
 
841
- #: subscribe2.php:3143
842
  msgid ""
843
  "By registering with this blog you are also agreeing to receive email "
844
  "notifications for new posts but you can unsubscribe at anytime"
845
  msgstr ""
846
 
847
- #: subscribe2.php:3163 subscribe2.php:3164
848
  msgid "Subscribe2 Notification Override"
849
  msgstr ""
850
 
851
- #: subscribe2.php:3174
852
  msgid ""
853
  "Check here to disable sending of an email notification for this post/page"
854
  msgstr ""
855
 
856
- #: subscribe2.php:3226
 
 
 
 
857
  msgid "Your email:"
858
  msgstr ""
859
 
860
- #: subscribe2.php:3226
861
  msgid "Enter email address..."
862
  msgstr ""
863
 
864
- #: subscribe2.php:3334
865
  msgid "Subscription Confirmation"
866
  msgstr ""
867
 
868
- #: subscribe2.php:3425
869
  msgid "[Un]Subscribe to Posts"
870
  msgstr ""
871
 
872
- #: subscribe2.php:3477
873
  msgid "Weekly"
874
  msgstr ""
875
 
876
- #: subscribe2.php:3591 subscribe2.php:3592
877
  msgid "Author"
878
  msgstr ""
879
 
880
- #: subscribe2.php:3600
881
  msgid "Posted on"
882
  msgstr ""
883
 
884
- #: subscribe2.php:3604 subscribe2.php:3605
885
  msgid "Posted in"
886
  msgstr ""
887
 
888
- #: subscribe2.php:3610 subscribe2.php:3611
889
  msgid "Tagged as"
890
  msgstr ""
891
 
892
- #: subscribe2.php:3672
893
  msgid "Digest Email"
894
  msgstr ""
895
 
896
- #: subscribe2.php:3682
897
  msgid "Digest Preview"
898
  msgstr ""
899
 
900
- #: include/options.php:98
901
  msgid ""
902
  "BLOGNAME has posted a new item, 'TITLE'\n"
903
  "\n"
@@ -913,7 +949,7 @@ msgid ""
913
  "EMAIL"
914
  msgstr ""
915
 
916
- #: include/options.php:106
917
  msgid ""
918
  "BLOGNAME has received a request to ACTION for this email address. To "
919
  "complete your request please click on the link below:\n"
@@ -926,11 +962,11 @@ msgid ""
926
  "MYNAME."
927
  msgstr ""
928
 
929
- #: include/options.php:110
930
  msgid "Please confirm your request"
931
  msgstr ""
932
 
933
- #: include/options.php:114
934
  msgid ""
935
  "This email address was subscribed for notifications at BLOGNAME (BLOGLINK) "
936
  "but the subscription remains incomplete.\n"
@@ -946,7 +982,7 @@ msgid ""
946
  "MYNAME"
947
  msgstr ""
948
 
949
- #: include/options.php:118
950
  msgid "Subscription Reminder"
951
  msgstr ""
952
 
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2011-07-05 17:42+0100\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
17
  "Content-Type: text/plain; charset=CHARSET\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
 
20
+ #: subscribe2.php:36
21
  #, php-format
22
  msgid ""
23
  "This version of Subscribe2 requires WordPress 2.8 or greater. Please update "
24
  "%1$s or use an older version of %2$s."
25
  msgstr ""
26
 
27
+ #: subscribe2.php:41
28
+ #, php-format
29
+ msgid ""
30
+ "This version of Subscribe2 requires WordPress Multisite 3.0 or greater. "
31
+ "Please update %1$s or use an older version of %2$s."
32
+ msgstr ""
33
+
34
+ #: subscribe2.php:75
35
  msgid "To manage your subscription options please"
36
  msgstr ""
37
 
38
+ #: subscribe2.php:75
39
  msgid "login"
40
  msgstr ""
41
 
42
+ #: subscribe2.php:77 subscribe2.php:86
43
  msgid "You may manage your subscription options from your"
44
  msgstr ""
45
 
46
+ #: subscribe2.php:77 subscribe2.php:86
47
  msgid "profile"
48
  msgstr ""
49
 
50
+ #: subscribe2.php:82 subscribe2.php:91 subscribe2.php:1918 subscribe2.php:2017
51
+ #: subscribe2.php:2841 subscribe2.php:3515 subscribe2.php:3518
52
  #: include/widget.php:96
53
  msgid "Subscribe"
54
  msgstr ""
55
 
56
+ #: subscribe2.php:82 subscribe2.php:91
57
  msgid "to email notifications when this blog posts new content"
58
  msgstr ""
59
 
60
+ #: subscribe2.php:95
61
  msgid "A confirmation message is on its way!"
62
  msgstr ""
63
 
64
+ #: subscribe2.php:97
65
  msgid "That email address is already subscribed."
66
  msgstr ""
67
 
68
+ #: subscribe2.php:99
69
  msgid "That email address is not subscribed."
70
  msgstr ""
71
 
72
+ #: subscribe2.php:101
73
  msgid "Sorry, but that does not look like an email address to me."
74
  msgstr ""
75
 
76
+ #: subscribe2.php:103
77
  msgid ""
78
  "Sorry, email addresses at that domain are currently barred due to spam, "
79
  "please use an alternative email address."
80
  msgstr ""
81
 
82
+ #: subscribe2.php:105
83
  msgid ""
84
  "Sorry, there seems to be an error on the server. Please try again later."
85
  msgstr ""
86
 
87
+ #: subscribe2.php:107
88
  msgid "You must to create a WordPress page for this plugin to work correctly."
89
  msgstr ""
90
 
91
+ #: subscribe2.php:109
92
  msgid "Message sent!"
93
  msgstr ""
94
 
95
+ #: subscribe2.php:111
96
  msgid ""
97
  "Message failed! Check your settings and check with your hosting provider"
98
  msgstr ""
99
 
100
+ #: subscribe2.php:114
101
  msgid "No such email address is registered."
102
  msgstr ""
103
 
104
+ #: subscribe2.php:116
105
  msgid "You have successfully subscribed!"
106
  msgstr ""
107
 
108
+ #: subscribe2.php:118
109
  msgid "You have successfully unsubscribed."
110
  msgstr ""
111
 
112
+ #: subscribe2.php:120
113
  msgid "subscribe"
114
  msgstr ""
115
 
116
+ #: subscribe2.php:122
117
  msgid "unsubscribe"
118
  msgstr ""
119
 
120
+ #: subscribe2.php:125
121
  msgid "Options saved!"
122
  msgstr ""
123
 
124
+ #: subscribe2.php:126
125
  msgid "Options reset!"
126
  msgstr ""
127
 
128
+ #: subscribe2.php:134
129
  msgid "Subscribers"
130
  msgstr ""
131
 
132
+ #: subscribe2.php:137
133
  msgid "Subscribe2 Options"
134
  msgstr ""
135
 
136
+ #: subscribe2.php:137 subscribe2.php:3716 include/widget.php:17
137
  msgid "Subscribe2"
138
  msgstr ""
139
 
140
+ #: subscribe2.php:142
141
  msgid "Your Subscriptions"
142
  msgstr ""
143
 
144
+ #: subscribe2.php:146
145
  msgid "Mail Subscribers"
146
  msgstr ""
147
 
148
+ #: subscribe2.php:687
149
  msgid "Plain Text Excerpt Preview"
150
  msgstr ""
151
 
152
+ #: subscribe2.php:689
153
  msgid "Plain Text Full Preview"
154
  msgstr ""
155
 
156
+ #: subscribe2.php:691
157
  msgid "HTML Excerpt Preview"
158
  msgstr ""
159
 
160
+ #: subscribe2.php:693
161
  msgid "HTML Full Preview"
162
  msgstr ""
163
 
164
+ #: subscribe2.php:956
165
  msgid "New Subscription"
166
  msgstr ""
167
 
168
+ #: subscribe2.php:958
169
  msgid "subscribed to email notifications!"
170
  msgstr ""
171
 
172
+ #: subscribe2.php:994
173
  msgid "New Unsubscription"
174
  msgstr ""
175
 
176
+ #: subscribe2.php:996
177
  msgid "unsubscribed from email notifications!"
178
  msgstr ""
179
 
180
+ #: subscribe2.php:1726
181
  msgid "Address(es) subscribed!"
182
  msgstr ""
183
 
184
+ #: subscribe2.php:1733
185
  msgid "Address(es) unsubscribed!"
186
  msgstr ""
187
 
188
+ #: subscribe2.php:1737
189
  msgid "Some emails were not processed, the following were already subscribed"
190
  msgstr ""
191
 
192
+ #: subscribe2.php:1740
193
  msgid "Some emails were not processed, the following were not in the database"
194
  msgstr ""
195
 
196
+ #: subscribe2.php:1749
197
  msgid "Address(es) deleted!"
198
  msgstr ""
199
 
200
+ #: subscribe2.php:1755 subscribe2.php:1761
201
  msgid "Status changed!"
202
  msgstr ""
203
 
204
+ #: subscribe2.php:1775
205
  msgid "Reminder Email(s) Sent!"
206
  msgstr ""
207
 
208
+ #: subscribe2.php:1778
209
  msgid "Registered Users Subscribed!"
210
  msgstr ""
211
 
212
+ #: subscribe2.php:1781
213
  msgid "Registered Users Unsubscribed!"
214
  msgstr ""
215
 
216
+ #: subscribe2.php:1784
217
  msgid "Format updated for Selected Registered Users!"
218
  msgstr ""
219
 
220
+ #: subscribe2.php:1787
221
+ msgid "Digest Subscription updated for Selected Registered Users!"
222
+ msgstr ""
223
+
224
+ #: subscribe2.php:1882
225
  msgid "Previous Page"
226
  msgstr ""
227
 
228
+ #: subscribe2.php:1902
229
  msgid "Next Page"
230
  msgstr ""
231
 
232
+ #: subscribe2.php:1909
233
  msgid "Manage Subscribers"
234
  msgstr ""
235
 
236
+ #: subscribe2.php:1914
237
  msgid "Add/Remove Subscribers"
238
  msgstr ""
239
 
240
+ #: subscribe2.php:1915
241
  msgid "Enter addresses, one per line or comma-separated"
242
  msgstr ""
243
 
244
+ #: subscribe2.php:1919 subscribe2.php:2018 subscribe2.php:2820
245
+ #: subscribe2.php:3513 subscribe2.php:3518 include/widget.php:96
246
  msgid "Unsubscribe"
247
  msgstr ""
248
 
249
+ #: subscribe2.php:1922
250
  msgid "Current Subscribers"
251
  msgstr ""
252
 
253
+ #: subscribe2.php:1924
254
  msgid "Filter"
255
  msgstr ""
256
 
257
+ #: subscribe2.php:1930
258
  msgid "Search Subscribers"
259
  msgstr ""
260
 
261
+ #: subscribe2.php:1933
262
  msgid "Send Reminder Email"
263
  msgstr ""
264
 
265
+ #: subscribe2.php:1940
266
  msgid "Save Emails to CSV File"
267
  msgstr ""
268
 
269
+ #: subscribe2.php:1946 subscribe2.php:2004
270
  msgid "Process"
271
  msgstr ""
272
 
273
+ #: subscribe2.php:1959 subscribe2.php:1981
274
  msgid "Confirm this email address"
275
  msgstr ""
276
 
277
+ #: subscribe2.php:1961 subscribe2.php:1974
278
  msgid "Unconfirm this email address"
279
  msgstr ""
280
 
281
+ #: subscribe2.php:1963 subscribe2.php:1976 subscribe2.php:1984
282
  msgid "Delete this email address"
283
  msgstr ""
284
 
285
+ #: subscribe2.php:1967 subscribe2.php:2985
286
  msgid "Select / Unselect All"
287
  msgstr ""
288
 
289
+ #: subscribe2.php:1991
290
  msgid "edit"
291
  msgstr ""
292
 
293
+ #: subscribe2.php:1998
294
  msgid "No matching subscribers found"
295
  msgstr ""
296
 
297
+ #: subscribe2.php:2000
298
  msgid "NONE"
299
  msgstr ""
300
 
301
+ #: subscribe2.php:2012
302
+ msgid "Bulk Management"
303
  msgstr ""
304
 
305
+ #: subscribe2.php:2014 subscribe2.php:2030
306
  msgid ""
307
  "Preferences for Registered Users selected in the filter above can be changed "
308
  "using this section."
309
  msgstr ""
310
 
311
+ #: subscribe2.php:2015 subscribe2.php:2031
312
  msgid "Consider User Privacy as changes cannot be undone"
313
  msgstr ""
314
 
315
+ #: subscribe2.php:2016
316
  msgid "Action to perform"
317
  msgstr ""
318
 
319
+ #: subscribe2.php:2021
320
  msgid "Bulk Update Categories"
321
  msgstr ""
322
 
323
+ #: subscribe2.php:2023
324
  msgid "Send email as"
325
  msgstr ""
326
 
327
+ #: subscribe2.php:2024 subscribe2.php:2505 subscribe2.php:2691
328
  msgid "HTML - Full"
329
  msgstr ""
330
 
331
+ #: subscribe2.php:2025 subscribe2.php:2510 subscribe2.php:2696
332
  msgid "HTML - Excerpt"
333
  msgstr ""
334
 
335
+ #: subscribe2.php:2026 subscribe2.php:2515 subscribe2.php:2701
336
  msgid "Plain Text - Full"
337
  msgstr ""
338
 
339
+ #: subscribe2.php:2027 subscribe2.php:2520 subscribe2.php:2706
340
  msgid "Plain Text - Excerpt"
341
  msgstr ""
342
 
343
+ #: subscribe2.php:2028
344
  msgid "Bulk Update Format"
345
  msgstr ""
346
 
347
+ #: subscribe2.php:2032
348
+ msgid "Subscribe Selected Users to recieve a periodic digest notification"
349
+ msgstr ""
350
+
351
+ #: subscribe2.php:2034 subscribe2.php:2286 subscribe2.php:2298
352
+ #: subscribe2.php:2309 subscribe2.php:2320 subscribe2.php:2483
353
+ #: subscribe2.php:2494 subscribe2.php:2526 subscribe2.php:2542
354
+ #: subscribe2.php:2714 subscribe2.php:2750
355
+ msgid "Yes"
356
+ msgstr ""
357
+
358
+ #: subscribe2.php:2036 subscribe2.php:2291 subscribe2.php:2303
359
+ #: subscribe2.php:2314 subscribe2.php:2325 subscribe2.php:2477
360
+ #: subscribe2.php:2488 subscribe2.php:2499 subscribe2.php:2531
361
+ #: subscribe2.php:2547 subscribe2.php:2568 subscribe2.php:2719
362
+ #: subscribe2.php:2754
363
+ msgid "No"
364
+ msgstr ""
365
+
366
+ #: subscribe2.php:2038
367
+ msgid "Bulk Update Digest Subscription"
368
+ msgstr ""
369
+
370
+ #: subscribe2.php:2076
371
  msgid "Preview message(s) sent to logged in user"
372
  msgstr ""
373
 
374
+ #: subscribe2.php:2080
375
  msgid ""
376
  "The Digest Notification email contained no post information. No email was "
377
  "sent"
378
  msgstr ""
379
 
380
+ #: subscribe2.php:2082
381
  msgid "Attempt made to resend the Digest Notification email"
382
  msgstr ""
383
 
384
+ #: subscribe2.php:2237
385
  msgid "Subscribe2 Settings"
386
  msgstr ""
387
 
388
+ #: subscribe2.php:2238
389
  msgid "Plugin Blog"
390
  msgstr ""
391
 
392
+ #: subscribe2.php:2239
393
  msgid "Make a donation via PayPal"
394
  msgstr ""
395
 
396
+ #: subscribe2.php:2250 subscribe2.php:2674
397
  msgid "Notification Settings"
398
  msgstr ""
399
 
400
+ #: subscribe2.php:2251
401
  msgid "Restrict the number of recipients per email to (0 for unlimited)"
402
  msgstr ""
403
 
404
+ #: subscribe2.php:2253 subscribe2.php:2417
405
  msgid "Edit"
406
  msgstr ""
407
 
408
+ #: subscribe2.php:2256 subscribe2.php:2420
409
  msgid "Update"
410
  msgstr ""
411
 
412
+ #: subscribe2.php:2257 subscribe2.php:2421
413
  msgid "Revert"
414
  msgstr ""
415
 
416
+ #: subscribe2.php:2259
417
  msgid "Send Admins notifications for new"
418
  msgstr ""
419
 
420
+ #: subscribe2.php:2264
421
  msgid "Subscriptions"
422
  msgstr ""
423
 
424
+ #: subscribe2.php:2269
425
  msgid "Unsubscriptions"
426
  msgstr ""
427
 
428
+ #: subscribe2.php:2274
429
  msgid "Both"
430
  msgstr ""
431
 
432
+ #: subscribe2.php:2279
433
  msgid "Neither"
434
  msgstr ""
435
 
436
+ #: subscribe2.php:2281
437
  msgid "Include theme CSS stylesheet in HTML notifications"
438
  msgstr ""
439
 
440
+ #: subscribe2.php:2293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  msgid "Send Emails for Pages"
442
  msgstr ""
443
 
444
+ #: subscribe2.php:2304
445
  msgid "Send Emails for Password Protected Posts"
446
  msgstr ""
447
 
448
+ #: subscribe2.php:2315
449
  msgid "Send Emails for Private Posts"
450
  msgstr ""
451
 
452
+ #: subscribe2.php:2326
453
  msgid "Send Email From"
454
  msgstr ""
455
 
456
+ #: subscribe2.php:2331
457
  msgid "Send Emails"
458
  msgstr ""
459
 
460
+ #: subscribe2.php:2333
461
  msgid "For digest notifications, date order for posts is"
462
  msgstr ""
463
 
464
+ #: subscribe2.php:2338
465
  msgid "Descending"
466
  msgstr ""
467
 
468
+ #: subscribe2.php:2343
469
  msgid "Ascending"
470
  msgstr ""
471
 
472
+ #: subscribe2.php:2347
473
  msgid "Email Templates"
474
  msgstr ""
475
 
476
+ #: subscribe2.php:2351
477
  msgid "New Post email (must not be empty)"
478
  msgstr ""
479
 
480
+ #: subscribe2.php:2352 subscribe2.php:2382 subscribe2.php:2387
481
  msgid "Subject Line"
482
  msgstr ""
483
 
484
+ #: subscribe2.php:2357
485
  msgid "Send Email Preview"
486
  msgstr ""
487
 
488
+ #: subscribe2.php:2358
489
+ msgid "Message substitutions"
490
  msgstr ""
491
 
492
+ #: subscribe2.php:2360
493
  msgid ""
494
  "IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED"
495
  msgstr ""
496
 
497
+ #: subscribe2.php:2363
498
  msgid "the post's title<br />(<i>for per-post emails only</i>)"
499
  msgstr ""
500
 
501
+ #: subscribe2.php:2364
502
  msgid ""
503
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
504
  "preferences</i>)"
505
  msgstr ""
506
 
507
+ #: subscribe2.php:2365
508
  msgid ""
509
  "the excerpt of the post and the time it was posted<br />(<i>for digest "
510
  "emails only</i>)"
511
  msgstr ""
512
 
513
+ #: subscribe2.php:2366
514
  msgid "a list of post titles<br />(<i>for digest emails only</i>)"
515
  msgstr ""
516
 
517
+ #: subscribe2.php:2367
518
  msgid ""
519
  "a list of post titles followed by links to the atricles<br />(<i>for digest "
520
  "emails only</i>)"
521
  msgstr ""
522
 
523
+ #: subscribe2.php:2368
524
  msgid "the post's permalink<br />(<i>for per-post emails only</i>)"
525
  msgstr ""
526
 
527
+ #: subscribe2.php:2369
528
  msgid ""
529
  "the post's permalink after conversion by TinyURL<br />(<i>for per-post "
530
  "emails only</i>)"
531
  msgstr ""
532
 
533
+ #: subscribe2.php:2370
534
  msgid "the date the post was made<br />(<i>for per-post emails only</i>)"
535
  msgstr ""
536
 
537
+ #: subscribe2.php:2371
538
  msgid "the time the post was made<br />(<i>for per-post emails only</i>)"
539
  msgstr ""
540
 
541
+ #: subscribe2.php:2372
542
  msgid "the admin or post author's name"
543
  msgstr ""
544
 
545
+ #: subscribe2.php:2373
546
  msgid "the admin or post author's email"
547
  msgstr ""
548
 
549
+ #: subscribe2.php:2374
550
  msgid "the post author's name"
551
  msgstr ""
552
 
553
+ #: subscribe2.php:2375
554
  msgid ""
555
  "the generated link to confirm a request<br />(<i>only used in the "
556
  "confirmation email template</i>)"
557
  msgstr ""
558
 
559
+ #: subscribe2.php:2376
560
  msgid ""
561
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
562
  "confirmation email template</i>)"
563
  msgstr ""
564
 
565
+ #: subscribe2.php:2377
566
  msgid "the post's assigned categories"
567
  msgstr ""
568
 
569
+ #: subscribe2.php:2378
570
  msgid "the post's assigned Tags"
571
  msgstr ""
572
 
573
+ #: subscribe2.php:2379
574
  msgid ""
575
  "the number of posts included in the digest email<br />(<i>for digest emails "
576
  "only</i>)"
577
  msgstr ""
578
 
579
+ #: subscribe2.php:2381
580
  msgid "Subscribe / Unsubscribe confirmation email"
581
  msgstr ""
582
 
583
+ #: subscribe2.php:2386
584
  msgid "Reminder email to Unconfirmed Subscribers"
585
  msgstr ""
586
 
587
+ #: subscribe2.php:2393
588
  msgid "Excluded Categories"
589
  msgstr ""
590
 
591
+ #: subscribe2.php:2395
592
  msgid ""
593
  "Posts assigned to any Excluded Category do not generate notifications and "
594
  "are not included in digest notifications"
595
  msgstr ""
596
 
597
+ #: subscribe2.php:2402
598
  msgid "Allow registered users to subscribe to excluded categories?"
599
  msgstr ""
600
 
601
+ #: subscribe2.php:2405
602
  msgid "Appearance"
603
  msgstr ""
604
 
605
+ #: subscribe2.php:2409
606
  msgid "Set default Subscribe2 page as ID"
607
  msgstr ""
608
 
609
+ #: subscribe2.php:2415
610
  msgid "Set the number of Subscribers displayed per page"
611
  msgstr ""
612
 
613
+ #: subscribe2.php:2428
614
  msgid "Show a link to your subscription page in \"meta\"?"
615
  msgstr ""
616
 
617
+ #: subscribe2.php:2435
618
  msgid "Show the Subscribe2 button on the Write toolbar?"
619
  msgstr ""
620
 
621
+ #: subscribe2.php:2442
622
  msgid "Enable Subscribe2 Widget?"
623
  msgstr ""
624
 
625
+ #: subscribe2.php:2449
626
  msgid "Enable Subscribe2 Counter Widget?"
627
  msgstr ""
628
 
629
+ #: subscribe2.php:2456
630
  msgid "Disable email notifications is checked by default on authoring pages?"
631
  msgstr ""
632
 
633
+ #: subscribe2.php:2460
634
  msgid "Auto Subscribe"
635
  msgstr ""
636
 
637
+ #: subscribe2.php:2462
638
  msgid "Subscribe new users registering with your blog"
639
  msgstr ""
640
 
641
+ #: subscribe2.php:2467
642
  msgid "Automatically"
643
  msgstr ""
644
 
645
+ #: subscribe2.php:2472
646
  msgid "Display option on Registration Form"
647
  msgstr ""
648
 
649
+ #: subscribe2.php:2478
650
  msgid "Auto-subscribe includes any excluded categories"
651
  msgstr ""
652
 
653
+ #: subscribe2.php:2489
654
  msgid "Registration Form option is checked by default"
655
  msgstr ""
656
 
657
+ #: subscribe2.php:2500
658
  msgid "Auto-subscribe users to receive email as"
659
  msgstr ""
660
 
661
+ #: subscribe2.php:2521
662
  msgid "Registered Users have the option to auto-subscribe to new categories"
663
  msgstr ""
664
 
665
+ #: subscribe2.php:2536
666
  msgid "New categories are immediately excluded"
667
  msgstr ""
668
 
669
+ #: subscribe2.php:2537
670
  msgid ""
671
  "Option for Registered Users to auto-subscribe to new categories is checked "
672
  "by default"
673
  msgstr ""
674
 
675
+ #: subscribe2.php:2551
676
+ msgid "Display checkbox to allow subscriptions from the comment form"
677
+ msgstr ""
678
+
679
+ #: subscribe2.php:2557
680
+ msgid "Before the Comment Submit button"
681
+ msgstr ""
682
+
683
+ #: subscribe2.php:2563
684
+ msgid "After the Comment Submit button"
685
+ msgstr ""
686
+
687
+ #: subscribe2.php:2573
688
  msgid "Barred Domains"
689
  msgstr ""
690
 
691
+ #: subscribe2.php:2575
692
  msgid ""
693
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
694
  "each entry and omit the \"@\" symbol, for example email.com)"
695
  msgstr ""
696
 
697
+ #: subscribe2.php:2580
698
  msgid "Submit"
699
  msgstr ""
700
 
701
+ #: subscribe2.php:2583
702
  msgid "Reset Default"
703
  msgstr ""
704
 
705
+ #: subscribe2.php:2584
706
  msgid ""
707
  "Use this to reset all options to their defaults. This <strong><em>will not</"
708
  "em></strong> modify your list of subscribers."
709
  msgstr ""
710
 
711
+ #: subscribe2.php:2586
712
  msgid "RESET"
713
  msgstr ""
714
 
715
+ #: subscribe2.php:2668
716
  msgid "Subscription preferences updated."
717
  msgstr ""
718
 
719
+ #: subscribe2.php:2677
720
  msgid "Editing Subscribe2 preferences for user"
721
  msgstr ""
722
 
723
+ #: subscribe2.php:2686
724
  msgid "Receive email as"
725
  msgstr ""
726
 
727
+ #: subscribe2.php:2709
728
  msgid "Automatically subscribe me to newly created categories"
729
  msgstr ""
730
 
731
+ #: subscribe2.php:2730
732
  msgid "Unsubscribe me from this blog"
733
  msgstr ""
734
 
735
+ #: subscribe2.php:2734
736
  msgid "Subscribe to all categories"
737
  msgstr ""
738
 
739
+ #: subscribe2.php:2736
740
  msgid "Subscribed Categories on"
741
  msgstr ""
742
 
743
+ #: subscribe2.php:2738
744
  msgid "Subscribed Categories"
745
  msgstr ""
746
 
747
+ #: subscribe2.php:2744
748
  msgid "Receive periodic summaries of new posts?"
749
  msgstr ""
750
 
751
+ #: subscribe2.php:2759
752
  msgid "Update Preferences"
753
  msgstr ""
754
 
755
+ #: subscribe2.php:2809
756
  msgid "Subscribed Blogs"
757
  msgstr ""
758
 
759
+ #: subscribe2.php:2814 subscribe2.php:2835
760
  msgid "Viewing Settings Now"
761
  msgstr ""
762
 
763
+ #: subscribe2.php:2818 subscribe2.php:2839
764
  msgid "View Settings"
765
  msgstr ""
766
 
767
+ #: subscribe2.php:2830
768
  msgid "Subscribe to new blogs"
769
  msgstr ""
770
 
771
+ #: subscribe2.php:2906
772
  msgid "Send an email to subscribers"
773
  msgstr ""
774
 
775
+ #: subscribe2.php:2914
776
  msgid "A message from"
777
  msgstr ""
778
 
779
+ #: subscribe2.php:2919
780
  msgid "Subject"
781
  msgstr ""
782
 
783
+ #: subscribe2.php:2922
784
  msgid "Recipients:"
785
  msgstr ""
786
 
787
+ #: subscribe2.php:2926
788
  msgid "Preview"
789
  msgstr ""
790
 
791
+ #: subscribe2.php:2926
792
  msgid "Send"
793
  msgstr ""
794
 
795
+ #: subscribe2.php:3030
796
  msgid "All Users and Subscribers"
797
  msgstr ""
798
 
799
+ #: subscribe2.php:3031
800
  msgid "Public Subscribers"
801
  msgstr ""
802
 
803
+ #: subscribe2.php:3032
804
  msgid "Confirmed"
805
  msgstr ""
806
 
807
+ #: subscribe2.php:3033
808
  msgid "Unconfirmed"
809
  msgstr ""
810
 
811
+ #: subscribe2.php:3034
812
  msgid "All Registered Users"
813
  msgstr ""
814
 
815
+ #: subscribe2.php:3035
816
  msgid "Registered Subscribers"
817
  msgstr ""
818
 
819
+ #: subscribe2.php:3157
820
  msgid "For each Post"
821
  msgstr ""
822
 
823
+ #: subscribe2.php:3174
824
  msgid "Send Digest Notification at"
825
  msgstr ""
826
 
827
+ #: subscribe2.php:3186
828
  msgid ""
829
  "This option will be ignored if the time selected is not in the future in "
830
  "relation to the current time"
831
  msgstr ""
832
 
833
+ #: subscribe2.php:3189
834
  msgid "Current UTC time is"
835
  msgstr ""
836
 
837
+ #: subscribe2.php:3191
838
  msgid "Current blog time is"
839
  msgstr ""
840
 
841
+ #: subscribe2.php:3193
842
  msgid "Next email notification will be sent when your blog time is after"
843
  msgstr ""
844
 
845
+ #: subscribe2.php:3196
846
  msgid "Attempt to resend the last Digest Notification email"
847
  msgstr ""
848
 
849
+ #: subscribe2.php:3197
850
  msgid "Resend Digest"
851
  msgstr ""
852
 
853
+ #: subscribe2.php:3275
854
  msgid "Confirmed Public Subscriber"
855
  msgstr ""
856
 
857
+ #: subscribe2.php:3277
858
  msgid "Unconfirmed Public Subscriber"
859
  msgstr ""
860
 
861
+ #: subscribe2.php:3331
862
  msgid "Settings"
863
  msgstr ""
864
 
865
+ #: subscribe2.php:3332
866
  msgid "Donate"
867
  msgstr ""
868
 
869
+ #: subscribe2.php:3344
870
  msgid "Check here to Subscribe to email notifications for new posts"
871
  msgstr ""
872
 
873
+ #: subscribe2.php:3353
874
  msgid ""
875
  "By registering with this blog you are also agreeing to receive email "
876
  "notifications for new posts but you can unsubscribe at anytime"
877
  msgstr ""
878
 
879
+ #: subscribe2.php:3404 subscribe2.php:3405
880
  msgid "Subscribe2 Notification Override"
881
  msgstr ""
882
 
883
+ #: subscribe2.php:3415
884
  msgid ""
885
  "Check here to disable sending of an email notification for this post/page"
886
  msgstr ""
887
 
888
+ #: subscribe2.php:3450
889
+ msgid "Check here to Subscribe to notifications for new posts"
890
+ msgstr ""
891
+
892
+ #: subscribe2.php:3525
893
  msgid "Your email:"
894
  msgstr ""
895
 
896
+ #: subscribe2.php:3525
897
  msgid "Enter email address..."
898
  msgstr ""
899
 
900
+ #: subscribe2.php:3633
901
  msgid "Subscription Confirmation"
902
  msgstr ""
903
 
904
+ #: subscribe2.php:3700
905
  msgid "[Un]Subscribe to Posts"
906
  msgstr ""
907
 
908
+ #: subscribe2.php:3751
909
  msgid "Weekly"
910
  msgstr ""
911
 
912
+ #: subscribe2.php:3865 subscribe2.php:3866
913
  msgid "Author"
914
  msgstr ""
915
 
916
+ #: subscribe2.php:3874
917
  msgid "Posted on"
918
  msgstr ""
919
 
920
+ #: subscribe2.php:3878 subscribe2.php:3879
921
  msgid "Posted in"
922
  msgstr ""
923
 
924
+ #: subscribe2.php:3884 subscribe2.php:3885
925
  msgid "Tagged as"
926
  msgstr ""
927
 
928
+ #: subscribe2.php:3946
929
  msgid "Digest Email"
930
  msgstr ""
931
 
932
+ #: subscribe2.php:3956
933
  msgid "Digest Preview"
934
  msgstr ""
935
 
936
+ #: include/options.php:110
937
  msgid ""
938
  "BLOGNAME has posted a new item, 'TITLE'\n"
939
  "\n"
949
  "EMAIL"
950
  msgstr ""
951
 
952
+ #: include/options.php:118
953
  msgid ""
954
  "BLOGNAME has received a request to ACTION for this email address. To "
955
  "complete your request please click on the link below:\n"
962
  "MYNAME."
963
  msgstr ""
964
 
965
+ #: include/options.php:122
966
  msgid "Please confirm your request"
967
  msgstr ""
968
 
969
+ #: include/options.php:126
970
  msgid ""
971
  "This email address was subscribed for notifications at BLOGNAME (BLOGLINK) "
972
  "but the subscription remains incomplete.\n"
982
  "MYNAME"
983
  msgstr ""
984
 
985
+ #: include/options.php:130
986
  msgid "Subscription Reminder"
987
  msgstr ""
988
 
uninstall.php CHANGED
@@ -2,7 +2,7 @@
2
  if( !defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
3
  exit();
4
  } else {
5
- global $wpdb, $table_prefix;
6
  // get name of subscribe2 table
7
  $public = $table_prefix . "subscribe2";
8
  // delete entry from wp_options table
@@ -14,14 +14,16 @@ if( !defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
14
  // delete usermeta data for registered users
15
  $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
16
  if ( !empty($users) ) {
17
- foreach ( $users as $user ) {
18
- $cats = explode(',', get_usermeta($user, 's2_subscribed'));
19
  if ($cats) {
20
  foreach ($cats as $cat) {
21
- delete_usermeta($user, "s2_cat" . $cat);
22
  }
23
  }
24
- delete_usermeta($user, 's2_subscribed');
 
 
25
  }
26
  }
27
  // drop the subscribe2 table
2
  if( !defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
3
  exit();
4
  } else {
5
+ global $wpdb, $table_prefix, $mysubscribe2;
6
  // get name of subscribe2 table
7
  $public = $table_prefix . "subscribe2";
8
  // delete entry from wp_options table
14
  // delete usermeta data for registered users
15
  $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
16
  if ( !empty($users) ) {
17
+ foreach ( $users as $user_ID ) {
18
+ $cats = explode(',', $mysubscribe2->get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed')));
19
  if ($cats) {
20
  foreach ($cats as $cat) {
21
+ $mysubscribe2->delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat);
22
  }
23
  }
24
+ $mysubscribe2->delete_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'));
25
+ $mysubscribe2->delete_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_format'));
26
+ $mysubscribe2->delete_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_autosub'));
27
  }
28
  }
29
  // drop the subscribe2 table