Subscribe2 - Version 8.4

Version Description

Download this release

Release Info

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

Code changes from version 8.3 to 8.4

ReadMe.txt CHANGED
@@ -3,8 +3,9 @@ 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: 3.1
6
- Tested up to: 3.3.1
7
- Stable tag: 8.3
8
9
Sends a list of subscribers an email notification when new posts are published to your blog
10
@@ -28,26 +29,28 @@ If you want to send full content HTML emails to Public Subscribers too then upgr
28
== Installation ==
29
30
AUTOMATIC INSTALLATION
31
1. Log in to your WordPress blog and visit Plugins->Add New.
32
- 1. Search for Subscribe2, click "Install Now" and then Activate the Plugin
33
- 1. Click the "Settings" admin menu link, and select "Subscribe2".
34
- 1. Configure the options to taste, including the email template and any categories which should be excluded from notification
35
- 1. Click the "Tools" admin menu link, and select "Subscribers".
36
- 1. Manually subscribe people as you see fit.
37
- 1. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the subscribe2 token. Or, if you prefer, you may manually insert the subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
38
This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
39
- 1. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
40
41
MANUAL INSTALLATION
42
1. Copy the entire /subscribe2/ directory into your /wp-content/plugins/ directory.
43
- 1. Activate the plugin.
44
- 1. Click the "Settings" admin menu link, and select "Subscribe2".
45
- 1. Configure the options to taste, including the email template and any categories which should be excluded from notification
46
- 1. Click the "Tools" admin menu link, and select "Subscribers".
47
- 1. Manually subscribe people as you see fit.
48
- 1. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the subscribe2 token. Or, if you prefer, you may manually insert the subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
49
This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
50
- 1. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
51
52
== Frequently Asked Questions ==
53
@@ -303,6 +306,17 @@ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correc
303
304
== Changelog ==
305
306
= Version 8.3 by Matthew Robinson =
307
308
* Fixed a bunch of PHP messages - should not show anyway unless WP_DEBUG is true or PHP error reporting is on a high setting
@@ -314,7 +328,7 @@ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correc
314
* Fixed implode error seen when sending preview emails on some configurations
315
* Fixed a error in the admin user dropdown on installs (particularly Multisite) where there may be no administrator level users
316
* Added a button text filter for the Subscribe and Unsubscribe buttons - proposed by casben79
317
- * Use wp_hash in place of MD5 to further obfuscate confirmation links - thanks to Otto and Ipstenu
318
319
= Version 8.2 by Matthew Robinson =
320
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: 3.1
6
+ Tested up to: 3.4
7
+ Stable tag: 8.4
8
+ License: GPL3
9
10
Sends a list of subscribers an email notification when new posts are published to your blog
11
29
== Installation ==
30
31
AUTOMATIC INSTALLATION
32
+
33
1. Log in to your WordPress blog and visit Plugins->Add New.
34
+ 2. Search for Subscribe2, click "Install Now" and then Activate the Plugin
35
+ 3. Click the "Settings" admin menu link, and select "Subscribe2".
36
+ 4. Configure the options to taste, including the email template and any categories which should be excluded from notification
37
+ 5. Click the "Tools" admin menu link, and select "Subscribers".
38
+ 6. Manually subscribe people as you see fit.
39
+ 7. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the subscribe2 token. Or, if you prefer, you may manually insert the subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
40
This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
41
+ 8. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
42
43
MANUAL INSTALLATION
44
+
45
1. Copy the entire /subscribe2/ directory into your /wp-content/plugins/ directory.
46
+ 2. Activate the plugin.
47
+ 3. Click the "Settings" admin menu link, and select "Subscribe2".
48
+ 4. Configure the options to taste, including the email template and any categories which should be excluded from notification
49
+ 5. Click the "Tools" admin menu link, and select "Subscribers".
50
+ 6. Manually subscribe people as you see fit.
51
+ 7. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the subscribe2 token. Or, if you prefer, you may manually insert the subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
52
This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
53
+ 8. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
54
55
== Frequently Asked Questions ==
56
306
307
== Changelog ==
308
309
+ = Version 8.4 by Matthew Robinson =
310
+
311
+ * Fixed an error in the 'Send Mail' page that blocked emails from being sent
312
+ * Added tracking features to Digest title links in HTML version - thanks to Jeremy Schultz
313
+ * Provide clearer user feedback for Send and Preview buttons in "Send Email" window
314
+ * Add new option to the Widget to return users to the home page on submission
315
+ * Added warning to Settings page if selected sender email address is "off-domain"
316
+ * Fixed numerous minor SQL injections vectors - thanks to Tom Adams (holizz)
317
+ * Removed auto-embed iframes from HTML emails - thanks to Doug Lerner
318
+ * Add more intuitive user messages for Public Subscribers when Unsubscribing - thanks to Doug Lerner
319
+
320
= Version 8.3 by Matthew Robinson =
321
322
* Fixed a bunch of PHP messages - should not show anyway unless WP_DEBUG is true or PHP error reporting is on a high setting
328
* Fixed implode error seen when sending preview emails on some configurations
329
* Fixed a error in the admin user dropdown on installs (particularly Multisite) where there may be no administrator level users
330
* Added a button text filter for the Subscribe and Unsubscribe buttons - proposed by casben79
331
+ * Use wp_hash in place of MD5 to further obfuscate confirmation links - thanks to Charlie Eriksen, Otto and Ipstenu
332
333
= Version 8.2 by Matthew Robinson =
334
admin/send_email.php CHANGED
@@ -7,7 +7,7 @@ global $wpdb, $s2nonce, $current_user;
7
8
// was anything POSTed?
9
if ( isset($_POST['s2_admin']) && 'mail' == $_POST['s2_admin'] ) {
10
- check_admin_referer('subscribe2-write_subscribers', $s2nonce);
11
$subject = html_entity_decode($this->substitute(stripslashes(strip_tags($_POST['subject']))), ENT_QUOTES);
12
$body = $this->substitute(stripslashes($_POST['content']));
13
if ( '' != $current_user->display_name || '' != $current_user->user_email ) {
@@ -37,7 +37,11 @@ if ( isset($_POST['s2_admin']) && 'mail' == $_POST['s2_admin'] ) {
37
}
38
$status = $this->mail($recipients, $subject, $body, 'text');
39
if ( $status ) {
40
- $message = $this->mail_sent;
41
} elseif ( empty($body) ) {
42
$message = __('Your email was empty', 'subscribe2');
43
} else {
@@ -53,7 +57,7 @@ echo "<div id=\"icon-edit\" class=\"icon32\"></div>";
53
echo "<h2>" . __('Send an email to subscribers', 'subscribe2') . "</h2>\r\n";
54
echo "<form method=\"post\" action=\"\">\r\n";
55
if ( function_exists('wp_nonce_field') ) {
56
- wp_nonce_field('subscribe2-write_subscribers', $s2nonce);
57
}
58
if ( isset($_POST['subject']) ) {
59
$subject = stripslashes(esc_html($_POST['subject']));
7
8
// was anything POSTed?
9
if ( isset($_POST['s2_admin']) && 'mail' == $_POST['s2_admin'] ) {
10
+ check_admin_referer('subscribe2-write_subscribers' . $s2nonce);
11
$subject = html_entity_decode($this->substitute(stripslashes(strip_tags($_POST['subject']))), ENT_QUOTES);
12
$body = $this->substitute(stripslashes($_POST['content']));
13
if ( '' != $current_user->display_name || '' != $current_user->user_email ) {
37
}
38
$status = $this->mail($recipients, $subject, $body, 'text');
39
if ( $status ) {
40
+ if ( isset($_POST['preview']) ) {
41
+ $message = "<p class=\"s2_message\">" . __('Preview message sent!', 'subscribe2') . "</p>";
42
+ } else {
43
+ $message = $this->mail_sent;
44
+ }
45
} elseif ( empty($body) ) {
46
$message = __('Your email was empty', 'subscribe2');
47
} else {
57
echo "<h2>" . __('Send an email to subscribers', 'subscribe2') . "</h2>\r\n";
58
echo "<form method=\"post\" action=\"\">\r\n";
59
if ( function_exists('wp_nonce_field') ) {
60
+ wp_nonce_field('subscribe2-write_subscribers' . $s2nonce);
61
}
62
if ( isset($_POST['subject']) ) {
63
$subject = stripslashes(esc_html($_POST['subject']));
admin/settings.php CHANGED
@@ -12,6 +12,12 @@ if ( empty($id) ) {
12
echo "<div id=\"message\" class=\"error\"><p><strong>$this->no_page</strong></p></div>";
13
}
14
15
// was anything POSTed?
16
if ( isset( $_POST['s2_admin']) ) {
17
check_admin_referer('subscribe2-options_subscribers' . $s2nonce);
12
echo "<div id=\"message\" class=\"error\"><p><strong>$this->no_page</strong></p></div>";
13
}
14
15
+ $sender = $this->get_userdata($this->subscribe2_options['sender']);
16
+ list($user, $domain) = explode('@', $sender->user_email, 2);
17
+ if ( !strstr($_SERVER['SERVER_NAME'], $domain) ) {
18
+ echo "<div id=\"message\" class=\"error\"><p><strong>" . __('You appear to be sending notifications from an email address from a different domain name to your blog, this may result in failed emails', 'subscribe2') . "</strong></p></div>";
19
+ }
20
+
21
// was anything POSTed?
22
if ( isset( $_POST['s2_admin']) ) {
23
check_admin_referer('subscribe2-options_subscribers' . $s2nonce);
admin/your_subscriptions.php CHANGED
@@ -7,7 +7,7 @@ global $user_ID, $s2nonce;
7
8
if ( isset($_GET['email']) ) {
9
global $wpdb;
10
- $user_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '" . urldecode($_GET['email']) . "'");
11
} else {
12
get_currentuserinfo();
13
}
7
8
if ( isset($_GET['email']) ) {
9
global $wpdb;
10
+ $user_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_email = %s", urldecode($_GET['email'])));
11
} else {
12
get_currentuserinfo();
13
}
classes/class-s2-admin.php CHANGED
@@ -1,746 +1,746 @@
1
- <?php
2
- class s2_admin extends s2class {
3
- /* ===== WordPress menu registration and scripts ===== */
4
- /**
5
- Hook the menu
6
- */
7
- function admin_menu() {
8
- add_menu_page (__('Subscribe2', 'subscribe2'), __('Subscribe2', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', NULL, S2URL . 'include/email_edit.png');
9
-
10
- $s2user = add_submenu_page('s2', __('Your Subscriptions', 'subscribe2'), __('Your Subscriptions', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', array(&$this, 'user_menu'), S2URL . 'include/email_edit.png');
11
- add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
12
- add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
13
-
14
- $s2subscribers = add_submenu_page('s2', __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
15
- add_action("admin_print_scripts-$s2subscribers", array(&$this, 'checkbox_form_js'));
16
-
17
- $s2settings = add_submenu_page('s2', __('Settings', 'subscribe2'), __('Settings', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'settings'), 's2_settings', array(&$this, 'settings_menu'));
18
- add_action("admin_print_scripts-$s2settings", array(&$this, 'checkbox_form_js'));
19
- add_action("admin_print_scripts-$s2settings", array(&$this, 'option_form_js'));
20
- add_filter('plugin_row_meta', array(&$this, 'plugin_links'), 10, 2);
21
-
22
- add_submenu_page('s2', __('Send Email', 'subscribe2'), __('Send Email', 'subscribe2'), apply_filters('s2_capability', "publish_posts", 'send'), 's2_posts', array(&$this, 'write_menu'));
23
-
24
- $s2nonce = wp_hash('subscribe2');
25
- } // end admin_menu()
26
-
27
- /**
28
- Hook for Admin Drop Down Icons
29
- */
30
- function ozh_s2_icon() {
31
- return S2URL . 'include/email_edit.png';
32
- } // end ozh_s2_icon()
33
-
34
- /**
35
- Insert Javascript and CSS into admin_header
36
- */
37
- function checkbox_form_js() {
38
- wp_register_script('s2_checkbox', S2URL . 'include/s2_checkbox' . $this->script_debug . '.js', array('jquery'), '1.1');
39
- wp_enqueue_script('s2_checkbox');
40
- } //end checkbox_form_js()
41
-
42
- function user_admin_css() {
43
- wp_register_style('s2_user_admin', S2URL . 'include/s2_user_admin.css', array(), '1.0');
44
- wp_enqueue_style('s2_user_admin');
45
- } // end user_admin_css()
46
-
47
- function option_form_js() {
48
- wp_register_script('s2_edit', S2URL . 'include/s2_edit' . $this->script_debug . '.js', array('jquery'), '1.0');
49
- wp_enqueue_script('s2_edit');
50
- } // end option_form_js()
51
-
52
- /**
53
- Adds a links directly to the settings page from the plugin page
54
- */
55
- function plugin_links($links, $file) {
56
- if ( $file == S2DIR.'subscribe2.php' ) {
57
- $links[] = "<a href='admin.php?page=s2_settings'>" . __('Settings', 'subscribe2') . "</a>";
58
- $links[] = "<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904'><b>" . __('Donate', 'subscribe2') . "</b></a>";
59
- }
60
- return $links;
61
- } // end plugin_links()
62
-
63
- /* ===== Menus ===== */
64
- /**
65
- Our subscriber management page
66
- */
67
- function subscribers_menu() {
68
- require_once(S2PATH . 'admin/subscribers.php');
69
- } // end subscribers_menu()
70
-
71
- /**
72
- Our settings page
73
- */
74
- function settings_menu() {
75
- require_once(S2PATH . 'admin/settings.php');
76
- } // end settings_menu()
77
-
78
- /**
79
- Our profile menu
80
- */
81
- function user_menu() {
82
- require_once(S2PATH . 'admin/your_subscriptions.php');
83
- } // end user_menu()
84
-
85
- /**
86
- Display the Write sub-menu
87
- */
88
- function write_menu() {
89
- require_once(S2PATH . 'admin/send_email.php');
90
- } // end write_menu()
91
-
92
- /* ===== Write Toolbar Button Functions ===== */
93
- /**
94
- Register our button in the QuickTags bar
95
- */
96
- function button_init() {
97
- global $pagenow;
98
- if ( !in_array($pagenow, array('post-new.php', 'post.php', 'page-new.php', 'page.php')) ) { return; }
99
- if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) { return; }
100
- if ( 'true' == get_user_option('rich_editing') ) {
101
- // Hook into the rich text editor
102
- add_filter('mce_external_plugins', array(&$this, 'mce3_plugin'));
103
- add_filter('mce_buttons', array(&$this, 'mce3_button'));
104
- } else {
105
- if ( version_compare($this->wp_release, '3.3', '<') ) {
106
- wp_enqueue_script('subscribe2_button', S2URL . 'include/s2_button' . $this->script_debug . '.js', array('quicktags'), '1.0' );
107
- } else {
108
- // use QTags.addButton for WordPress 3.3 and greater
109
- wp_enqueue_script('subscribe2_button', S2URL . 'include/s2_button2' . $this->script_debug . '.js', array('quicktags'), '2.0' );
110
- }
111
- }
112
- } // end button_init()
113
-
114
- /**
115
- Add buttons for Rich Text Editor
116
- */
117
- function mce3_plugin($arr) {
118
- $path = S2URL . 'tinymce3/editor_plugin' . $this->script_debug . '.js';
119
- $arr['subscribe2'] = $path;
120
- return $arr;
121
- } // end mce3_plugin()
122
-
123
- function mce3_button($arr) {
124
- $arr[] = 'subscribe2';
125
- return $arr;
126
- } // end mce3_button()
127
-
128
- /* ===== widget functions ===== */
129
- /**
130
- Function to add css and js files to admin header
131
- */
132
- function widget_s2counter_css_and_js() {
133
- // ensure we only add colorpicker js to widgets page
134
- if ( stripos($_SERVER['REQUEST_URI'], 'widgets.php' ) !== false ) {
135
- wp_enqueue_style('farbtastic');
136
- wp_enqueue_script('farbtastic');
137
- wp_register_script('s2_colorpicker', S2URL . 'include/s2_colorpicker' . $this->script_debug . '.js', array('farbtastic'), '1.0'); //my js
138
- wp_enqueue_script('s2_colorpicker');
139
- }
140
- } // end widget_s2_counter_css_and_js()
141
-
142
- /* ===== meta box functions to allow per-post override ===== */
143
- /**
144
- Create meta box on write pages
145
- */
146
- function s2_meta_init() {
147
- add_meta_box('subscribe2', __('Subscribe2 Notification Override', 'subscribe2' ), array(&$this, 's2_meta_box'), 'post', 'advanced');
148
- add_meta_box('subscribe2', __('Subscribe2 Notification Override', 'subscribe2' ), array(&$this, 's2_meta_box'), 'page', 'advanced');
149
- } // end s2_meta_init()
150
-
151
- /**
152
- Meta box code
153
- */
154
- function s2_meta_box() {
155
- global $post_ID;
156
- $s2mail = get_post_meta($post_ID, 's2mail', true);
157
- echo "<input type=\"hidden\" name=\"s2meta_nonce\" id=\"s2meta_nonce\" value=\"" . wp_create_nonce(wp_hash(plugin_basename(__FILE__))) . "\" />";
158
- echo __("Check here to disable sending of an email notification for this post/page", 'subscribe2');
159
- echo "&nbsp;&nbsp;<input type=\"checkbox\" name=\"s2_meta_field\" value=\"no\"";
160
- if ( $s2mail == 'no' || ($this->subscribe2_options['s2meta_default'] == "1" && $s2mail == "") ) {
161
- echo " checked=\"checked\"";
162
- }
163
- echo " />";
164
- } // end s2_meta_box()
165
-
166
- /**
167
- Meta box form handler
168
- */
169
- function s2_meta_handler($post_id) {
170
- if ( !isset($_POST['s2meta_nonce']) || !wp_verify_nonce($_POST['s2meta_nonce'], wp_hash(plugin_basename(__FILE__))) ) { return $post_id; }
171
-
172
- if ( 'page' == $_POST['post_type'] ) {
173
- if ( !current_user_can('edit_page', $post_id) ) { return $post_id; }
174
- } else {
175
- if ( !current_user_can('edit_post', $post_id) ) { return $post_id; }
176
- }
177
-
178
- if ( isset($_POST['s2_meta_field']) && $_POST['s2_meta_field'] == 'no' ) {
179
- update_post_meta($post_id, 's2mail', $_POST['s2_meta_field']);
180
- } else {
181
- update_post_meta($post_id, 's2mail', 'yes');
182
- }
183
- } // end s2_meta_box_handler()
184
-
185
- /* ===== WordPress menu helper functions ===== */
186
- /**
187
- Display a table of categories with checkboxes
188
- Optionally pre-select those categories specified
189
- */
190
- function display_category_form($selected = array(), $override = 1) {
191
- global $wpdb;
192
-
193
- if ( $override == 0 ) {
194
- $all_cats = $this->all_cats(true);
195
- } else {
196
- $all_cats = $this->all_cats(false);
197
- }
198
-
199
- $half = (count($all_cats) / 2);
200
- $i = 0;
201
- $j = 0;
202
- echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
203
- echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
204
- echo "<label><input type=\"checkbox\" name=\"checkall\" value=\"checkall_cat\" /> " . __('Select / Unselect All', 'subscribe2') . "</label>\r\n";
205
- echo "</td></tr>\r\n";
206
- echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
207
- foreach ( $all_cats as $cat ) {
208
- if ( $i >= $half && 0 == $j ){
209
- echo "</td><td width=\"50%\" align=\"left\">\r\n";
210
- $j++;
211
- }
212
- $catName = '';
213
- $parents = array_reverse( get_ancestors($cat->term_id, $cat->taxonomy) );
214
- if ( $parents ) {
215
- foreach ( $parents as $parent ) {
216
- $parent = get_term($parent, $cat->taxonomy);
217
- $catName .= $parent->name . ' &raquo; ';
218
- }
219
- }
220
- $catName .= $cat->name;
221
-
222
- if ( 0 == $j ) {
223
- echo "<label><input class=\"checkall_cat\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
224
- if ( in_array($cat->term_id, $selected) ) {
225
- echo " checked=\"checked\"";
226
- }
227
- echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
228
- } else {
229
- echo "<label><input class=\"checkall_cat\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
230
- if ( in_array($cat->term_id, $selected) ) {
231
- echo " checked=\"checked\"";
232
- }
233
- echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
234
- }
235
- $i++;
236
- }
237
- echo "</td></tr>\r\n";
238
- echo "</table>\r\n";
239
- } // end display_category_form()
240
-
241
- /**
242
- Display a table of post formats supported by the currently active theme
243
- */
244
- function display_format_form($formats, $selected = array()) {
245
- $half = (count($formats[0]) / 2);
246
- $i = 0;
247
- $j = 0;
248
- echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
249
- echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
250
- echo "<label><input type=\"checkbox\" name=\"checkall\" value=\"checkall_format\" /> " . __('Select / Unselect All', 'subscribe2') . "</label>\r\n";
251
- echo "</td></tr>\r\n";
252
- echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
253
- foreach ( $formats[0] as $format ) {
254
- if ( $i >= $half && 0 == $j ){
255
- echo "</td><td width=\"50%\" align=\"left\">\r\n";
256
- $j++;
257
- }
258
-
259
- if ( 0 == $j ) {
260
- echo "<label><input class=\"checkall_format\" type=\"checkbox\" name=\"format[]\" value=\"" . $format . "\"";
261
- if ( in_array($format, $selected) ) {
262
- echo " checked=\"checked\"";
263
- }
264
- echo " /> " . ucwords($format) . "</label><br />\r\n";
265
- } else {
266
- echo "<label><input class=\"checkall_format\" type=\"checkbox\" name=\"format[]\" value=\"" . $format . "\"";
267
- if ( in_array($format, $selected) ) {
268
- echo " checked=\"checked\"";
269
- }
270
- echo " /> " . ucwords($format) . "</label><br />\r\n";
271
- }
272
- $i++;
273
- }
274
- echo "</td></tr>\r\n";
275
- echo "</table>\r\n";
276
- } // end display_format_form()
277
-
278
- /**
279
- Display a table of authors with checkboxes
280
- Optionally pre-select those authors specified
281
- */
282
- function display_author_form($selected = array()) {
283
- $all_authors = $this->get_authors();
284
-
285
- $half = (count($all_authors) / 2);
286
- $i = 0;
287
- $j = 0;
288
- echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
289
- echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
290
- echo "<label><input type=\"checkbox\" name=\"checkall\" value=\"checkall_author\" /> " . __('Select / Unselect All', 'subscribe2') . "</label>\r\n";
291
- echo "</td></tr>\r\n";
292
- echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
293
- foreach ( $all_authors as $author ) {
294
- if ( $i >= $half && 0 == $j ) {
295
- echo "</td><td width=\"50%\" align=\"left\">\r\n";
296
- $j++;
297
- }
298
- if ( 0 == $j ) {
299
- echo "<label><input class=\"checkall_author\" type=\"checkbox\" name=\"author[]\" value=\"" . $author->ID . "\"";
300
- if ( in_array($author->ID, $selected) ) {
301
- echo " checked=\"checked\"";
302
- }
303
- echo " /> " . $author->display_name . "</label><br />\r\n";
304
- } else {
305
- echo "<label><input class=\"checkall_author\" type=\"checkbox\" name=\"author[]\" value=\"" . $author->ID . "\"";
306
- if ( in_array($author->ID, $selected) ) {
307
- echo " checked=\"checked\"";
308
- }
309
- echo " /> " . $author->display_name . "</label><br />\r\n";
310
- $i++;
311
- }
312
- }
313
- echo "</td></tr>\r\n";
314
- echo "</table>\r\n";
315
- } // end display_author_form()
316
-
317
- /**
318
- Collect an array of all author level users and above
319
- */
320
- function get_authors() {
321
- if ( '' == $this->all_authors ) {
322
- $role = array('fields' => array('ID', 'display_name'), 'role' => 'administrator');
323
- $administrators = get_users( $role );
324
- $role = array('fields' => array('ID', 'display_name'), 'role' => 'editor');
325
- $editors = get_users( $role );
326
- $role = array('fields' => array('ID', 'display_name'), 'role' => 'author');
327
- $authors = get_users( $role );
328
-
329
- $this->all_authors = array_merge($administrators, $editors, $authors);
330
- }
331
- return apply_filters('s2_authors', $this->all_authors);
332
- } // end get_authors()
333
-
334
- /**
335
- Display a drop-down form to select subscribers
336
- $selected is the option to select
337
- $submit is the text to use on the Submit button
338
- */
339
- function display_subscriber_dropdown($selected = 'registered', $submit = '', $exclude = array()) {
340
- global $wpdb;
341
-
342
- $who = array('all' => __('All Users and Subscribers', 'subscribe2'),
343
- 'public' => __('Public Subscribers', 'subscribe2'),
344
- 'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
345
- 'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
346
- 'all_users' => __('All Registered Users', 'subscribe2'),
347
- 'registered' => __('Registered Subscribers', 'subscribe2'));
348
-
349
- $all_cats = $this->all_cats(false);
350
-
351
- // count the number of subscribers
352
- $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
353
- $count['unconfirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='0'");
354
- if ( in_array('unconfirmed', $exclude) ) {
355
- $count['public'] = $count['confirmed'];
356
- } elseif ( in_array('confirmed', $exclude) ) {
357
- $count['public'] = $count['unconfirmed'];
358
- } else {
359
- $count['public'] = ($count['confirmed'] + $count['unconfirmed']);
360
- }
361
- if ( $this->s2_mu ) {
362
- $count['all_users'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities'");
363
- } else {
364
- $count['all_users'] = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
365
- }
366
- if ( $this->s2_mu ) {
367
- $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities' AND meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'");
368
- } else {
369
- $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'");
370
- }
371
- $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['all_users']);
372
- // get subscribers to individual categories but only if we are using per-post notifications
373
- if ( $this->subscribe2_options['email_freq'] == 'never' ) {
374
- if ( $this->s2_mu ) {
375
- foreach ( $all_cats as $cat ) {
376
- $count[$cat->name] = $wpdb->get_var("SELECT COUNT(a.meta_key) FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id WHERE a.meta_key='" . $wpdb->prefix . "capabilities' AND b.meta_key='" . $this->get_usermeta_keyname('s2_cat') . $cat->term_id . "'");
377
- }
378
- } else {
379
- foreach ( $all_cats as $cat ) {
380
- $count[$cat->name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_cat') . $cat->term_id . "'");
381
- }
382
- }
383
- }
384
-
385
- // do have actually have some subscribers?
386
- if ( 0 == $count['confirmed'] && 0 == $count['unconfirmed'] && 0 == $count['all_users'] ) {
387
- // no? bail out
388
- return;
389
- }
390
-
391
- echo "<select name=\"what\">\r\n";
392
- foreach ( $who as $whom => $display ) {
393
- if ( in_array($whom, $exclude) ) { continue; }
394
- if ( 0 == $count[$whom] ) { continue; }
395
-
396
- echo "<option value=\"" . $whom . "\"";
397
- if ( $whom == $selected ) { echo " selected=\"selected\" "; }
398
- echo ">$display (" . ($count[$whom]) . ")</option>\r\n";
399
- }
400
-
401
- if ( $count['registered'] > 0 && $this->subscribe2_options['email_freq'] == 'never' ) {
402
- foreach ( $all_cats as $cat ) {
403
- if ( in_array($cat->term_id, $exclude) ) { continue; }
404
- echo "<option value=\"" . $cat->term_id . "\"";
405
- if ( $cat->term_id == $selected ) { echo " selected=\"selected\" "; }
406
- echo "> &nbsp;&nbsp;" . $cat->name . "&nbsp;(" . $count[$cat->name] . ") </option>\r\n";
407
- }
408
- }
409
- echo "</select>";
410
- if ( false !== $submit ) {
411
- echo "&nbsp;<input type=\"submit\" class=\"button-secondary\" value=\"$submit\" />\r\n";
412
- }
413
- } // end display_subscriber_dropdown()
414
-
415
- /**
416
- Display a drop down list of administrator level users and
417
- optionally include a choice for Post Author
418
- */
419
- function admin_dropdown($inc_author = false) {
420
- global $wpdb;
421
-
422
- $args = array('fields' => array('ID', 'display_name'), 'role' => 'administrator');
423
- $wp_user_query = get_users( $args );
424
- if ( !empty($wp_user_query) ) {
425
- foreach ($wp_user_query as $user) {
426
- $admins[] = $user;
427
- }
428
- } else {
429
- $admins = array();
430
- }
431
-
432
- if ( $inc_author ) {
433
- $author[] = (object)array('ID' => 'author', 'display_name' => __('Post Author', 'subscribe2'));
434
- $author[] = (object)array('ID' => 'blogname', 'display_name' => html_entity_decode(get_option('blogname'), ENT_QUOTES));
435
- $admins = array_merge($author, $admins);
436
- }
437
-
438
- echo "<select name=\"sender\">\r\n";
439
- foreach ( $admins as $admin ) {
440
- echo "<option value=\"" . $admin->ID . "\"";
441
- if ( $admin->ID == $this->subscribe2_options['sender'] ) {
442
- echo " selected=\"selected\"";
443
- }
444
- echo ">" . $admin->display_name . "</option>\r\n";
445
- }
446
- echo "</select>\r\n";
447
- } // end admin_dropdown()
448
-
449
- /**
450
- Display a dropdown of choices for digest email frequency
451
- and give user details of timings when event is scheduled
452
- */
453
- function display_digest_choices() {
454
- global $wpdb;
455
- $cron_file = ABSPATH . 'wp-cron.php';
456
- if ( !is_readable($cron_file) ) {
457
- echo "<strong><em style=\"color: red\">" . __('The WordPress cron functions may be disabled on this server. Digest notifications may not work.', 'subscribe2') . "</em></strong><br />\r\n";
458
- }
459
- $scheduled_time = wp_next_scheduled('s2_digest_cron');
460
- $schedule = (array)wp_get_schedules();
461
- $schedule = array_merge(array('never' => array('interval' => 0, 'display' => __('For each Post', 'subscribe2'))), $schedule);
462
- $sort = array();
463
- foreach ( (array)$schedule as $key => $value ) {
464
- $sort[$key] = $value['interval'];
465
- }
466
- asort($sort);
467
- $schedule_sorted = array();
468
- foreach ( $sort as $key => $value ) {
469
- $schedule_sorted[$key] = $schedule[$key];
470
- }
471
- foreach ( $schedule_sorted as $key => $value ) {
472
- echo "<label><input type=\"radio\" name=\"email_freq\" value=\"" . $key . "\"" . checked($this->subscribe2_options['email_freq'], $key, false) . " />";
473
- echo " " . $value['display'] . "</label><br />\r\n";
474
- }
475
- echo "<br />" . __('Send Digest Notification at', 'subscribe2') . ": \r\n";
476
- $hours = array('12am', '1am', '2am', '3am', '4am', '5am', '6am', '7am', '8am', '9am', '10am', '11am', '12pm', '1pm', '2pm', '3pm', '4pm', '5pm', '6pm', '7pm', '8pm', '9pm', '10pm', '11pm');
477
- echo "<select name=\"hour\">\r\n";
478
- while ( $hour = current($hours) ) {
479
- echo "<option value=\"" . key($hours) . "\"";
480
- if ( key($hours) == date('H', $scheduled_time) && !empty($scheduled_time) ){
481
- echo " selected=\"selected\"";
482
- }
483
- echo ">" . $hour . "</option>\r\n";
484
- next($hours);
485
- }
486
- echo "</select>\r\n";
487
- echo "<strong><em style=\"color: red\">" . __('This option will be ignored if the time selected is not in the future in relation to the current time', 'subscribe2') . "</em></strong>\r\n";
488
- if ( $scheduled_time ) {
489
- $datetime = get_option('date_format') . ' @ ' . get_option('time_format');
490
- echo "<p>" . __('Current UTC time is', 'subscribe2') . ": \r\n";
491
- echo "<strong>" . date_i18n($datetime, false, 'gmt') . "</strong></p>\r\n";
492
- echo "<p>" . __('Current blog time is', 'subscribe2') . ": \r\n";
493
- echo "<strong>" . date_i18n($datetime) . "</strong></p>\r\n";
494
- echo "<p>" . __('Next email notification will be sent when your blog time is after', 'subscribe2') . ": \r\n";
495
- echo "<strong>" . date_i18n($datetime, $scheduled_time) . "</strong></p>\r\n";
496
- if ( !empty($this->subscribe2_options['previous_s2cron']) ) {
497
- echo "<p>" . __('Attempt to resend the last Digest Notification email', 'subscribe2') . ": ";
498
- echo "<input type=\"submit\" class=\"button-secondary\" name=\"resend\" value=\"" . __('Resend Digest', 'subscribe2') . "\" /></p>\r\n";
499
- }
500
- } else {
501
- echo "<br />";
502
- }
503
- } // end display_digest_choices()
504
-
505
- /**
506
- Create and display a dropdown list of pages
507
- */
508
- function pages_dropdown($s2page) {
509
- global $wpdb;
510
- $sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
511
- $pages = $wpdb->get_results($sql);
512
-
513
- if ( empty($pages) ) { return; }
514
-
515
- $option = '';
516
- foreach ( $pages as $page ) {
517
- $option .= "<option value=\"" . $page->ID . "\"";
518
- if ( $page->ID == $s2page ) {
519
- $option .= " selected=\"selected\"";
520
- }
521
- $option .= ">" . $page->post_title . "</option>\r\n";
522
- }
523
-
524
- echo $option;
525
- } // end pages_dropdown()
526
-
527
- /**
528
- Subscribe all registered users to category selected on Admin Manage Page
529
- */
530
- function subscribe_registered_users($emails = '', $cats = array()) {
531
- if ( '' == $emails || '' == $cats ) { return false; }
532
- global $wpdb;
533
-
534
- $useremails = explode(",\r\n", $emails);
535
- $useremails = implode("', '", $useremails);
536
-
537
- $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
538
- $user_IDs = $wpdb->get_col($sql);
539
-
540
- foreach ( $user_IDs as $user_ID ) {
541
- $old_cats = get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true);
542
- if ( !empty($old_cats) ) {
543
- $old_cats = explode(',', $old_cats);
544
- $newcats = array_unique(array_merge($cats, $old_cats));
545
- } else {
546
- $newcats = $cats;
547
- }
548
- if ( !empty($newcats) ) {
549
- // add subscription to these cat IDs
550
- foreach ( $newcats as $id ) {
551
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id, $id);
552
- }
553
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $newcats));
554
- }
555
- unset($newcats);
556
- }
557
- } // end subscribe_registered_users()
558
-
559
- /**
560
- Unsubscribe all registered users to category selected on Admin Manage Page
561
- */
562
- function unsubscribe_registered_users($emails = '', $cats = array()) {
563
- if ( '' == $emails || '' == $cats ) { return false; }
564
- global $wpdb;
565
-
566
- $useremails = explode(",\r\n", $emails);
567
- $useremails = "'" . implode("', '", $useremails) . "'";
568
-
569
- $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)";
570
- $user_IDs = $wpdb->get_col($sql);
571
-
572
- foreach ( $user_IDs as $user_ID ) {
573
- $old_cats = explode(',', get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true));
574
- $remain = array_diff($old_cats, $cats);
575
- if ( !empty($remain) ) {
576
- // remove subscription to these cat IDs and update s2_subscribed
577
- foreach ( $cats as $id ) {
578
- delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
579
- }
580
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
581
- } else {
582
- // remove subscription to these cat IDs and update s2_subscribed to ''
583
- foreach ( $cats as $id ) {
584
- delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
585
- }
586
- delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
587
- }
588
- unset($remain);
589
- }
590
- } // end unsubscribe_registered_users()
591
-
592
- /**
593
- Handles bulk changes to email format for Registered Subscribers
594
- */
595
- function format_change($format, $subscribers_string) {
596
- if ( empty($format) ) { return; }
597
-
598
- global $wpdb;
599
- $subscribers = explode(",\r\n", $subscribers_string);
600
- $emails = "'" . implode("', '", $subscribers) . "'";
601
- $ids = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_email IN ($emails)");
602
- $ids = implode(',', $ids);
603
- $sql = "UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND user_id IN ($ids)";
604
- $wpdb->get_results($sql);
605
- } // end format_change()
606
-
607
- /**
608
- Handles bulk update to digest preferences
609
- */
610
- function digest_change($digest, $emails) {
611
- if ( empty($digest) ) { return; }
612
-
613
- global $wpdb;
614
- $useremails = explode(",\r\n", $emails);
615
- $useremails = "'" . implode("', '", $useremails) . "'";
616
-
617
- $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)";
618
- $user_IDs = $wpdb->get_col($sql);
619
-
620
- if ( $digest == 'digest' ) {
621
- $exclude = explode(',', $this->subscribe2_options['exclude']);
622
- if ( !empty($exclude) ) {
623
- $all_cats = $this->all_cats(true, 'ID');
624
- } else {
625
- $all_cats = $this->all_cats(false, 'ID');
626
- }
627
-
628
- $cats_string = '';
629
- foreach ( $all_cats as $cat ) {
630
- ('' == $cats_string) ? $cats_string = "$cat->term_id" : $cats_string .= ",$cat->term_id";
631
- }
632
-
633
- foreach ( $user_IDs as $user_ID ) {
634
- foreach ( $all_cats as $cat ) {
635
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat->term_id, $cat->term_id);
636
- }
637
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats_string);
638
- }
639
- } elseif ( $digest == '-1' ) {
640
- foreach ( $user_IDs as $user_ID ) {
641
- $cats = explode(',', get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true));
642
- foreach ( $cats as $id ) {
643
- delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
644
- }
645
- delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
646
- }
647
- }
648
- } // end digest_change()
649
-
650
- /* ===== functions to handle addition and removal of WordPress categories ===== */
651
- /**
652
- Autosubscribe registered users to newly created categories
653
- if registered user has selected this option
654
- */
655
- function new_category($new_category='') {
656
- if ( 'no' == $this->subscribe2_options['show_autosub'] ) { return; }
657
- // don't subscribe to individual new categories if we are doing digest emails
658
- if ( $this->subscribe2_options['email_freq'] != 'never' ) { return; }
659
- global $wpdb;
660
-
661
- if ( 'yes' == $this->subscribe2_options['show_autosub'] ) {
662
- if ( $this->s2_mu ) {
663
- $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') . "'";
664
- } else {
665
- $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'";
666
- }
667
- $user_IDs = $wpdb->get_col($sql);
668
- if ( '' == $user_IDs ) { return; }
669
-
670
- foreach ( $user_IDs as $user_ID ) {
671
- $old_cats = get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true);
672
- if ( empty($old_cats) ) {
673
- $newcats = (array)$new_category;
674
- } else {
675
- $old_cats = explode(',', $old_cats);
676
- $newcats = array_merge($old_cats, (array)$new_category);
677
- }
678
- // add subscription to these cat IDs
679
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $new_category, $new_category);
680
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $newcats));
681
- }
682
- } elseif ( 'exclude' == $this->subscribe2_options['show_autosub'] ) {
683
- $excluded_cats = explode(',', $this->subscribe2_options['exclude']);
684
- $excluded_cats[] = $new_category;
685
- $this->subscribe2_options['exclude'] = implode(',', $excluded_cats);
686
- update_option('subscribe2_options', $this->subscribe2_options);
687
- }
688
- } // end new_category()
689
-
690
- /**
691
- Automatically delete subscriptions to a category when it is deleted
692
- */
693
- function delete_category($deleted_category='') {
694
- global $wpdb;
695
-
696
- if ( $this->s2_mu ) {
697
- $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') . "'";
698
- } else {
699
- $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$deleted_category'";
700
- }
701
- $user_IDs = $wpdb->get_col($sql);
702
- if ( '' == $user_IDs ) { return; }
703
-
704
- foreach ( $user_IDs as $user_ID ) {
705
- $old_cats = explode(',', get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true));
706
- if ( !is_array($old_cats) ) {
707
- $old_cats = array($old_cats);
708
- }
709
- // add subscription to these cat IDs
710
- delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $deleted_category);
711
- $remain = array_diff($old_cats, (array)$deleted_category);
712
- update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
713
- }
714
- } // end delete_category()
715
-
716
- /* ===== functions to show & handle one-click subscription ===== */
717
- /**
718
- Show form for one-click subscription on user profile page
719
- */
720
- function one_click_profile_form($user) {
721
- echo "<h3>" . __('Email subscription', 'subscribe2') . "</h3>\r\n";
722
- echo "<table class=\"form-table\">\r\n";
723
- echo "<tr><th scope=\"row\">" . __('Subscribe / Unsubscribe', 'subscribe2') . "</th>\r\n";
724
- echo "<td><label><input type=\"checkbox\" name=\"sub2-one-click-subscribe\" value=\"1\" " . checked( ! get_user_meta($user->ID, $this->get_usermeta_keyname('s2_subscribed'), true), false, false ) . " /> " . __('Receive notifications', 'subscribe2') . "</label><br />\r\n";
725
- echo "<span class=\"description\">" . __('Check if you want to receive email notification when new posts are published', 'subscribe2') . "</span>\r\n";
726
- echo "</td></tr></table>\r\n";
727
- } // end one_click_profile_form()
728
-
729
- /**
730
- Handle submission from profile one-click subscription
731
- */
732
- function one_click_profile_form_save($user_ID) {
733
- if ( !current_user_can( 'edit_user', $user_ID ) ) {
734
- return false;
735
- }
736
-
737
- if ( isset( $_POST['sub2-one-click-subscribe'] ) && 1 == $_POST['sub2-one-click-subscribe'] ) {
738
- // Subscribe
739
- $this->one_click_handler($user_ID, 'subscribe');
740
- } else {
741
- // Unsubscribe
742
- $this->one_click_handler($user_ID, 'unsubscribe');
743
- }
744
- } // end one_click_profile_form_save()
745
- }
746
?>
1
+ <?php
2
+ class s2_admin extends s2class {
3
+ /* ===== WordPress menu registration and scripts ===== */
4
+ /**
5
+ Hook the menu
6
+ */
7
+ function admin_menu() {
8
+ add_menu_page (__('Subscribe2', 'subscribe2'), __('Subscribe2', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', NULL, S2URL . 'include/email_edit.png');
9
+
10
+ $s2user = add_submenu_page('s2', __('Your Subscriptions', 'subscribe2'), __('Your Subscriptions', 'subscribe2'), apply_filters('s2_capability', "read", 'user'), 's2', array(&$this, 'user_menu'), S2URL . 'include/email_edit.png');
11
+ add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
12
+ add_action("admin_print_styles-$s2user", array(&$this, 'user_admin_css'));
13
+
14
+ $s2subscribers = add_submenu_page('s2', __('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'manage'), 's2_tools', array(&$this, 'subscribers_menu'));
15
+ add_action("admin_print_scripts-$s2subscribers", array(&$this, 'checkbox_form_js'));
16
+
17
+ $s2settings = add_submenu_page('s2', __('Settings', 'subscribe2'), __('Settings', 'subscribe2'), apply_filters('s2_capability', "manage_options", 'settings'), 's2_settings', array(&$this, 'settings_menu'));
18
+ add_action("admin_print_scripts-$s2settings", array(&$this, 'checkbox_form_js'));
19
+ add_action("admin_print_scripts-$s2settings", array(&$this, 'option_form_js'));
20
+ add_filter('plugin_row_meta', array(&$this, 'plugin_links'), 10, 2);
21
+
22
+ add_submenu_page('s2', __('Send Email', 'subscribe2'), __('Send Email', 'subscribe2'), apply_filters('s2_capability', "publish_posts", 'send'), 's2_posts', array(&$this, 'write_menu'));
23
+
24
+ $s2nonce = wp_hash('subscribe2');
25
+ } // end admin_menu()
26
+
27
+ /**
28
+ Hook for Admin Drop Down Icons
29
+ */
30
+ function ozh_s2_icon() {
31
+ return S2URL . 'include/email_edit.png';
32
+ } // end ozh_s2_icon()
33
+
34
+ /**
35
+ Insert Javascript and CSS into admin_header
36
+ */
37
+ function checkbox_form_js() {
38
+ wp_register_script('s2_checkbox', S2URL . 'include/s2_checkbox' . $this->script_debug . '.js', array('jquery'), '1.1');
39
+ wp_enqueue_script('s2_checkbox');
40
+ } //end checkbox_form_js()
41
+
42
+ function user_admin_css() {
43
+ wp_register_style('s2_user_admin', S2URL . 'include/s2_user_admin.css', array(), '1.0');
44
+ wp_enqueue_style('s2_user_admin');
45
+ } // end user_admin_css()
46
+
47
+ function option_form_js() {
48
+ wp_register_script('s2_edit', S2URL . 'include/s2_edit' . $this->script_debug . '.js', array('jquery'), '1.0');
49
+ wp_enqueue_script('s2_edit');
50
+ } // end option_form_js()
51
+
52
+ /**
53
+ Adds a links directly to the settings page from the plugin page
54
+ */
55
+ function plugin_links($links, $file) {
56
+ if ( $file == S2DIR.'subscribe2.php' ) {
57
+ $links[] = "<a href='admin.php?page=s2_settings'>" . __('Settings', 'subscribe2') . "</a>";
58
+ $links[] = "<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904'><b>" . __('Donate', 'subscribe2') . "</b></a>";
59
+ }
60
+ return $links;
61
+ } // end plugin_links()
62
+
63
+ /* ===== Menus ===== */
64
+ /**
65
+ Our subscriber management page
66
+ */
67
+ function subscribers_menu() {
68
+ require_once(S2PATH . 'admin/subscribers.php');
69
+ } // end subscribers_menu()
70
+
71
+ /**
72
+ Our settings page
73
+ */
74
+ function settings_menu() {
75
+ require_once(S2PATH . 'admin/settings.php');
76
+ } // end settings_menu()
77
+
78
+ /**
79
+ Our profile menu
80
+ */
81
+ function user_menu() {
82
+ require_once(S2PATH . 'admin/your_subscriptions.php');
83
+ } // end user_menu()
84
+
85
+ /**
86
+ Display the Write sub-menu
87
+ */
88
+ function write_menu() {
89
+ require_once(S2PATH . 'admin/send_email.php');
90
+ } // end write_menu()
91
+
92
+ /* ===== Write Toolbar Button Functions ===== */
93
+ /**
94
+ Register our button in the QuickTags bar
95
+ */
96
+ function button_init() {
97
+ global $pagenow;
98
+ if ( !in_array($pagenow, array('post-new.php', 'post.php', 'page-new.php', 'page.php')) ) { return; }
99
+ if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) { return; }
100
+ if ( 'true' == get_user_option('rich_editing') ) {
101
+ // Hook into the rich text editor
102
+ add_filter('mce_external_plugins', array(&$this, 'mce3_plugin'));
103
+ add_filter('mce_buttons', array(&$this, 'mce3_button'));
104
+ } else {
105
+ if ( version_compare($this->wp_release, '3.3', '<') ) {
106
+ wp_enqueue_script('subscribe2_button', S2URL . 'include/s2_button' . $this->script_debug . '.js', array('quicktags'), '1.0' );
107
+ } else {
108
+ // use QTags.addButton for WordPress 3.3 and greater
109
+ wp_enqueue_script('subscribe2_button', S2URL . 'include/s2_button2' . $this->script_debug . '.js', array('quicktags'), '2.0' );
110
+ }
111
+ }
112
+ } // end button_init()
113
+
114
+ /**
115
+ Add buttons for Rich Text Editor
116
+ */
117
+ function mce3_plugin($arr) {
118
+ $path = S2URL . 'tinymce3/editor_plugin' . $this->script_debug . '.js';
119
+ $arr['subscribe2'] = $path;
120
+ return $arr;
121
+ } // end mce3_plugin()
122
+
123
+ function mce3_button($arr) {
124
+ $arr[] = 'subscribe2';
125
+ return $arr;
126
+ } // end mce3_button()
127
+
128
+ /* ===== widget functions ===== */
129
+ /**
130
+ Function to add css and js files to admin header
131
+ */
132
+ function widget_s2counter_css_and_js() {
133
+ // ensure we only add colorpicker js to widgets page
134
+ if ( stripos($_SERVER['REQUEST_URI'], 'widgets.php' ) !== false ) {
135
+ wp_enqueue_style('farbtastic');
136
+ wp_enqueue_script('farbtastic');
137
+ wp_register_script('s2_colorpicker', S2URL . 'include/s2_colorpicker' . $this->script_debug . '.js', array('farbtastic'), '1.0'); //my js
138
+ wp_enqueue_script('s2_colorpicker');
139
+ }
140
+ } // end widget_s2_counter_css_and_js()
141
+
142
+ /* ===== meta box functions to allow per-post override ===== */
143
+ /**
144
+ Create meta box on write pages
145
+ */
146
+ function s2_meta_init() {
147
+ add_meta_box('subscribe2', __('Subscribe2 Notification Override', 'subscribe2' ), array(&$this, 's2_meta_box'), 'post', 'advanced');
148
+ add_meta_box('subscribe2', __('Subscribe2 Notification Override', 'subscribe2' ), array(&$this, 's2_meta_box'), 'page', 'advanced');
149
+ } // end s2_meta_init()
150
+
151
+ /**
152
+ Meta box code
153
+ */
154
+ function s2_meta_box() {
155
+ global $post_ID;
156
+ $s2mail = get_post_meta($post_ID, 's2mail', true);
157
+ echo "<input type=\"hidden\" name=\"s2meta_nonce\" id=\"s2meta_nonce\" value=\"" . wp_create_nonce(wp_hash(plugin_basename(__FILE__))) . "\" />";
158
+ echo __("Check here to disable sending of an email notification for this post/page", 'subscribe2');
159
+ echo "&nbsp;&nbsp;<input type=\"checkbox\" name=\"s2_meta_field\" value=\"no\"";
160
+ if ( $s2mail == 'no' || ($this->subscribe2_options['s2meta_default'] == "1" && $s2mail == "") ) {
161
+ echo " checked=\"checked\"";
162
+ }
163
+ echo " />";
164
+ } // end s2_meta_box()
165
+
166
+ /**
167
+ Meta box form handler
168
+ */
169
+ function s2_meta_handler($post_id) {
170
+ if ( !isset($_POST['s2meta_nonce']) || !wp_verify_nonce($_POST['s2meta_nonce'], wp_hash(plugin_basename(__FILE__))) ) { return $post_id; }
171
+
172
+ if ( 'page' == $_POST['post_type'] ) {
173
+ if ( !current_user_can('edit_page', $post_id) ) { return $post_id; }
174
+ } else {
175
+ if ( !current_user_can('edit_post', $post_id) ) { return $post_id; }
176
+ }
177
+
178
+ if ( isset($_POST['s2_meta_field']) && $_POST['s2_meta_field'] == 'no' ) {
179
+ update_post_meta($post_id, 's2mail', $_POST['s2_meta_field']);
180
+ } else {
181
+ update_post_meta($post_id, 's2mail', 'yes');
182
+ }
183
+ } // end s2_meta_box_handler()
184
+
185
+ /* ===== WordPress menu helper functions ===== */
186
+ /**
187
+ Display a table of categories with checkboxes
188
+ Optionally pre-select those categories specified
189
+ */
190
+ function display_category_form($selected = array(), $override = 1) {
191
+ global $wpdb;
192
+
193
+ if ( $override == 0 ) {
194
+ $all_cats = $this->all_cats(true);
195
+ } else {
196
+ $all_cats = $this->all_cats(false);
197
+ }
198
+
199
+ $half = (count($all_cats) / 2);
200
+ $i = 0;
201
+ $j = 0;
202
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
203
+ echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
204
+ echo "<label><input type=\"checkbox\" name=\"checkall\" value=\"checkall_cat\" /> " . __('Select / Unselect All', 'subscribe2') . "</label>\r\n";
205
+ echo "</td></tr>\r\n";
206
+ echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
207
+ foreach ( $all_cats as $cat ) {
208
+ if ( $i >= $half && 0 == $j ){
209
+ echo "</td><td width=\"50%\" align=\"left\">\r\n";
210
+ $j++;
211
+ }
212
+ $catName = '';
213
+ $parents = array_reverse( get_ancestors($cat->term_id, $cat->taxonomy) );
214
+ if ( $parents ) {
215
+ foreach ( $parents as $parent ) {
216
+ $parent = get_term($parent, $cat->taxonomy);
217
+ $catName .= $parent->name . ' &raquo; ';
218
+ }
219
+ }
220
+ $catName .= $cat->name;
221
+
222
+ if ( 0 == $j ) {
223
+ echo "<label><input class=\"checkall_cat\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
224
+ if ( in_array($cat->term_id, $selected) ) {
225
+ echo " checked=\"checked\"";
226
+ }
227
+ echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
228
+ } else {
229
+ echo "<label><input class=\"checkall_cat\" type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
230
+ if ( in_array($cat->term_id, $selected) ) {
231
+ echo " checked=\"checked\"";
232
+ }
233
+ echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
234
+ }
235
+ $i++;
236
+ }
237
+ echo "</td></tr>\r\n";
238
+ echo "</table>\r\n";
239
+ } // end display_category_form()
240
+
241
+ /**
242
+ Display a table of post formats supported by the currently active theme
243
+ */
244
+ function display_format_form($formats, $selected = array()) {
245
+ $half = (count($formats[0]) / 2);
246
+ $i = 0;
247
+ $j = 0;
248
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
249
+ echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
250
+ echo "<label><input type=\"checkbox\" name=\"checkall\" value=\"checkall_format\" /> " . __('Select / Unselect All', 'subscribe2') . "</label>\r\n";
251
+ echo "</td></tr>\r\n";
252
+ echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
253
+ foreach ( $formats[0] as $format ) {
254
+ if ( $i >= $half && 0 == $j ){
255
+ echo "</td><td width=\"50%\" align=\"left\">\r\n";
256
+ $j++;
257
+ }
258
+
259
+ if ( 0 == $j ) {
260
+ echo "<label><input class=\"checkall_format\" type=\"checkbox\" name=\"format[]\" value=\"" . $format . "\"";
261
+ if ( in_array($format, $selected) ) {
262
+ echo " checked=\"checked\"";
263
+ }
264
+ echo " /> " . ucwords($format) . "</label><br />\r\n";
265
+ } else {
266
+ echo "<label><input class=\"checkall_format\" type=\"checkbox\" name=\"format[]\" value=\"" . $format . "\"";
267
+ if ( in_array($format, $selected) ) {
268
+ echo " checked=\"checked\"";
269
+ }
270
+ echo " /> " . ucwords($format) . "</label><br />\r\n";
271
+ }
272
+ $i++;
273
+ }
274
+ echo "</td></tr>\r\n";
275
+ echo "</table>\r\n";
276
+ } // end display_format_form()
277
+
278
+ /**
279
+ Display a table of authors with checkboxes
280
+ Optionally pre-select those authors specified
281
+ */
282
+ function display_author_form($selected = array()) {
283
+ $all_authors = $this->get_authors();
284
+
285
+ $half = (count($all_authors) / 2);
286
+ $i = 0;
287
+ $j = 0;
288
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
289
+ echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
290
+ echo "<label><input type=\"checkbox\" name=\"checkall\" value=\"checkall_author\" /> " . __('Select / Unselect All', 'subscribe2') . "</label>\r\n";
291
+ echo "</td></tr>\r\n";
292
+ echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
293
+ foreach ( $all_authors as $author ) {
294
+ if ( $i >= $half && 0 == $j ) {
295
+ echo "</td><td width=\"50%\" align=\"left\">\r\n";
296
+ $j++;
297
+ }
298
+ if ( 0 == $j ) {
299
+ echo "<label><input class=\"checkall_author\" type=\"checkbox\" name=\"author[]\" value=\"" . $author->ID . "\"";
300
+ if ( in_array($author->ID, $selected) ) {
301
+ echo " checked=\"checked\"";
302
+ }
303
+ echo " /> " . $author->display_name . "</label><br />\r\n";
304
+ } else {
305
+ echo "<label><input class=\"checkall_author\" type=\"checkbox\" name=\"author[]\" value=\"" . $author->ID . "\"";
306
+ if ( in_array($author->ID, $selected) ) {
307
+ echo " checked=\"checked\"";
308
+ }
309
+ echo " /> " . $author->display_name . "</label><br />\r\n";
310
+ $i++;
311
+ }
312
+ }
313
+ echo "</td></tr>\r\n";
314
+ echo "</table>\r\n";
315
+ } // end display_author_form()
316
+
317
+ /**
318
+ Collect an array of all author level users and above
319
+ */
320
+ function get_authors() {
321
+ if ( '' == $this->all_authors ) {
322
+ $role = array('fields' => array('ID', 'display_name'), 'role' => 'administrator');
323
+ $administrators = get_users( $role );
324
+ $role = array('fields' => array('ID', 'display_name'), 'role' => 'editor');
325
+ $editors = get_users( $role );
326
+ $role = array('fields' => array('ID', 'display_name'), 'role' => 'author');
327
+ $authors = get_users( $role );
328
+
329
+ $this->all_authors = array_merge($administrators, $editors, $authors);
330
+ }
331
+ return apply_filters('s2_authors', $this->all_authors);
332
+ } // end get_authors()
333
+
334
+ /**
335
+ Display a drop-down form to select subscribers
336
+ $selected is the option to select
337
+ $submit is the text to use on the Submit button
338
+ */
339
+ function display_subscriber_dropdown($selected = 'registered', $submit = '', $exclude = array()) {
340
+ global $wpdb;
341
+
342
+ $who = array('all' => __('All Users and Subscribers', 'subscribe2'),
343
+ 'public' => __('Public Subscribers', 'subscribe2'),
344
+ 'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
345
+ 'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
346
+ 'all_users' => __('All Registered Users', 'subscribe2'),
347
+ 'registered' => __('Registered Subscribers', 'subscribe2'));
348
+
349
+ $all_cats = $this->all_cats(false);
350
+
351
+ // count the number of subscribers
352
+ $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
353
+ $count['unconfirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='0'");
354
+ if ( in_array('unconfirmed', $exclude) ) {
355
+ $count['public'] = $count['confirmed'];
356
+ } elseif ( in_array('confirmed', $exclude) ) {
357
+ $count['public'] = $count['unconfirmed'];
358
+ } else {
359
+ $count['public'] = ($count['confirmed'] + $count['unconfirmed']);
360
+ }
361
+ if ( $this->s2_mu ) {
362
+ $count['all_users'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities'");
363
+ } else {
364
+ $count['all_users'] = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
365
+ }
366
+ if ( $this->s2_mu ) {
367
+ $count['registered'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities' AND meta_key=%s", $this->get_usermeta_keyname('s2_subscribed')));
368
+ } else {
369
+ $count['registered'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key=%s", $this->get_usermeta_keyname('s2_subscribed')));
370
+ }
371
+ $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['all_users']);
372
+ // get subscribers to individual categories but only if we are using per-post notifications
373
+ if ( $this->subscribe2_options['email_freq'] == 'never' ) {
374
+ if ( $this->s2_mu ) {
375
+ foreach ( $all_cats as $cat ) {
376
+ $count[$cat->name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(a.meta_key) FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id WHERE a.meta_key='" . $wpdb->prefix . "capabilities' AND b.meta_key=%s", $this->get_usermeta_keyname('s2_cat') . $cat->term_id));
377
+ }
378
+ } else {
379
+ foreach ( $all_cats as $cat ) {
380
+ $count[$cat->name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key=%s", $this->get_usermeta_keyname('s2_cat') . $cat->term_id));
381
+ }
382
+ }
383
+ }
384
+
385
+ // do have actually have some subscribers?
386
+ if ( 0 == $count['confirmed'] && 0 == $count['unconfirmed'] && 0 == $count['all_users'] ) {
387
+ // no? bail out
388
+ return;
389
+ }
390
+
391
+ echo "<select name=\"what\">\r\n";
392
+ foreach ( $who as $whom => $display ) {
393
+ if ( in_array($whom, $exclude) ) { continue; }
394
+ if ( 0 == $count[$whom] ) { continue; }
395
+
396
+ echo "<option value=\"" . $whom . "\"";
397
+ if ( $whom == $selected ) { echo " selected=\"selected\" "; }
398
+ echo ">$display (" . ($count[$whom]) . ")</option>\r\n";
399
+ }
400
+
401
+ if ( $count['registered'] > 0 && $this->subscribe2_options['email_freq'] == 'never' ) {
402
+ foreach ( $all_cats as $cat ) {
403
+ if ( in_array($cat->term_id, $exclude) ) { continue; }
404
+ echo "<option value=\"" . $cat->term_id . "\"";
405
+ if ( $cat->term_id == $selected ) { echo " selected=\"selected\" "; }
406
+ echo "> &nbsp;&nbsp;" . $cat->name . "&nbsp;(" . $count[$cat->name] . ") </option>\r\n";
407
+ }
408
+ }
409
+ echo "</select>";
410
+ if ( false !== $submit ) {
411
+ echo "&nbsp;<input type=\"submit\" class=\"button-secondary\" value=\"$submit\" />\r\n";
412
+ }
413
+ } // end display_subscriber_dropdown()
414
+
415
+ /**
416
+ Display a drop down list of administrator level users and
417
+ optionally include a choice for Post Author
418
+ */
419
+ function admin_dropdown($inc_author = false) {
420
+ global $wpdb;
421
+
422
+ $args = array('fields' => array('ID', 'display_name'), 'role' => 'administrator');
423
+ $wp_user_query = get_users( $args );
424
+ if ( !empty($wp_user_query) ) {
425
+ foreach ($wp_user_query as $user) {
426
+ $admins[] = $user;
427
+ }
428
+ } else {
429
+ $admins = array();
430
+ }
431
+
432
+ if ( $inc_author ) {
433
+ $author[] = (object)array('ID' => 'author', 'display_name' => __('Post Author', 'subscribe2'));
434
+ $author[] = (object)array('ID' => 'blogname', 'display_name' => html_entity_decode(get_option('blogname'), ENT_QUOTES));
435
+ $admins = array_merge($author, $admins);
436
+ }
437
+
438
+ echo "<select name=\"sender\">\r\n";
439
+ foreach ( $admins as $admin ) {
440
+ echo "<option value=\"" . $admin->ID . "\"";
441
+ if ( $admin->ID == $this->subscribe2_options['sender'] ) {
442
+ echo " selected=\"selected\"";
443
+ }
444
+ echo ">" . $admin->display_name . "</option>\r\n";
445
+ }
446
+ echo "</select>\r\n";
447
+ } // end admin_dropdown()
448
+
449
+ /**
450
+ Display a dropdown of choices for digest email frequency
451
+ and give user details of timings when event is scheduled
452
+ */
453
+ function display_digest_choices() {
454
+ global $wpdb;
455
+ $cron_file = ABSPATH . 'wp-cron.php';
456
+ if ( !is_readable($cron_file) ) {
457
+ echo "<strong><em style=\"color: red\">" . __('The WordPress cron functions may be disabled on this server. Digest notifications may not work.', 'subscribe2') . "</em></strong><br />\r\n";
458
+ }
459
+ $scheduled_time = wp_next_scheduled('s2_digest_cron');
460
+ $schedule = (array)wp_get_schedules();
461
+ $schedule = array_merge(array('never' => array('interval' => 0, 'display' => __('For each Post', 'subscribe2'))), $schedule);
462
+ $sort = array();
463
+ foreach ( (array)$schedule as $key => $value ) {
464
+ $sort[$key] = $value['interval'];
465
+ }
466
+ asort($sort);
467
+ $schedule_sorted = array();
468
+ foreach ( $sort as $key => $value ) {
469
+ $schedule_sorted[$key] = $schedule[$key];
470
+ }
471
+ foreach ( $schedule_sorted as $key => $value ) {
472
+ echo "<label><input type=\"radio\" name=\"email_freq\" value=\"" . $key . "\"" . checked($this->subscribe2_options['email_freq'], $key, false) . " />";
473
+ echo " " . $value['display'] . "</label><br />\r\n";
474
+ }
475
+ echo "<br />" . __('Send Digest Notification at', 'subscribe2') . ": \r\n";
476
+ $hours = array('12am', '1am', '2am', '3am', '4am', '5am', '6am', '7am', '8am', '9am', '10am', '11am', '12pm', '1pm', '2pm', '3pm', '4pm', '5pm', '6pm', '7pm', '8pm', '9pm', '10pm', '11pm');
477
+ echo "<select name=\"hour\">\r\n";
478
+ while ( $hour = current($hours) ) {
479
+ echo "<option value=\"" . key($hours) . "\"";
480
+ if ( key($hours) == date('H', $scheduled_time) && !empty($scheduled_time) ){
481
+ echo " selected=\"selected\"";
482
+ }
483
+ echo ">" . $hour . "</option>\r\n";
484
+ next($hours);
485
+ }
486
+ echo "</select>\r\n";
487
+ echo "<strong><em style=\"color: red\">" . __('This option will be ignored if the time selected is not in the future in relation to the current time', 'subscribe2') . "</em></strong>\r\n";
488
+ if ( $scheduled_time ) {
489
+ $datetime = get_option('date_format') . ' @ ' . get_option('time_format');
490
+ echo "<p>" . __('Current UTC time is', 'subscribe2') . ": \r\n";
491
+ echo "<strong>" . date_i18n($datetime, false, 'gmt') . "</strong></p>\r\n";
492
+ echo "<p>" . __('Current blog time is', 'subscribe2') . ": \r\n";
493
+ echo "<strong>" . date_i18n($datetime) . "</strong></p>\r\n";
494
+ echo "<p>" . __('Next email notification will be sent when your blog time is after', 'subscribe2') . ": \r\n";
495
+ echo "<strong>" . date_i18n($datetime, $scheduled_time) . "</strong></p>\r\n";
496
+ if ( !empty($this->subscribe2_options['previous_s2cron']) ) {
497
+ echo "<p>" . __('Attempt to resend the last Digest Notification email', 'subscribe2') . ": ";
498
+ echo "<input type=\"submit\" class=\"button-secondary\" name=\"resend\" value=\"" . __('Resend Digest', 'subscribe2') . "\" /></p>\r\n";
499
+ }
500
+ } else {
501
+ echo "<br />";
502
+ }
503
+ } // end display_digest_choices()
504
+
505
+ /**
506
+ Create and display a dropdown list of pages
507
+ */
508
+ function pages_dropdown($s2page) {
509
+ global $wpdb;
510
+ $sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
511
+ $pages = $wpdb->get_results($sql);
512
+
513
+ if ( empty($pages) ) { return; }
514
+
515
+ $option = '';
516
+ foreach ( $pages as $page ) {
517
+ $option .= "<option value=\"" . $page->ID . "\"";
518
+ if ( $page->ID == $s2page ) {
519
+ $option .= " selected=\"selected\"";
520
+ }
521
+ $option .= ">" . $page->post_title . "</option>\r\n";
522
+ }
523
+
524
+ echo $option;
525
+ } // end pages_dropdown()
526
+
527
+ /**
528
+ Subscribe all registered users to category selected on Admin Manage Page
529
+ */
530
+ function subscribe_registered_users($emails = '', $cats = array()) {
531
+ if ( '' == $emails || '' == $cats ) { return false; }
532
+ global $wpdb;
533
+
534
+ $useremails = explode(",\r\n", $emails);
535
+ $useremails = implode(", ", array_map(array($this, 'prepare_in_data'), $useremails));
536
+
537
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)";
538
+ $user_IDs = $wpdb->get_col($sql);
539
+
540
+ foreach ( $user_IDs as $user_ID ) {
541
+ $old_cats = get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true);
542
+ if ( !empty($old_cats) ) {
543
+ $old_cats = explode(',', $old_cats);
544
+ $newcats = array_unique(array_merge($cats, $old_cats));
545
+ } else {
546
+ $newcats = $cats;
547
+ }
548
+ if ( !empty($newcats) ) {
549
+ // add subscription to these cat IDs
550
+ foreach ( $newcats as $id ) {
551
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id, $id);
552
+ }
553
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $newcats));
554
+ }
555
+ unset($newcats);
556
+ }
557
+ } // end subscribe_registered_users()
558
+
559
+ /**
560
+ Unsubscribe all registered users to category selected on Admin Manage Page
561
+ */
562
+ function unsubscribe_registered_users($emails = '', $cats = array()) {
563
+ if ( '' == $emails || '' == $cats ) { return false; }
564
+ global $wpdb;
565
+
566
+ $useremails = explode(",\r\n", $emails);
567
+ $useremails = implode(", ", array_map(array($this, 'prepare_in_data'), $useremails));
568
+
569
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)";
570
+ $user_IDs = $wpdb->get_col($sql);
571
+
572
+ foreach ( $user_IDs as $user_ID ) {
573
+ $old_cats = explode(',', get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true));
574
+ $remain = array_diff($old_cats, $cats);
575
+ if ( !empty($remain) ) {
576
+ // remove subscription to these cat IDs and update s2_subscribed
577
+ foreach ( $cats as $id ) {
578
+ delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
579
+ }
580
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
581
+ } else {
582
+ // remove subscription to these cat IDs and update s2_subscribed to ''
583
+ foreach ( $cats as $id ) {
584
+ delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
585
+ }
586
+ delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
587
+ }
588
+ unset($remain);
589
+ }
590
+ } // end unsubscribe_registered_users()
591
+
592
+ /**
593
+ Handles bulk changes to email format for Registered Subscribers
594
+ */
595
+ function format_change($format, $subscribers_string) {
596
+ if ( empty($format) ) { return; }
597
+
598
+ global $wpdb;
599
+ $subscribers = explode(",\r\n", $subscribers_string);
600
+ $emails = implode(", ", array_map(array($this,'prepare_in_data'), $subscribers));
601
+ $ids = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_email IN ($emails)");
602
+ $ids = implode(',', array_map(array($this, 'prepare_in_data'), $ids));
603
+ $sql = "UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND user_id IN ($ids)";
604
+ $wpdb->get_results($sql);
605
+ } // end format_change()
606
+
607
+ /**
608
+ Handles bulk update to digest preferences
609
+ */
610
+ function digest_change($digest, $emails) {
611
+ if ( empty($digest) ) { return; }
612
+
613
+ global $wpdb;
614
+ $useremails = explode(",\r\n", $emails);
615
+ $useremails = implode(", ", array_map(array($this, 'prepare_in_data'), $useremails));
616
+
617
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)";
618
+ $user_IDs = $wpdb->get_col($sql);
619
+
620
+ if ( $digest == 'digest' ) {
621
+ $exclude = explode(',', $this->subscribe2_options['exclude']);
622
+ if ( !empty($exclude) ) {
623
+ $all_cats = $this->all_cats(true, 'ID');
624
+ } else {
625
+ $all_cats = $this->all_cats(false, 'ID');
626
+ }
627
+
628
+ $cats_string = '';
629
+ foreach ( $all_cats as $cat ) {
630
+ ('' == $cats_string) ? $cats_string = "$cat->term_id" : $cats_string .= ",$cat->term_id";
631
+ }
632
+
633
+ foreach ( $user_IDs as $user_ID ) {
634
+ foreach ( $all_cats as $cat ) {
635
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat->term_id, $cat->term_id);
636
+ }
637
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), $cats_string);
638
+ }
639
+ } elseif ( $digest == '-1' ) {
640
+ foreach ( $user_IDs as $user_ID ) {
641
+ $cats = explode(',', get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true));
642
+ foreach ( $cats as $id ) {
643
+ delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
644
+ }
645
+ delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
646
+ }
647
+ }
648
+ } // end digest_change()
649
+
650
+ /* ===== functions to handle addition and removal of WordPress categories ===== */
651
+ /**
652
+ Autosubscribe registered users to newly created categories
653
+ if registered user has selected this option
654
+ */
655
+ function new_category($new_category='') {
656
+ if ( 'no' == $this->subscribe2_options['show_autosub'] ) { return; }
657
+ // don't subscribe to individual new categories if we are doing digest emails
658
+ if ( $this->subscribe2_options['email_freq'] != 'never' ) { return; }
659
+ global $wpdb;
660
+
661
+ if ( 'yes' == $this->subscribe2_options['show_autosub'] ) {
662
+ if ( $this->s2_mu ) {
663
+ $sql = $wpdb->prepare("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=%s AND a.meta_value='yes' AND b.meta_key=%s", $this->get_usermeta_keyname('s2_autosub'), $this->get_usermeta_keyname('s2_subscribed'));
664
+ } else {
665
+ $sql = $wpdb->prepare("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key=%s AND $wpdb->usermeta.meta_value='yes'", $this->get_usermeta_keyname('s2_autosub'));
666
+ }
667
+ $user_IDs = $wpdb->get_col($sql);
668
+ if ( '' == $user_IDs ) { return; }
669
+
670
+ foreach ( $user_IDs as $user_ID ) {
671
+ $old_cats = get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true);
672
+ if ( empty($old_cats) ) {
673
+ $newcats = (array)$new_category;
674
+ } else {
675
+ $old_cats = explode(',', $old_cats);
676
+ $newcats = array_merge($old_cats, (array)$new_category);
677
+ }
678
+ // add subscription to these cat IDs
679
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $new_category, $new_category);
680
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $newcats));
681
+ }
682
+ } elseif ( 'exclude' == $this->subscribe2_options['show_autosub'] ) {
683
+ $excluded_cats = explode(',', $this->subscribe2_options['exclude']);
684
+ $excluded_cats[] = $new_category;
685
+ $this->subscribe2_options['exclude'] = implode(',', $excluded_cats);
686
+ update_option('subscribe2_options', $this->subscribe2_options);
687
+ }
688
+ } // end new_category()
689
+
690
+ /**
691
+ Automatically delete subscriptions to a category when it is deleted
692
+ */
693
+ function delete_category($deleted_category='') {
694
+ global $wpdb;
695
+
696
+ if ( $this->s2_mu ) {
697
+ $sql = $wpdb->prepare("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=%s AND b.meta_key=%s", $this->get_usermeta_keyname('s2_cat') . $deleted_category, $this->get_usermeta_keyname('s2_subscribed'));
698
+ } else {
699
+ $sql = $wpdb->prepare("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key=%s", $this->get_usermeta_keyname('s2_cat') . $deleted_category);
700
+ }
701
+ $user_IDs = $wpdb->get_col($sql);
702
+ if ( '' == $user_IDs ) { return; }
703
+
704
+ foreach ( $user_IDs as $user_ID ) {
705
+ $old_cats = explode(',', get_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), true));
706
+ if ( !is_array($old_cats) ) {
707
+ $old_cats = array($old_cats);
708
+ }
709
+ // add subscription to these cat IDs
710
+ delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $deleted_category);
711
+ $remain = array_diff($old_cats, (array)$deleted_category);
712
+ update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
713
+ }
714
+ } // end delete_category()
715
+
716
+ /* ===== functions to show & handle one-click subscription ===== */
717
+ /**
718
+ Show form for one-click subscription on user profile page
719
+ */
720
+ function one_click_profile_form($user) {
721
+ echo "<h3>" . __('Email subscription', 'subscribe2') . "</h3>\r\n";
722
+ echo "<table class=\"form-table\">\r\n";
723
+ echo "<tr><th scope=\"row\">" . __('Subscribe / Unsubscribe', 'subscribe2') . "</th>\r\n";
724
+ echo "<td><label><input type=\"checkbox\" name=\"sub2-one-click-subscribe\" value=\"1\" " . checked( ! get_user_meta($user->ID, $this->get_usermeta_keyname('s2_subscribed'), true), false, false ) . " /> " . __('Receive notifications', 'subscribe2') . "</label><br />\r\n";
725
+ echo "<span class=\"description\">" . __('Check if you want to receive email notification when new posts are published', 'subscribe2') . "</span>\r\n";
726
+ echo "</td></tr></table>\r\n";
727
+ } // end one_click_profile_form()
728
+
729
+ /**
730
+ Handle submission from profile one-click subscription
731
+ */
732
+ function one_click_profile_form_save($user_ID) {
733
+ if ( !current_user_can( 'edit_user', $user_ID ) ) {
734
+ return false;
735
+ }
736
+
737
+ if ( isset( $_POST['sub2-one-click-subscribe'] ) && 1 == $_POST['sub2-one-click-subscribe'] ) {
738
+ // Subscribe
739
+ $this->one_click_handler($user_ID, 'subscribe');
740
+ } else {
741
+ // Unsubscribe
742
+ $this->one_click_handler($user_ID, 'unsubscribe');
743
+ }
744
+ } // end one_click_profile_form_save()
745
+ }
746
?>
classes/class-s2-core.php CHANGED
@@ -213,7 +213,7 @@ class s2class {
213
foreach ( $public_subscribers as $email ) {
214
$new_email = $this->sanitize_email($email);
215
if ( $email !== $new_email ) {
216
- $wpdb->get_results("UPDATE $this->public SET email='$new_email' WHERE CAST(email as binary)='$email'");
217
}
218
}
219
return;
@@ -564,6 +564,16 @@ class s2class {
564
565
$gallid = '[gallery id="' . $post->ID . '"';
566
$content = str_replace('[gallery', $gallid, $post->post_content);
567
$content = apply_filters('the_content', $content);
568
$content = str_replace("]]>", "]]&gt", $content);
569
@@ -742,7 +752,7 @@ class s2class {
742
if ( !$id ) {
743
return false;
744
}
745
- return $wpdb->get_var("SELECT email FROM $this->public WHERE id=$id");
746
} // end get_email()
747
748
/**
@@ -754,7 +764,7 @@ class s2class {
754
if ( !$email ) {
755
return false;
756
}
757
- return $wpdb->get_var("SELECT id FROM $this->public WHERE email='$email'");
758
} // end get_id()
759
760
/**
@@ -769,12 +779,12 @@ class s2class {
769
770
if ( false !== $this->is_public($email) ) {
771
// is this an email for a registered user
772
- $check = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE user_email='$this->email'");
773
if ( $check ) { return; }
774
if ( $confirm ) {
775
- $wpdb->get_results("UPDATE $this->public SET active='1', ip='$this->ip' WHERE CAST(email as binary)='$email'");
776
} else {
777
- $wpdb->get_results("UPDATE $this->public SET date=CURDATE() WHERE CAST(email as binary)='$email'");
778
}
779
} else {
780
if ( $confirm ) {
@@ -793,7 +803,7 @@ class s2class {
793
global $wpdb;
794
795
if ( !is_email($email) ) { return false; }
796
- $wpdb->get_results("DELETE FROM $this->public WHERE CAST(email as binary)='$email'");
797
} // end delete()
798
799
/**
@@ -809,9 +819,9 @@ class s2class {
809
if ( false === $status ) { return false; }
810
811
if ( '0' == $status ) {
812
- $wpdb->get_results("UPDATE $this->public SET active='1' WHERE CAST(email as binary)='$email'");
813
} else {
814
- $wpdb->get_results("UPDATE $this->public SET active='0' WHERE CAST(email as binary)='$email'");
815
}
816
} // end toggle()
817
@@ -853,7 +863,7 @@ class s2class {
853
if ( '' == $email ) { return false; }
854
855
// run the query and force case sensitivity
856
- $check = $wpdb->get_var("SELECT active FROM $this->public WHERE CAST(email as binary)='$email'");
857
if ( '0' == $check || '1' == $check ) {
858
return $check;
859
} else {
@@ -906,7 +916,7 @@ class s2class {
906
907
if ( '' == $email ) { return false; }
908
909
- $check = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE user_email='$email'");
910
if ( $check ) {
911
return true;
912
} else {
@@ -922,7 +932,7 @@ class s2class {
922
923
if ( '' == $email ) { return false; }
924
925
- $id = $wpdb->get_var("SELECT id FROM $wpdb->users WHERE user_email='$email'");
926
927
return $id;
928
} // end get_user_id()
@@ -972,7 +982,7 @@ class s2class {
972
// text or HTML subscribers
973
if ( 'all' != $r['format'] ) {
974
$JOIN .= "INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id ";
975
- $AND .= " AND b.meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND b.meta_value=";
976
if ( 'html' == $r['format'] ) {
977
$AND .= "'html'";
978
} elseif ( 'html_excerpt' == $r['format'] ) {
@@ -989,7 +999,7 @@ class s2class {
989
$JOIN .= "INNER JOIN $wpdb->usermeta AS c ON a.user_id = c.user_id ";
990
$and = '';
991
foreach ( explode(',', $r['cats']) as $cat ) {
992
- ('' == $and) ? $and = "c.meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$cat'" : $and .= " OR c.meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$cat'";
993
}
994
$AND .= " AND ($and)";
995
}
@@ -997,17 +1007,17 @@ class s2class {
997
// specific authors
998
if ( '' != $r['author'] ) {
999
$JOIN .= "INNER JOIN $wpdb->usermeta AS d ON a.user_id = d.user_id ";
1000
- $AND .= " AND (d.meta_key='" . $this->get_usermeta_keyname('s2_authors') . "' AND NOT FIND_IN_SET(" . $r['author'] . ", d.meta_value))";
1001
}
1002
1003
if ( $this->s2_mu ) {
1004
$sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key='" . $wpdb->prefix . "capabilities'" . $AND;
1005
} else {
1006
- $sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'" . $AND;
1007
}
1008
$result = $wpdb->get_col($sql);
1009
if ( $result ) {
1010
- $ids = implode(',', $result);
1011
$registered = $wpdb->get_col("SELECT user_email FROM $wpdb->users WHERE ID IN ($ids)");
1012
}
1013
@@ -1175,6 +1185,14 @@ class s2class {
1175
return $all_cats;
1176
} // end all_cats()
1177
1178
/**
1179
Export subscriber emails and other details to CSV
1180
*/
@@ -1325,7 +1343,7 @@ class s2class {
1325
if ( $subscribe != '1' ) { return $comment_ID; }
1326
1327
// Retrieve the information about the comment
1328
- $sql = "SELECT comment_author_email, comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_ID' LIMIT 1";
1329
$comment = $wpdb->get_row($sql, OBJECT);
1330
if ( empty($comment) ) { return $comment_ID; }
1331
@@ -1413,21 +1431,21 @@ class s2class {
1413
}
1414
$s2_post_types = apply_filters('s2_post_types', $s2_post_types);
1415
foreach( $s2_post_types as $post_type ) {
1416
- ('' == $type) ? $type = "'$post_type'" : $type .= ", '$post_type'";
1417
}
1418
1419
// collect posts
1420
if ( $resend == 'resend' ) {
1421
if ( $this->subscribe2_options['cron_order'] == 'desc' ) {
1422
- $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= '$last' AND post_date < '$prev' AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date DESC");
1423
} else {
1424
- $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= '$last' AND post_date < '$prev' AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date ASC");
1425
}
1426
} else {
1427
if ( $this->subscribe2_options['cron_order'] == 'desc' ) {
1428
- $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= '$prev' AND post_date < '$now' AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date DESC");
1429
} else {
1430
- $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= '$prev' AND post_date < '$now' AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date ASC");
1431
}
1432
}
1433
} else {
@@ -1641,7 +1659,7 @@ class s2class {
1641
1642
// do we need to install anything?
1643
$this->public = $table_prefix . "subscribe2";
1644
- if ( $wpdb->get_var("SHOW TABLES LIKE '{$this->public}'") != $this->public ) { $this->install(); }
1645
//do we need to upgrade anything?
1646
if ( is_array($this->subscribe2_options) && $this->subscribe2_options['version'] !== S2VERSION ) {
1647
add_action('shutdown', array(&$this, 'upgrade'));
213
foreach ( $public_subscribers as $email ) {
214
$new_email = $this->sanitize_email($email);
215
if ( $email !== $new_email ) {
216
+ $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET email=%s WHERE CAST(email as binary)=%s", $new_email, $email));
217
}
218
}
219
return;
564
565
$gallid = '[gallery id="' . $post->ID . '"';
566
$content = str_replace('[gallery', $gallid, $post->post_content);
567
+
568
+ // remove the autoembed filter to remove iframes from notification emails
569
+ if ( get_option('embed_autourls') ) {
570
+ global $wp_embed;
571
+ $priority = has_filter('the_content', array(&$wp_embed, 'autoembed'));
572
+ if ( $priority !== false ) {
573
+ remove_filter('the_content', array(&$wp_embed, 'autoembed'), $priority);
574
+ }
575
+ }
576
+
577
$content = apply_filters('the_content', $content);
578
$content = str_replace("]]>", "]]&gt", $content);
579
752
if ( !$id ) {
753
return false;
754
}
755
+ return $wpdb->get_var($wpdb->prepare("SELECT email FROM $this->public WHERE id=%d", $id));
756
} // end get_email()
757
758
/**
764
if ( !$email ) {
765
return false;
766
}
767
+ return $wpdb->get_var($wpdb->prepare("SELECT id FROM $this->public WHERE email=%s", $email));
768
} // end get_id()
769
770
/**
779
780
if ( false !== $this->is_public($email) ) {
781
// is this an email for a registered user
782
+ $check = $wpdb->get_var($wpdb->prepare("SELECT user_email FROM $wpdb->users WHERE user_email=%s", $this->email));
783
if ( $check ) { return; }
784
if ( $confirm ) {
785
+ $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='1', ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
786
} else {
787
+ $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET date=CURDATE() WHERE CAST(email as binary)=%s", $email));
788
}
789
} else {
790
if ( $confirm ) {
803
global $wpdb;
804
805
if ( !is_email($email) ) { return false; }
806
+ $wpdb->get_results($wpdb->prepare("DELETE FROM $this->public WHERE CAST(email as binary)=%s", $email));
807
} // end delete()
808
809
/**
819
if ( false === $status ) { return false; }
820
821
if ( '0' == $status ) {
822
+ $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='1' WHERE CAST(email as binary)=%s", $email));
823
} else {
824
+ $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='0' WHERE CAST(email as binary)=%s", $email));
825
}
826
} // end toggle()
827
863
if ( '' == $email ) { return false; }
864
865
// run the query and force case sensitivity
866
+ $check = $wpdb->get_var($wpdb->prepare("SELECT active FROM $this->public WHERE CAST(email as binary)=%s", $email));
867
if ( '0' == $check || '1' == $check ) {
868
return $check;
869
} else {
916
917
if ( '' == $email ) { return false; }
918
919
+ $check = $wpdb->get_var($wpdb->prepare("SELECT user_email FROM $wpdb->users WHERE user_email=%s", $email));
920
if ( $check ) {
921
return true;
922
} else {
932
933
if ( '' == $email ) { return false; }
934
935
+ $id = $wpdb->get_var($wpdb->prepare("SELECT id FROM $wpdb->users WHERE user_email=%s", $email));
936
937
return $id;
938
} // end get_user_id()
982
// text or HTML subscribers
983
if ( 'all' != $r['format'] ) {
984
$JOIN .= "INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id ";
985
+ $AND .= $wpdb->prepare(" AND b.meta_key=%s AND b.meta_value=", $this->get_usermeta_keyname('s2_format'));
986
if ( 'html' == $r['format'] ) {
987
$AND .= "'html'";
988
} elseif ( 'html_excerpt' == $r['format'] ) {
999
$JOIN .= "INNER JOIN $wpdb->usermeta AS c ON a.user_id = c.user_id ";
1000
$and = '';
1001
foreach ( explode(',', $r['cats']) as $cat ) {
1002
+ ('' == $and) ? $and = $wpdb->prepare("c.meta_key=%s", $this->get_usermeta_keyname('s2_cat') . $cat) : $and .= $wpdb->prepare(" OR c.meta_key=%s", $this->get_usermeta_keyname('s2_cat') . $cat);
1003
}
1004
$AND .= " AND ($and)";
1005
}
1007
// specific authors
1008
if ( '' != $r['author'] ) {
1009
$JOIN .= "INNER JOIN $wpdb->usermeta AS d ON a.user_id = d.user_id ";
1010
+ $AND .= $wpdb->prepare(" AND (d.meta_key=%s AND NOT FIND_IN_SET(%s, d.meta_value))", $this->get_usermeta_keyname('s2_authors'), $r['author']);
1011
}
1012
1013
if ( $this->s2_mu ) {
1014
$sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key='" . $wpdb->prefix . "capabilities'" . $AND;
1015
} else {
1016
+ $sql = $wpdb->prepare("SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key=%s" . $AND, $this->get_usermeta_keyname('s2_subscribed'));
1017
}
1018
$result = $wpdb->get_col($sql);
1019
if ( $result ) {
1020
+ $ids = implode(',', array_map(array($this, 'prepare_in_data'), $result));
1021
$registered = $wpdb->get_col("SELECT user_email FROM $wpdb->users WHERE ID IN ($ids)");
1022
}
1023
1185
return $all_cats;
1186
} // end all_cats()
1187
1188
+ /**
1189
+ Function to sanitise array of data for SQL
1190
+ */
1191
+ function prepare_in_data($data) {
1192
+ global $wpdb;
1193
+ return $wpdb->prepare('%s', $data);
1194
+ } // end prepare_in_data()
1195
+
1196
/**
1197
Export subscriber emails and other details to CSV
1198
*/
1343
if ( $subscribe != '1' ) { return $comment_ID; }
1344
1345
// Retrieve the information about the comment
1346
+ $sql = $wpdb->prepare("SELECT comment_author_email, comment_approved FROM $wpdb->comments WHERE comment_ID=%s LIMIT 1", $comment_ID);
1347
$comment = $wpdb->get_row($sql, OBJECT);
1348
if ( empty($comment) ) { return $comment_ID; }
1349
1431
}
1432
$s2_post_types = apply_filters('s2_post_types', $s2_post_types);
1433
foreach( $s2_post_types as $post_type ) {
1434
+ ('' == $type) ? $type = $wpdb->prepare("%s", $post_type) : $type .= $wpdb->prepare(", %s", $post_type);
1435
}
1436
1437
// collect posts
1438
if ( $resend == 'resend' ) {
1439
if ( $this->subscribe2_options['cron_order'] == 'desc' ) {
1440
+ $posts = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= %s AND post_date < %s AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date DESC", $last, $prev));
1441
} else {
1442
+ $posts = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= %s AND post_date < %s AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date ASC", $last, $prev));
1443
}
1444
} else {
1445
if ( $this->subscribe2_options['cron_order'] == 'desc' ) {
1446
+ $posts = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= %s AND post_date < %s AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date DESC", $prev, $now));
1447
} else {
1448
+ $posts = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password, post_date, post_author FROM $wpdb->posts WHERE post_date >= %s AND post_date < %s AND post_status IN ($status) AND post_type IN ($type) ORDER BY post_date ASC", $prev, $now));
1449
}
1450
}
1451
} else {
1659
1660
// do we need to install anything?
1661
$this->public = $table_prefix . "subscribe2";
1662
+ if ( $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $this->public)) != $this->public ) { $this->install(); }
1663
//do we need to upgrade anything?
1664
if ( is_array($this->subscribe2_options) && $this->subscribe2_options['version'] !== S2VERSION ) {
1665
add_action('shutdown', array(&$this, 'upgrade'));
classes/class-s2-frontend.php CHANGED
@@ -64,7 +64,7 @@ class s2_frontend extends s2class {
64
$this->email = $this->sanitize_email($_POST['email']);
65
$this->ip = $_POST['ip'];
66
// does the supplied email belong to a registered user?
67
- $check = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE user_email = '$this->email'");
68
if ( '' != $check ) {
69
// this is a registered email
70
$this->s2form = $this->please_log_in;
@@ -150,7 +150,13 @@ class s2_frontend extends s2class {
150
function title_filter($title) {
151
// don't interfere if we've already done our thing
152
if ( in_the_loop() ) {
153
- return __('Subscription Confirmation', 'subscribe2');
154
} else {
155
return $title;
156
}
64
$this->email = $this->sanitize_email($_POST['email']);
65
$this->ip = $_POST['ip'];
66
// does the supplied email belong to a registered user?
67
+ $check = $wpdb->get_var($wpdb->prepare("SELECT user_email FROM $wpdb->users WHERE user_email = %s", $this->email));
68
if ( '' != $check ) {
69
// this is a registered email
70
$this->s2form = $this->please_log_in;
150
function title_filter($title) {
151
// don't interfere if we've already done our thing
152
if ( in_the_loop() ) {
153
+ $code = $_GET['s2'];
154
+ $action = intval(substr($code, 0, 1));
155
+ if ( $action == '1' ) {
156
+ return __('Subscription Confirmation', 'subscribe2');
157
+ } else {
158
+ return __('Unsubscription Confirmation', 'subscribe2');
159
+ }
160
} else {
161
return $title;
162
}
include/widget.php CHANGED
@@ -28,7 +28,7 @@ class S2_Form_widget extends WP_Widget {
28
$hide = " link=\"" . __('(Un)Subscribe to Posts', 'subscribe2') . "\"";
29
}
30
$postid = '';
31
- if ( $postto ) {
32
$postid = " id=\"" . $postto . "\"";
33
}
34
$size = " size=\"" . $textbox_size . "\"";
@@ -89,7 +89,6 @@ class S2_Form_widget extends WP_Widget {
89
90
global $wpdb, $mysubscribe2;
91
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
92
- $pages = $wpdb->get_results($sql);
93
94
echo "<div>\r\n";
95
echo "<p><label for=\"" . $this->get_field_name('title') . "\">" . __('Title', 'subscribe2') . ":\r\n";
@@ -108,14 +107,15 @@ class S2_Form_widget extends WP_Widget {
108
echo "<br /><input name=\"" . $this->get_field_name('hidebutton') . "\" type=\"radio\" value=\"link\"". checked('link', $hidebutton, false) . "/>" . __('Show as link', 'subscribe2');
109
}
110
echo "</label></p>\r\n";
111
- if ( !empty($pages) ) {
112
- echo "<p><label for=\"" . $this->get_field_name('postto') . "\">" . __('Post form content to page', 'subscribe2') . ":\r\n";
113
- echo "<select id=\"" . $this->get_field_id('postto') . "\" name=\"" . $this->get_field_name('postto') . "\">\r\n";
114
- echo "<option value=\"\">" . __('Use Subscribe2 Default', 'subscribe2') . "</option>\r\n";
115
- global $mysubscribe2;
116
- $mysubscribe2->pages_dropdown($postto);
117
- echo "</select></label></p>\r\n";
118
- }
119
echo "</div>\r\n";
120
}
121
} // End S2_Form_widget class
28
$hide = " link=\"" . __('(Un)Subscribe to Posts', 'subscribe2') . "\"";
29
}
30
$postid = '';
31
+ if ( !empty($postto) || $postto !== 'home' ) {
32
$postid = " id=\"" . $postto . "\"";
33
}
34
$size = " size=\"" . $textbox_size . "\"";
89
90
global $wpdb, $mysubscribe2;
91
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
92
93
echo "<div>\r\n";
94
echo "<p><label for=\"" . $this->get_field_name('title') . "\">" . __('Title', 'subscribe2') . ":\r\n";
107
echo "<br /><input name=\"" . $this->get_field_name('hidebutton') . "\" type=\"radio\" value=\"link\"". checked('link', $hidebutton, false) . "/>" . __('Show as link', 'subscribe2');
108
}
109
echo "</label></p>\r\n";
110
+ echo "<p><label for=\"" . $this->get_field_name('postto') . "\">" . __('Post form content to page', 'subscribe2') . ":\r\n";
111
+ echo "<select id=\"" . $this->get_field_id('postto') . "\" name=\"" . $this->get_field_name('postto') . "\">\r\n";
112
+ global $mysubscribe2;
113
+ echo "<option value=\"" . $mysubscribe2->subscribe2_options['s2page'] . "\">" . __('Use Subscribe2 Default', 'subscribe2') . "</option>\r\n";
114
+ echo "<option value=\"home\"";
115
+ if ( $postto === 'home' ) { echo " selected=\"selected\""; }
116
+ echo ">" . __('Use Home Page', 'subscribe2') . "</option>\r\n";
117
+ $mysubscribe2->pages_dropdown($postto);
118
+ echo "</select></label></p>\r\n";
119
echo "</div>\r\n";
120
}
121
} // End S2_Form_widget class
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: 8.3
7
Author: Matthew Robinson
8
Author URI: http://subscribe2.wordpress.com
9
Licence: GPL3
3
Plugin Name: Subscribe2
4
Plugin URI: http://subscribe2.wordpress.com
5
Description: Notifies an email list when new entries are posted.
6
+ Version: 8.4
7
Author: Matthew Robinson
8
Author URI: http://subscribe2.wordpress.com
9
Licence: GPL3
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: 2012-06-15 08:28+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,443 +17,453 @@ msgstr ""
17
"Content-Type: text/plain; charset=CHARSET\n"
18
"Content-Transfer-Encoding: 8bit\n"
19
20
- #: admin/send_email.php:42
21
msgid "Your email was empty"
22
msgstr ""
23
24
- #: admin/send_email.php:53
25
msgid "Send an email to subscribers"
26
msgstr ""
27
28
- #: admin/send_email.php:61
29
msgid "A message from"
30
msgstr ""
31
32
- #: admin/send_email.php:66
33
msgid "Subject"
34
msgstr ""
35
36
- #: admin/send_email.php:69
37
msgid "Recipients:"
38
msgstr ""
39
40
- #: admin/send_email.php:73
41
msgid "Preview"
42
msgstr ""
43
44
- #: admin/send_email.php:73
45
msgid "Send"
46
msgstr ""
47
48
- #: admin/settings.php:30
49
msgid "Preview message(s) sent to logged in user"
50
msgstr ""
51
52
- #: admin/settings.php:34
53
msgid ""
54
"The Digest Notification email contained no post information. No email was "
55
"sent"
56
msgstr ""
57
58
- #: admin/settings.php:36
59
msgid "Attempt made to resend the Digest Notification email"
60
msgstr ""
61
62
- #: admin/settings.php:205
63
msgid "Subscribe2 Settings"
64
msgstr ""
65
66
- #: admin/settings.php:206
67
msgid "Plugin Blog"
68
msgstr ""
69
70
- #: admin/settings.php:207
71
msgid "Make a donation via PayPal"
72
msgstr ""
73
74
- #: admin/settings.php:219 admin/your_subscriptions.php:96
75
msgid "Notification Settings"
76
msgstr ""
77
78
- #: admin/settings.php:220
79
msgid "Restrict the number of recipients per email to (0 for unlimited)"
80
msgstr ""
81
82
- #: admin/settings.php:222 admin/settings.php:370
83
msgid "Edit"
84
msgstr ""
85
86
- #: admin/settings.php:225 admin/settings.php:373
87
msgid "Update"
88
msgstr ""
89
90
- #: admin/settings.php:226 admin/settings.php:374
91
msgid "Revert"
92
msgstr ""
93
94
- #: admin/settings.php:228
95
msgid "Send Admins notifications for new"
96
msgstr ""
97
98
- #: admin/settings.php:230
99
msgid "Subscriptions"
100
msgstr ""
101
102
- #: admin/settings.php:232
103
msgid "Unsubscriptions"
104
msgstr ""
105
106
- #: admin/settings.php:234
107
msgid "Both"
108
msgstr ""
109
110
- #: admin/settings.php:236
111
msgid "Neither"
112
msgstr ""
113
114
- #: admin/settings.php:238
115
msgid "Include theme CSS stylesheet in HTML notifications"
116
msgstr ""
117
118
- #: admin/settings.php:240 admin/settings.php:246 admin/settings.php:260
119
- #: admin/settings.php:265 admin/settings.php:415 admin/settings.php:420
120
- #: admin/settings.php:434 admin/settings.php:441 admin/settings.php:453
121
#: admin/subscribers.php:339 admin/your_subscriptions.php:121
122
#: admin/your_subscriptions.php:161
123
msgid "Yes"
124
msgstr ""
125
126
- #: admin/settings.php:242 admin/settings.php:248 admin/settings.php:262
127
- #: admin/settings.php:267 admin/settings.php:412 admin/settings.php:417
128
- #: admin/settings.php:422 admin/settings.php:436 admin/settings.php:443
129
- #: admin/settings.php:450 admin/settings.php:455 admin/subscribers.php:341
130
#: admin/your_subscriptions.php:123 admin/your_subscriptions.php:165
131
msgid "No"
132
msgstr ""
133
134
- #: admin/settings.php:244
135
msgid "Send Emails for Pages"
136
msgstr ""
137
138
- #: admin/settings.php:252
139
msgid ""
140
"Subscribe2 will send email notifications for the following custom post types"
141
msgstr ""
142
143
- #: admin/settings.php:258
144
msgid "Send Emails for Password Protected Posts"
145
msgstr ""
146
147
- #: admin/settings.php:263
148
msgid "Send Emails for Private Posts"
149
msgstr ""
150
151
- #: admin/settings.php:268
152
msgid "Send Email From"
153
msgstr ""
154
155
- #: admin/settings.php:273
156
msgid "Send Emails"
157
msgstr ""
158
159
- #: admin/settings.php:275
160
msgid "For digest notifications, date order for posts is"
161
msgstr ""
162
163
- #: admin/settings.php:277
164
msgid "Descending"
165
msgstr ""
166
167
- #: admin/settings.php:279
168
msgid "Ascending"
169
msgstr ""
170
171
- #: admin/settings.php:281
172
msgid "Add Tracking Parameters to the Permalink"
173
msgstr ""
174
175
- #: admin/settings.php:283
176
msgid "eg. utm_source=subscribe2&utm_medium=email&utm_campaign=postnotify"
177
msgstr ""
178
179
- #: admin/settings.php:288
180
msgid "Email Templates"
181
msgstr ""
182
183
- #: admin/settings.php:292
184
msgid "New Post email (must not be empty)"
185
msgstr ""
186
187
- #: admin/settings.php:293 admin/settings.php:323 admin/settings.php:328
188
msgid "Subject Line"
189
msgstr ""
190
191
- #: admin/settings.php:298
192
msgid "Send Email Preview"
193
msgstr ""
194
195
- #: admin/settings.php:299
196
msgid "Message substitutions"
197
msgstr ""
198
199
- #: admin/settings.php:301
200
msgid ""
201
"IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED"
202
msgstr ""
203
204
- #: admin/settings.php:304
205
msgid "the post's title<br />(<i>for per-post emails only</i>)"
206
msgstr ""
207
208
- #: admin/settings.php:305
209
msgid ""
210
"the excerpt or the entire post<br />(<i>based on the subscriber's "
211
"preferences</i>)"
212
msgstr ""
213
214
- #: admin/settings.php:306
215
msgid ""
216
"the excerpt of the post and the time it was posted<br />(<i>for digest "
217
"emails only</i>)"
218
msgstr ""
219
220
- #: admin/settings.php:307
221
msgid "a list of post titles<br />(<i>for digest emails only</i>)"
222
msgstr ""
223
224
- #: admin/settings.php:308
225
msgid ""
226
"a list of post titles followed by links to the atricles<br />(<i>for digest "
227
"emails only</i>)"
228
msgstr ""
229
230
- #: admin/settings.php:309
231
msgid "the post's permalink<br />(<i>for per-post emails only</i>)"
232
msgstr ""
233
234
- #: admin/settings.php:310
235
msgid ""
236
"the post's permalink after conversion by TinyURL<br />(<i>for per-post "
237
"emails only</i>)"
238
msgstr ""
239
240
- #: admin/settings.php:311
241
msgid "the date the post was made<br />(<i>for per-post emails only</i>)"
242
msgstr ""
243
244
- #: admin/settings.php:312
245
msgid "the time the post was made<br />(<i>for per-post emails only</i>)"
246
msgstr ""
247
248
- #: admin/settings.php:313
249
msgid "the admin or post author's name"
250
msgstr ""
251
252
- #: admin/settings.php:314
253
msgid "the admin or post author's email"
254
msgstr ""
255
256
- #: admin/settings.php:315
257
msgid "the post author's name"
258
msgstr ""
259
260
- #: admin/settings.php:316
261
msgid ""
262
"the generated link to confirm a request<br />(<i>only used in the "
263
"confirmation email template</i>)"
264
msgstr ""
265
266
- #: admin/settings.php:317
267
msgid ""
268
"Action performed by LINK in confirmation email<br />(<i>only used in the "
269
"confirmation email template</i>)"
270
msgstr ""
271
272
- #: admin/settings.php:318
273
msgid "the post's assigned categories"
274
msgstr ""
275
276
- #: admin/settings.php:319
277
msgid "the post's assigned Tags"
278
msgstr ""
279
280
- #: admin/settings.php:320
281
msgid ""
282
"the number of posts included in the digest email<br />(<i>for digest emails "
283
"only</i>)"
284
msgstr ""
285
286
- #: admin/settings.php:322
287
msgid "Subscribe / Unsubscribe confirmation email"
288
msgstr ""
289
290
- #: admin/settings.php:327
291
msgid "Reminder email to Unconfirmed Subscribers"
292
msgstr ""
293
294
- #: admin/settings.php:336
295
msgid "Excluded Categories"
296
msgstr ""
297
298
- #: admin/settings.php:338
299
msgid ""
300
"Posts assigned to any Excluded Category do not generate notifications and "
301
"are not included in digest notifications"
302
msgstr ""
303
304
- #: admin/settings.php:342
305
msgid "Allow registered users to subscribe to excluded categories?"
306
msgstr ""
307
308
- #: admin/settings.php:348
309
msgid "Excluded Formats"
310
msgstr ""
311
312
- #: admin/settings.php:350
313
msgid ""
314
"Posts assigned to any Excluded Format do not generate notifications and are "
315
"not included in digest notifications"
316
msgstr ""
317
318
- #: admin/settings.php:358
319
msgid "Appearance"
320
msgstr ""
321
322
- #: admin/settings.php:362
323
msgid "Set default Subscribe2 page as ID"
324
msgstr ""
325
326
- #: admin/settings.php:368
327
msgid "Set the number of Subscribers displayed per page"
328
msgstr ""
329
330
- #: admin/settings.php:378
331
msgid "Show a link to your subscription page in \"meta\"?"
332
msgstr ""
333
334
- #: admin/settings.php:382
335
msgid "Show the Subscribe2 button on the Write toolbar?"
336
msgstr ""
337
338
- #: admin/settings.php:386
339
msgid "Enable AJAX style subscription form?"
340
msgstr ""
341
342
- #: admin/settings.php:390
343
msgid "Enable Subscribe2 Widget?"
344
msgstr ""
345
346
- #: admin/settings.php:394
347
msgid "Enable Subscribe2 Counter Widget?"
348
msgstr ""
349
350
- #: admin/settings.php:398
351
msgid "Disable email notifications is checked by default on authoring pages?"
352
msgstr ""
353
354
- #: admin/settings.php:404
355
msgid "Auto Subscribe"
356
msgstr ""
357
358
- #: admin/settings.php:406
359
msgid "Subscribe new users registering with your blog"
360
msgstr ""
361
362
- #: admin/settings.php:408
363
msgid "Automatically"
364
msgstr ""
365
366
- #: admin/settings.php:410
367
msgid "Display option on Registration Form"
368
msgstr ""
369
370
- #: admin/settings.php:413
371
msgid "Auto-subscribe includes any excluded categories"
372
msgstr ""
373
374
- #: admin/settings.php:418
375
msgid "Registration Form option is checked by default"
376
msgstr ""
377
378
- #: admin/settings.php:423
379
msgid "Auto-subscribe users to receive email as"
380
msgstr ""
381
382
- #: admin/settings.php:425 admin/subscribers.php:329
383
#: admin/your_subscriptions.php:110
384
msgid "HTML - Full"
385
msgstr ""
386
387
- #: admin/settings.php:427 admin/subscribers.php:330
388
#: admin/your_subscriptions.php:112
389
msgid "HTML - Excerpt"
390
msgstr ""
391
392
- #: admin/settings.php:429 admin/subscribers.php:331
393
#: admin/your_subscriptions.php:114
394
msgid "Plain Text - Full"
395
msgstr ""
396
397
- #: admin/settings.php:431 admin/subscribers.php:332
398
#: admin/your_subscriptions.php:116
399
msgid "Plain Text - Excerpt"
400
msgstr ""
401
402
- #: admin/settings.php:432
403
msgid "Registered Users have the option to auto-subscribe to new categories"
404
msgstr ""
405
406
- #: admin/settings.php:438
407
msgid "New categories are immediately excluded"
408
msgstr ""
409
410
- #: admin/settings.php:439
411
msgid ""
412
"Option for Registered Users to auto-subscribe to new categories is checked "
413
"by default"
414
msgstr ""
415
416
- #: admin/settings.php:444
417
msgid "Display checkbox to allow subscriptions from the comment form"
418
msgstr ""
419
420
- #: admin/settings.php:446
421
msgid "Before the Comment Submit button"
422
msgstr ""
423
424
- #: admin/settings.php:448
425
msgid "After the Comment Submit button"
426
msgstr ""
427
428
- #: admin/settings.php:451
429
msgid "Show one-click subscription on profile page"
430
msgstr ""
431
432
- #: admin/settings.php:460
433
msgid "Barred Domains"
434
msgstr ""
435
436
- #: admin/settings.php:462
437
msgid ""
438
"Enter domains to bar from public subscriptions: <br /> (Use a new line for "
439
"each entry and omit the \"@\" symbol, for example email.com)"
440
msgstr ""
441
442
- #: admin/settings.php:468
443
msgid "Submit"
444
msgstr ""
445
446
- #: admin/settings.php:471
447
msgid "Reset Default"
448
msgstr ""
449
450
- #: admin/settings.php:472
451
msgid ""
452
"Use this to reset all options to their defaults. This <strong><em>will not</"
453
"em></strong> modify your list of subscribers."
454
msgstr ""
455
456
- #: admin/settings.php:474
457
msgid "RESET"
458
msgstr ""
459
@@ -902,73 +912,73 @@ msgstr ""
902
msgid "Options reset!"
903
msgstr ""
904
905
- #: classes/class-s2-core.php:625
906
msgid "Plain Text Excerpt Preview"
907
msgstr ""
908
909
- #: classes/class-s2-core.php:627
910
msgid "Plain Text Full Preview"
911
msgstr ""
912
913
- #: classes/class-s2-core.php:629
914
msgid "HTML Excerpt Preview"
915
msgstr ""
916
917
- #: classes/class-s2-core.php:631
918
msgid "HTML Full Preview"
919
msgstr ""
920
921
- #: classes/class-s2-core.php:1210
922
msgid "Registered User"
923
msgstr ""
924
925
- #: classes/class-s2-core.php:1215
926
msgid "Confirmed Public Subscriber"
927
msgstr ""
928
929
- #: classes/class-s2-core.php:1217
930
msgid "Unconfirmed Public Subscriber"
931
msgstr ""
932
933
- #: classes/class-s2-core.php:1254
934
msgid "Check here to Subscribe to email notifications for new posts"
935
msgstr ""
936
937
- #: classes/class-s2-core.php:1260
938
msgid ""
939
"By registering with this blog you are also agreeing to receive email "
940
"notifications for new posts but you can unsubscribe at anytime"
941
msgstr ""
942
943
- #: classes/class-s2-core.php:1286
944
msgid "Check here to Subscribe to notifications for new posts"
945
msgstr ""
946
947
- #: classes/class-s2-core.php:1376
948
msgid "Weekly"
949
msgstr ""
950
951
- #: classes/class-s2-core.php:1499 classes/class-s2-core.php:1500
952
msgid "Author"
953
msgstr ""
954
955
- #: classes/class-s2-core.php:1508
956
msgid "Posted on"
957
msgstr ""
958
959
- #: classes/class-s2-core.php:1512 classes/class-s2-core.php:1513
960
msgid "Posted in"
961
msgstr ""
962
963
- #: classes/class-s2-core.php:1518 classes/class-s2-core.php:1519
964
msgid "Tagged as"
965
msgstr ""
966
967
- #: classes/class-s2-core.php:1583
968
msgid "Digest Email"
969
msgstr ""
970
971
- #: classes/class-s2-core.php:1593
972
msgid "Digest Preview"
973
msgstr ""
974
@@ -980,31 +990,35 @@ msgstr ""
980
msgid "Enter email address..."
981
msgstr ""
982
983
- #: classes/class-s2-frontend.php:153
984
msgid "Subscription Confirmation"
985
msgstr ""
986
987
- #: classes/class-s2-frontend.php:191
988
msgid "New Subscription"
989
msgstr ""
990
991
- #: classes/class-s2-frontend.php:193
992
msgid "subscribed to email notifications!"
993
msgstr ""
994
995
- #: classes/class-s2-frontend.php:214
996
msgid "New Unsubscription"
997
msgstr ""
998
999
- #: classes/class-s2-frontend.php:216
1000
msgid "unsubscribed from email notifications!"
1001
msgstr ""
1002
1003
- #: classes/class-s2-frontend.php:242
1004
msgid "[Un]Subscribe to Posts"
1005
msgstr ""
1006
1007
- #: classes/class-s2-frontend.php:266 classes/class-s2-frontend.php:268
1008
msgid "Subscribe to this blog"
1009
msgstr ""
1010
@@ -1113,54 +1127,58 @@ msgstr ""
1113
msgid "(Un)Subscribe to Posts"
1114
msgstr ""
1115
1116
- #: include/widget.php:95
1117
msgid "Title"
1118
msgstr ""
1119
1120
- #: include/widget.php:97
1121
msgid "Div class name"
1122
msgstr ""
1123
1124
- #: include/widget.php:99
1125
msgid "Pre-Content"
1126
msgstr ""
1127
1128
- #: include/widget.php:101
1129
msgid "Post-Content"
1130
msgstr ""
1131
1132
- #: include/widget.php:103
1133
msgid "Text Box Size"
1134
msgstr ""
1135
1136
- #: include/widget.php:105
1137
msgid "Display options"
1138
msgstr ""
1139
1140
- #: include/widget.php:106
1141
msgid "Show complete form"
1142
msgstr ""
1143
1144
- #: include/widget.php:106
1145
msgid "Hide Subscribe button"
1146
msgstr ""
1147
1148
- #: include/widget.php:106
1149
msgid "Hide Unsubscribe button"
1150
msgstr ""
1151
1152
- #: include/widget.php:108
1153
msgid "Show as link"
1154
msgstr ""
1155
1156
- #: include/widget.php:112
1157
msgid "Post form content to page"
1158
msgstr ""
1159
1160
- #: include/widget.php:114
1161
msgid "Use Subscribe2 Default"
1162
msgstr ""
1163
1164
#: subscribe2.php:39
1165
#, php-format
1166
msgid ""
8
msgstr ""
9
"Project-Id-Version: PACKAGE VERSION\n"
10
"Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2012-06-23 21:30+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
+ #: admin/send_email.php:41
21
+ msgid "Preview message sent!"
22
+ msgstr ""
23
+
24
+ #: admin/send_email.php:46
25
msgid "Your email was empty"
26
msgstr ""
27
28
+ #: admin/send_email.php:57
29
msgid "Send an email to subscribers"
30
msgstr ""
31
32
+ #: admin/send_email.php:65
33
msgid "A message from"
34
msgstr ""
35
36
+ #: admin/send_email.php:70
37
msgid "Subject"
38
msgstr ""
39
40
+ #: admin/send_email.php:73
41
msgid "Recipients:"
42
msgstr ""
43
44
+ #: admin/send_email.php:77
45
msgid "Preview"
46
msgstr ""
47
48
+ #: admin/send_email.php:77
49
msgid "Send"
50
msgstr ""
51
52
+ #: admin/settings.php:18
53
+ msgid ""
54
+ "You appear to be sending notifications from an email address from a "
55
+ "different domain name to your blog, this may result in failed emails"
56
+ msgstr ""
57
+
58
+ #: admin/settings.php:36
59
msgid "Preview message(s) sent to logged in user"
60
msgstr ""
61
62
+ #: admin/settings.php:40
63
msgid ""
64
"The Digest Notification email contained no post information. No email was "
65
"sent"
66
msgstr ""
67
68
+ #: admin/settings.php:42
69
msgid "Attempt made to resend the Digest Notification email"
70
msgstr ""
71
72
+ #: admin/settings.php:211
73
msgid "Subscribe2 Settings"
74
msgstr ""
75
76
+ #: admin/settings.php:212
77
msgid "Plugin Blog"
78
msgstr ""
79
80
+ #: admin/settings.php:213
81
msgid "Make a donation via PayPal"
82
msgstr ""
83
84
+ #: admin/settings.php:225 admin/your_subscriptions.php:96
85
msgid "Notification Settings"
86
msgstr ""
87
88
+ #: admin/settings.php:226
89
msgid "Restrict the number of recipients per email to (0 for unlimited)"
90
msgstr ""
91
92
+ #: admin/settings.php:228 admin/settings.php:376
93
msgid "Edit"
94
msgstr ""
95
96
+ #: admin/settings.php:231 admin/settings.php:379
97
msgid "Update"
98
msgstr ""
99
100
+ #: admin/settings.php:232 admin/settings.php:380
101
msgid "Revert"
102
msgstr ""
103
104
+ #: admin/settings.php:234
105
msgid "Send Admins notifications for new"
106
msgstr ""
107
108
+ #: admin/settings.php:236
109
msgid "Subscriptions"
110
msgstr ""
111
112
+ #: admin/settings.php:238
113
msgid "Unsubscriptions"
114
msgstr ""
115
116
+ #: admin/settings.php:240
117
msgid "Both"
118
msgstr ""
119
120
+ #: admin/settings.php:242
121
msgid "Neither"
122
msgstr ""
123
124
+ #: admin/settings.php:244
125
msgid "Include theme CSS stylesheet in HTML notifications"
126
msgstr ""
127
128
+ #: admin/settings.php:246 admin/settings.php:252 admin/settings.php:266
129
+ #: admin/settings.php:271 admin/settings.php:421 admin/settings.php:426
130
+ #: admin/settings.php:440 admin/settings.php:447 admin/settings.php:459
131
#: admin/subscribers.php:339 admin/your_subscriptions.php:121
132
#: admin/your_subscriptions.php:161
133
msgid "Yes"
134
msgstr ""
135
136
+ #: admin/settings.php:248 admin/settings.php:254 admin/settings.php:268
137
+ #: admin/settings.php:273 admin/settings.php:418 admin/settings.php:423
138
+ #: admin/settings.php:428 admin/settings.php:442 admin/settings.php:449
139
+ #: admin/settings.php:456 admin/settings.php:461 admin/subscribers.php:341
140
#: admin/your_subscriptions.php:123 admin/your_subscriptions.php:165
141
msgid "No"
142
msgstr ""
143
144
+ #: admin/settings.php:250
145
msgid "Send Emails for Pages"
146
msgstr ""
147
148
+ #: admin/settings.php:258
149
msgid ""
150
"Subscribe2 will send email notifications for the following custom post types"
151
msgstr ""
152
153
+ #: admin/settings.php:264
154
msgid "Send Emails for Password Protected Posts"
155
msgstr ""
156
157
+ #: admin/settings.php:269
158
msgid "Send Emails for Private Posts"
159
msgstr ""
160
161
+ #: admin/settings.php:274
162
msgid "Send Email From"
163
msgstr ""
164
165
+ #: admin/settings.php:279
166
msgid "Send Emails"
167
msgstr ""
168
169
+ #: admin/settings.php:281
170
msgid "For digest notifications, date order for posts is"
171
msgstr ""
172
173
+ #: admin/settings.php:283
174
msgid "Descending"
175
msgstr ""
176
177
+ #: admin/settings.php:285
178
msgid "Ascending"
179
msgstr ""
180
181
+ #: admin/settings.php:287
182
msgid "Add Tracking Parameters to the Permalink"
183
msgstr ""
184
185
+ #: admin/settings.php:289
186
msgid "eg. utm_source=subscribe2&utm_medium=email&utm_campaign=postnotify"
187
msgstr ""
188
189
+ #: admin/settings.php:294
190
msgid "Email Templates"
191
msgstr ""
192
193
+ #: admin/settings.php:298
194
msgid "New Post email (must not be empty)"
195
msgstr ""
196
197
+ #: admin/settings.php:299 admin/settings.php:329 admin/settings.php:334
198
msgid "Subject Line"
199
msgstr ""
200
201
+ #: admin/settings.php:304
202
msgid "Send Email Preview"
203
msgstr ""
204
205
+ #: admin/settings.php:305
206
msgid "Message substitutions"
207
msgstr ""
208
209
+ #: admin/settings.php:307
210
msgid ""
211
"IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED"
212
msgstr ""
213
214
+ #: admin/settings.php:310
215
msgid "the post's title<br />(<i>for per-post emails only</i>)"
216
msgstr ""
217
218
+ #: admin/settings.php:311
219
msgid ""
220
"the excerpt or the entire post<br />(<i>based on the subscriber's "
221
"preferences</i>)"
222
msgstr ""
223
224
+ #: admin/settings.php:312
225
msgid ""
226
"the excerpt of the post and the time it was posted<br />(<i>for digest "
227
"emails only</i>)"
228
msgstr ""
229
230
+ #: admin/settings.php:313
231
msgid "a list of post titles<br />(<i>for digest emails only</i>)"
232
msgstr ""
233
234
+ #: admin/settings.php:314
235
msgid ""
236
"a list of post titles followed by links to the atricles<br />(<i>for digest "
237
"emails only</i>)"
238
msgstr ""
239
240
+ #: admin/settings.php:315
241
msgid "the post's permalink<br />(<i>for per-post emails only</i>)"
242
msgstr ""
243
244
+ #: admin/settings.php:316
245
msgid ""
246
"the post's permalink after conversion by TinyURL<br />(<i>for per-post "
247
"emails only</i>)"
248
msgstr ""
249
250
+ #: admin/settings.php:317
251
msgid "the date the post was made<br />(<i>for per-post emails only</i>)"
252
msgstr ""
253
254