Version Description
Download this release
Release Info
Developer | markjaquith |
Plugin | Subscribe to Comments |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.3
- extras/readme.html +0 -109
- extras/subscribe-to-comments.pot +0 -445
- readme.txt +4 -4
- subscribe-to-comments.php +1629 -1241
extras/readme.html
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
<html>
|
2 |
-
<head>
|
3 |
-
<title>Subscribe to Comments 2 for WordPress README</title>
|
4 |
-
</head>
|
5 |
-
<body>
|
6 |
-
<h1>Subscribe to Comments 2</h1>
|
7 |
-
|
8 |
-
<h2>Description</h2>
|
9 |
-
<p>Subscribe to Comments 2 is a WordPress plugin that allows commenters on an entry to subscribe to e-mail notifications for subsequent comments. It does <em>NOT</em> e-mail you new blog posts. For that functionality, use Skippy's <a href="http://www.skippy.net/blog/2005/02/17/subscribe2/">Subscribe2 plugin</a>.</p>
|
10 |
-
|
11 |
-
<h2>Links</h2>
|
12 |
-
<p>Here are some of the crucial Subscribe to Comments 2 links</p>
|
13 |
-
<ul>
|
14 |
-
<li><a href="http://txfx.net/code/wordpress/subscribe-to-comments/">Plugin's home</a></li>
|
15 |
-
<li><a href="http://dev.wp-plugins.org/newticket">Report Bugs or Suggest Features</a></li>
|
16 |
-
<li><a href="http://downloads.wordpress.org/plugin/subscribe-to-comments.zip">Latest Stable Version</a></li>
|
17 |
-
</ul>
|
18 |
-
|
19 |
-
<h2>Installation</h2>
|
20 |
-
<ol>
|
21 |
-
<li>Put <code>subscribe-to-comments.php</code> into <code>[wordpress_dir]/wp-content/plugins/</code></li>
|
22 |
-
<li><strong>If you are upgrading from a 2.0.x version of this plugin only,</strong> put <code>wp-subscription-manager.php</code> into your blog's root WordPress directory (the directory where <code>wp-config.php</code> resides)</li>
|
23 |
-
<li>Go into the WordPress admin interface and activate the plugin</li>
|
24 |
-
<li>Optional: if your WordPress theme doesn't have the <code>comment_form</code> hook, or if you would like to manually determine where in your comments form the subscribe checkbox appears, enter this where you would like it: <code><?php show_subscription_checkbox(); ?></code></li>
|
25 |
-
<li>Optional: If you would like to enable users to subscribe to comments without having to leave a comment, place this somewhere in your template, but make sure it is <strong>outside the comments form</strong>. A good place would be right after the ending <code></form></code> tag for the comments form: <code><?php show_manual_subscription_form(); ?></code></li>
|
26 |
-
</ol>
|
27 |
-
|
28 |
-
<h2>Notes</h2>
|
29 |
-
<ul>
|
30 |
-
<li>The <code>subscribe-to-comments.pot</code> file is for translators... normal users should disregard it</li>
|
31 |
-
<li>The only file that <em>must</em> be uploaded is the <code>subscribe-to-comments.php</code> file. The <code>wp-subscription-manager.php</code> file is for backwards compatability only. If you are installing the plugin for the first time, you don't need it. None of the other files in the <code>/readme-etc/</code> directory need to be uploaded</li>
|
32 |
-
<li>The function >?php comment_subscription_status(); ?> can be used within the comments loop to determine if a comment's author is subscribed or not. e.g.
|
33 |
-
<pre><code><?php if (comment_subscription_status()) { ?>
|
34 |
-
Subscribed
|
35 |
-
<?php } ?></code></pre></li>
|
36 |
-
<li>You need to be a logged-in WordPress user with the "manage_options" capability in order to search for subscriptions on random e-mail addresses or to remove a "do not mail" block.</li>
|
37 |
-
<li>The author of the post is always determined to be subscribed, and thus will never see the "subscribe" checkbox for his entries, but instead will see the "entry author" message.</li>
|
38 |
-
<li>Users are never e-mailed notifications for their own comments. (important that you know that for testing out the plugin)</li>
|
39 |
-
<li>The text shown next to the checkbox for unsubscribed users, the "you are subscribed" text, and the "you are the author of this entry" text can all be customized in the options (Options -> Subscribe to Comments).</li>
|
40 |
-
<li>By default, the "subscribe" checkbox is unchecked, but you can change that in the options (i.e. so that it is checked by default).</li>
|
41 |
-
<li>The following CSS can be used with the WordPress default "Kubrick" theme if you want to use a custom style for the Subscription Manager and should be added to your <code>style.css</code> file:<br /><br />
|
42 |
-
<pre>
|
43 |
-
/* SUBSCRIPTION MANAGER STYLE */
|
44 |
-
.subscription-manager {
|
45 |
-
padding: 10px 0 20px 0;
|
46 |
-
margin: 5px 0 0 55px;
|
47 |
-
width: 650px;
|
48 |
-
}
|
49 |
-
|
50 |
-
div.wrap {
|
51 |
-
background: #fafafa;
|
52 |
-
padding: 5px 10px;
|
53 |
-
margin: 20px 0;
|
54 |
-
border: 1px solid #ccc;
|
55 |
-
}
|
56 |
-
|
57 |
-
div.wrap h2 {
|
58 |
-
margin: .5em 0 1em 0;
|
59 |
-
border-bottom: 2px solid #589bd2;
|
60 |
-
}
|
61 |
-
|
62 |
-
div.wrap fieldset {
|
63 |
-
border: 1px solid #555;
|
64 |
-
margin: 1em 0;
|
65 |
-
padding: 5px 10px;
|
66 |
-
}
|
67 |
-
|
68 |
-
div.wrap fieldset legend {
|
69 |
-
font-weight: bold;
|
70 |
-
font-size: small;
|
71 |
-
}
|
72 |
-
|
73 |
-
div.wrap p.submit {
|
74 |
-
text-align: right;
|
75 |
-
}
|
76 |
-
|
77 |
-
|
78 |
-
.updated {
|
79 |
-
background: #B9D6EF;
|
80 |
-
border: 1px solid #589bd2;
|
81 |
-
margin: 1em 5% 10px;
|
82 |
-
padding: 0 1em;
|
83 |
-
}
|
84 |
-
|
85 |
-
.updated-error {
|
86 |
-
background-color: #FFA3A3;
|
87 |
-
border: 1px solid #FF5D5D;
|
88 |
-
}
|
89 |
-
|
90 |
-
div.wrap form {
|
91 |
-
margin: 0;
|
92 |
-
padding: 0;
|
93 |
-
}
|
94 |
-
|
95 |
-
div.warp li {
|
96 |
-
margin-bottom: 6px;
|
97 |
-
line-height: 130%;
|
98 |
-
}
|
99 |
-
/* END SUBSCRIPTION MANAGER STYLE */
|
100 |
-
|
101 |
-
</pre></li>
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
</ul>
|
107 |
-
|
108 |
-
</body>
|
109 |
-
</html>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
extras/subscribe-to-comments.pot
DELETED
@@ -1,445 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Subscribe to Comments 2.0\n"
|
4 |
-
"POT-Creation-Date: 2007-01-23 07:01-0500\n"
|
5 |
-
"Last-Translator: Mark Jaquith <mark.i18n@txfx.net>\n"
|
6 |
-
"Language-Team: Mark Jaquith <mark.wordpress@txfx.net>\n"
|
7 |
-
"MIME-Version: 1.0\n"
|
8 |
-
"Content-Type: text/plain; charset=utf-8\n"
|
9 |
-
"Content-Transfer-Encoding: 8bit\n"
|
10 |
-
|
11 |
-
#: subscribe-to-comments.php:68
|
12 |
-
msgid "<strong>Error: </strong>"
|
13 |
-
msgstr ""
|
14 |
-
|
15 |
-
#: subscribe-to-comments.php:83
|
16 |
-
msgid "Subscribe without commenting"
|
17 |
-
msgstr ""
|
18 |
-
|
19 |
-
#: subscribe-to-comments.php:85
|
20 |
-
msgid "E-Mail:"
|
21 |
-
msgstr ""
|
22 |
-
|
23 |
-
#: subscribe-to-comments.php:87
|
24 |
-
msgid "Subscribe"
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
#: subscribe-to-comments.php:141
|
28 |
-
msgid "\"From\" name for notifications:"
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: subscribe-to-comments.php:142
|
32 |
-
msgid "\"From\" e-mail addresss for notifications:"
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: subscribe-to-comments.php:143
|
36 |
-
msgid "\"Subscribe\" box should be checked by default"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: subscribe-to-comments.php:144
|
40 |
-
msgid ""
|
41 |
-
"Do a CSS \"clear\" on the subscription checkbox/message (uncheck this if the "
|
42 |
-
"checkbox/message appears in a strange location in your theme)"
|
43 |
-
msgstr ""
|
44 |
-
|
45 |
-
#: subscribe-to-comments.php:147
|
46 |
-
msgid "Comment Form Text"
|
47 |
-
msgstr ""
|
48 |
-
|
49 |
-
#: subscribe-to-comments.php:149
|
50 |
-
msgid ""
|
51 |
-
"Customize the messages shown to different people. Use <code>[manager_link]</"
|
52 |
-
"code> to insert the URI to the Subscription Manager."
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: subscribe-to-comments.php:153
|
56 |
-
msgid "Not subscribed"
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: subscribe-to-comments.php:155
|
60 |
-
msgid "Subscribed"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: subscribe-to-comments.php:157
|
64 |
-
msgid "Entry Author"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: subscribe-to-comments.php:163
|
68 |
-
msgid "Use custom style for Subscription Manager"
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: subscribe-to-comments.php:165
|
72 |
-
msgid ""
|
73 |
-
"These settings only matter if you are using a custom style. <code>"
|
74 |
-
"[theme_path]</code> will be replaced with the path to your current theme."
|
75 |
-
msgstr ""
|
76 |
-
|
77 |
-
#: subscribe-to-comments.php:168
|
78 |
-
msgid "Path to header:"
|
79 |
-
msgstr ""
|
80 |
-
|
81 |
-
#: subscribe-to-comments.php:169
|
82 |
-
msgid "Path to sidebar:"
|
83 |
-
msgstr ""
|
84 |
-
|
85 |
-
#: subscribe-to-comments.php:170
|
86 |
-
msgid "Path to footer:"
|
87 |
-
msgstr ""
|
88 |
-
|
89 |
-
#: subscribe-to-comments.php:173
|
90 |
-
msgid "HTML for before the subscription manager:"
|
91 |
-
msgstr ""
|
92 |
-
|
93 |
-
#: subscribe-to-comments.php:174
|
94 |
-
msgid "HTML for after the subscription manager:"
|
95 |
-
msgstr ""
|
96 |
-
|
97 |
-
#: subscribe-to-comments.php:199
|
98 |
-
msgid "Options saved."
|
99 |
-
msgstr ""
|
100 |
-
|
101 |
-
#: subscribe-to-comments.php:206
|
102 |
-
msgid "Update Options »"
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
#: subscribe-to-comments.php:377
|
106 |
-
msgid "Please provide a valid e-mail address."
|
107 |
-
msgstr ""
|
108 |
-
|
109 |
-
#: subscribe-to-comments.php:381
|
110 |
-
msgid "This e-mail address may not be subscribed"
|
111 |
-
msgstr ""
|
112 |
-
|
113 |
-
#: subscribe-to-comments.php:387 subscribe-to-comments.php:403
|
114 |
-
msgid "You appear to be already subscribed to this entry."
|
115 |
-
msgstr ""
|
116 |
-
|
117 |
-
#: subscribe-to-comments.php:393
|
118 |
-
msgid "Comments are not allowed on this entry."
|
119 |
-
msgstr ""
|
120 |
-
|
121 |
-
#: subscribe-to-comments.php:597
|
122 |
-
#, php-format
|
123 |
-
msgid "There is a new comment on the post \"%s\""
|
124 |
-
msgstr ""
|
125 |
-
|
126 |
-
#: subscribe-to-comments.php:598
|
127 |
-
#, php-format
|
128 |
-
msgid "Author: %s\n"
|
129 |
-
msgstr ""
|
130 |
-
|
131 |
-
#: subscribe-to-comments.php:599
|
132 |
-
msgid "Comment:\n"
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: subscribe-to-comments.php:600
|
136 |
-
msgid "See all comments on this post here:\n"
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: subscribe-to-comments.php:603
|
140 |
-
msgid ""
|
141 |
-
"To manage your subscriptions or to block all notifications from this site, "
|
142 |
-
"click the link below:\n"
|
143 |
-
msgstr ""
|
144 |
-
|
145 |
-
#: subscribe-to-comments.php:606
|
146 |
-
#, php-format
|
147 |
-
msgid "New Comment On: %s"
|
148 |
-
msgstr ""
|
149 |
-
|
150 |
-
#: subscribe-to-comments.php:625
|
151 |
-
msgid "E-mail change confirmation"
|
152 |
-
msgstr ""
|
153 |
-
|
154 |
-
#: subscribe-to-comments.php:626
|
155 |
-
#, php-format
|
156 |
-
msgid ""
|
157 |
-
"You are receiving this message to confirm a change of e-mail address for "
|
158 |
-
"your subscriptions at \"%s\"\n"
|
159 |
-
"\n"
|
160 |
-
msgstr ""
|
161 |
-
|
162 |
-
#: subscribe-to-comments.php:627
|
163 |
-
#, php-format
|
164 |
-
msgid ""
|
165 |
-
"To change your e-mail address to %s, click this link:\n"
|
166 |
-
"\n"
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: subscribe-to-comments.php:629 subscribe-to-comments.php:641
|
170 |
-
msgid "If you did not request this action, please disregard this message."
|
171 |
-
msgstr ""
|
172 |
-
|
173 |
-
#: subscribe-to-comments.php:637
|
174 |
-
msgid "E-mail block confirmation"
|
175 |
-
msgstr ""
|
176 |
-
|
177 |
-
#: subscribe-to-comments.php:638
|
178 |
-
#, php-format
|
179 |
-
msgid ""
|
180 |
-
"You are receiving this message to confirm that you no longer wish to receive "
|
181 |
-
"e-mail comment notifications from \"%s\"\n"
|
182 |
-
"\n"
|
183 |
-
msgstr ""
|
184 |
-
|
185 |
-
#: subscribe-to-comments.php:639
|
186 |
-
msgid ""
|
187 |
-
"To cancel all future notifications for this address, click this link:\n"
|
188 |
-
"\n"
|
189 |
-
msgstr ""
|
190 |
-
|
191 |
-
#: subscribe-to-comments.php:679
|
192 |
-
msgid "click here"
|
193 |
-
msgstr ""
|
194 |
-
|
195 |
-
#: subscribe-to-comments.php:701
|
196 |
-
msgid "Notify me of followup comments via e-mail"
|
197 |
-
msgstr ""
|
198 |
-
|
199 |
-
#: subscribe-to-comments.php:701
|
200 |
-
msgid ""
|
201 |
-
"You are subscribed to this entry. <a href=\"[manager_link]\">Manage your "
|
202 |
-
"subscriptions</a>."
|
203 |
-
msgstr ""
|
204 |
-
|
205 |
-
#: subscribe-to-comments.php:701
|
206 |
-
msgid ""
|
207 |
-
"You are the author of this entry. <a href=\"[manager_link]\">Manage "
|
208 |
-
"subscriptions</a>."
|
209 |
-
msgstr ""
|
210 |
-
|
211 |
-
#: subscribe-to-comments.php:780 subscribe-to-comments.php:946
|
212 |
-
msgid "Comment Subscription Manager"
|
213 |
-
msgstr ""
|
214 |
-
|
215 |
-
#: subscribe-to-comments.php:780 subscribe-to-comments.php:1124
|
216 |
-
msgid "Subscriptions"
|
217 |
-
msgstr ""
|
218 |
-
|
219 |
-
#: subscribe-to-comments.php:785
|
220 |
-
msgid "Subscribe to Comments"
|
221 |
-
msgstr ""
|
222 |
-
|
223 |
-
#: subscribe-to-comments.php:854
|
224 |
-
msgid "You may not access this page without a valid key."
|
225 |
-
msgstr ""
|
226 |
-
|
227 |
-
#: subscribe-to-comments.php:862
|
228 |
-
#, php-format
|
229 |
-
msgid ""
|
230 |
-
"All notifications that were formerly sent to <strong>%s</strong> will now be "
|
231 |
-
"sent to <strong>%s</strong>!"
|
232 |
-
msgstr ""
|
233 |
-
|
234 |
-
#: subscribe-to-comments.php:874
|
235 |
-
#, php-format
|
236 |
-
msgid "<strong>%s</strong> %s removed successfully."
|
237 |
-
msgstr ""
|
238 |
-
|
239 |
-
#: subscribe-to-comments.php:874
|
240 |
-
msgid "subscriptions"
|
241 |
-
msgstr ""
|
242 |
-
|
243 |
-
#: subscribe-to-comments.php:874
|
244 |
-
msgid "subscription"
|
245 |
-
msgstr ""
|
246 |
-
|
247 |
-
#: subscribe-to-comments.php:879
|
248 |
-
#, php-format
|
249 |
-
msgid "The block on <strong>%s</strong> has been successfully removed."
|
250 |
-
msgstr ""
|
251 |
-
|
252 |
-
#: subscribe-to-comments.php:881
|
253 |
-
#, php-format
|
254 |
-
msgid "<strong>%s</strong> isn't blocked!"
|
255 |
-
msgstr ""
|
256 |
-
|
257 |
-
#: subscribe-to-comments.php:886
|
258 |
-
#, php-format
|
259 |
-
msgid ""
|
260 |
-
"<strong>%s</strong> has been blocked from receiving notifications. You will "
|
261 |
-
"have to have the administrator remove the block before you will be able to "
|
262 |
-
"change your notification address."
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: subscribe-to-comments.php:889
|
266 |
-
#, php-format
|
267 |
-
msgid ""
|
268 |
-
"Your change of e-mail request was successfully received. Please check your "
|
269 |
-
"old account (<strong>%s</strong>) in order to confirm the change."
|
270 |
-
msgstr ""
|
271 |
-
|
272 |
-
#: subscribe-to-comments.php:894
|
273 |
-
#, php-format
|
274 |
-
msgid ""
|
275 |
-
"Your request to block <strong>%s</strong> from receiving any further "
|
276 |
-
"notifications has been received. In order for you to complete the block, "
|
277 |
-
"please check your e-mail and click on the link in the message that has been "
|
278 |
-
"sent to you."
|
279 |
-
msgstr ""
|
280 |
-
|
281 |
-
#: subscribe-to-comments.php:898
|
282 |
-
#, php-format
|
283 |
-
msgid "<strong>%s</strong> has been successfully subscribed to %s"
|
284 |
-
msgstr ""
|
285 |
-
|
286 |
-
#: subscribe-to-comments.php:903
|
287 |
-
#, php-format
|
288 |
-
msgid ""
|
289 |
-
"<strong>%s</strong> has been added to the \"do not mail\" list. You will no "
|
290 |
-
"longer receive any notifications from this site. If this was done in error, "
|
291 |
-
"please contact the <a href=\"mailto:%s\">site administrator</a> to remove "
|
292 |
-
"this block."
|
293 |
-
msgstr ""
|
294 |
-
|
295 |
-
#: subscribe-to-comments.php:905
|
296 |
-
#, php-format
|
297 |
-
msgid "<strong>%s</strong> has already been blocked!"
|
298 |
-
msgstr ""
|
299 |
-
|
300 |
-
#: subscribe-to-comments.php:921
|
301 |
-
#, php-format
|
302 |
-
msgid "%s Comment Subscription Manager"
|
303 |
-
msgstr ""
|
304 |
-
|
305 |
-
#: subscribe-to-comments.php:949
|
306 |
-
#, php-format
|
307 |
-
msgid "Return to the page you were viewing: %s"
|
308 |
-
msgstr ""
|
309 |
-
|
310 |
-
#: subscribe-to-comments.php:960
|
311 |
-
msgid "Remove Block"
|
312 |
-
msgstr ""
|
313 |
-
|
314 |
-
#: subscribe-to-comments.php:963
|
315 |
-
#, php-format
|
316 |
-
msgid ""
|
317 |
-
"Click the button below to remove the block on <strong>%s</strong>. This "
|
318 |
-
"should only be done if the user has specifically requested it."
|
319 |
-
msgstr ""
|
320 |
-
|
321 |
-
#: subscribe-to-comments.php:971
|
322 |
-
msgid "Remove Block »"
|
323 |
-
msgstr ""
|
324 |
-
|
325 |
-
#: subscribe-to-comments.php:979
|
326 |
-
msgid "Blocked"
|
327 |
-
msgstr ""
|
328 |
-
|
329 |
-
#: subscribe-to-comments.php:982
|
330 |
-
#, php-format
|
331 |
-
msgid ""
|
332 |
-
"You have indicated that you do not wish to receive any notifications at "
|
333 |
-
"<strong>%s</strong> from this site. If this is incorrect, or if you wish to "
|
334 |
-
"have the block removed, please contact the <a href=\"mailto:%s\">site "
|
335 |
-
"administrator</a>."
|
336 |
-
msgstr ""
|
337 |
-
|
338 |
-
#: subscribe-to-comments.php:997
|
339 |
-
#, php-format
|
340 |
-
msgid "<strong>%s</strong> is not subscribed to any posts on this site."
|
341 |
-
msgstr ""
|
342 |
-
|
343 |
-
#: subscribe-to-comments.php:999
|
344 |
-
#, php-format
|
345 |
-
msgid "<strong>%s</strong> is not a valid e-mail address."
|
346 |
-
msgstr ""
|
347 |
-
|
348 |
-
#: subscribe-to-comments.php:1012
|
349 |
-
msgid "« Back"
|
350 |
-
msgstr ""
|
351 |
-
|
352 |
-
#: subscribe-to-comments.php:1015
|
353 |
-
msgid "Find Subscriptions"
|
354 |
-
msgstr ""
|
355 |
-
|
356 |
-
#: subscribe-to-comments.php:1018
|
357 |
-
msgid "Enter an e-mail address to view its subscriptions or undo a block."
|
358 |
-
msgstr ""
|
359 |
-
|
360 |
-
#: subscribe-to-comments.php:1026
|
361 |
-
msgid "Search »"
|
362 |
-
msgstr ""
|
363 |
-
|
364 |
-
#: subscribe-to-comments.php:1034
|
365 |
-
msgid "Top Subscriber List"
|
366 |
-
msgstr ""
|
367 |
-
|
368 |
-
#: subscribe-to-comments.php:1036
|
369 |
-
msgid "Subscriber List"
|
370 |
-
msgstr ""
|
371 |
-
|
372 |
-
#: subscribe-to-comments.php:1055
|
373 |
-
msgid "Show all subscribers"
|
374 |
-
msgstr ""
|
375 |
-
|
376 |
-
#: subscribe-to-comments.php:1057
|
377 |
-
msgid ""
|
378 |
-
"Show list of subscribers in <code>CC:</code>-field format (for bulk e-"
|
379 |
-
"mailing)"
|
380 |
-
msgstr ""
|
381 |
-
|
382 |
-
#: subscribe-to-comments.php:1059
|
383 |
-
msgid "« Back to regular view"
|
384 |
-
msgstr ""
|
385 |
-
|
386 |
-
#: subscribe-to-comments.php:1074
|
387 |
-
msgid "Top Subscribed Posts"
|
388 |
-
msgstr ""
|
389 |
-
|
390 |
-
#: subscribe-to-comments.php:1127
|
391 |
-
#, php-format
|
392 |
-
msgid ""
|
393 |
-
"<strong>%s</strong> is subscribed to the posts listed below. To unsubscribe "
|
394 |
-
"to one or more posts, click the checkbox next to the title, then click "
|
395 |
-
"\"Remove Selected Subscription(s)\" at the bottom of the list."
|
396 |
-
msgstr ""
|
397 |
-
|
398 |
-
#: subscribe-to-comments.php:1141
|
399 |
-
msgid "Invert Checkbox Selection"
|
400 |
-
msgstr ""
|
401 |
-
|
402 |
-
#: subscribe-to-comments.php:1145
|
403 |
-
msgid "Remove Selected Subscription(s) »"
|
404 |
-
msgstr ""
|
405 |
-
|
406 |
-
#: subscribe-to-comments.php:1152
|
407 |
-
msgid "Advanced Options"
|
408 |
-
msgstr ""
|
409 |
-
|
410 |
-
#: subscribe-to-comments.php:1155
|
411 |
-
msgid "Block All Notifications"
|
412 |
-
msgstr ""
|
413 |
-
|
414 |
-
#: subscribe-to-comments.php:1162
|
415 |
-
#, php-format
|
416 |
-
msgid ""
|
417 |
-
"If you would like <strong>%s</strong> to be blocked from receiving any "
|
418 |
-
"notifications from this site, click the button below. This should be "
|
419 |
-
"reserved for cases where someone is signing you up for notifications without "
|
420 |
-
"your consent."
|
421 |
-
msgstr ""
|
422 |
-
|
423 |
-
#: subscribe-to-comments.php:1166
|
424 |
-
msgid "Block Notifications »"
|
425 |
-
msgstr ""
|
426 |
-
|
427 |
-
#: subscribe-to-comments.php:1172
|
428 |
-
msgid "Change E-mail Address"
|
429 |
-
msgstr ""
|
430 |
-
|
431 |
-
#: subscribe-to-comments.php:1179
|
432 |
-
#, php-format
|
433 |
-
msgid ""
|
434 |
-
"If you would like to change the e-mail address for your subscriptions, enter "
|
435 |
-
"the new address below. You will be required to verify this request by "
|
436 |
-
"clicking a special link sent to your current address (<strong>%s</strong>)."
|
437 |
-
msgstr ""
|
438 |
-
|
439 |
-
#: subscribe-to-comments.php:1183
|
440 |
-
msgid "New E-mail Address:"
|
441 |
-
msgstr ""
|
442 |
-
|
443 |
-
#: subscribe-to-comments.php:1188
|
444 |
-
msgid "Change E-mail Address »"
|
445 |
-
msgstr ""
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
Â
=== Subscribe to Comments ===
|
2 |
Â
Tags: comments, subscription, email
|
3 |
-
Contributors: markjaquith
|
4 |
-
Requires at least:
|
5 |
-
Tested up to:
|
6 |
-
Stable tag:
|
7 |
Â
|
8 |
Â
Subscribe to Comments allows commenters on an entry to subscribe to e-mail notifications for subsequent comments.
|
9 |
Â
|
1 |
Â
=== Subscribe to Comments ===
|
2 |
Â
Tags: comments, subscription, email
|
3 |
+
Contributors: markjaquith, joen
|
4 |
+
Requires at least: 2.9
|
5 |
+
Tested up to: 4.3
|
6 |
+
Stable tag: 2.1.2
|
7 |
Â
|
8 |
Â
Subscribe to Comments allows commenters on an entry to subscribe to e-mail notifications for subsequent comments.
|
9 |
Â
|
subscribe-to-comments.php
CHANGED
@@ -1,1241 +1,1629 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Subscribe To Comments
|
4 |
-
Version: 2.
|
5 |
-
Plugin URI: http://txfx.net/
|
6 |
-
Description: Allows readers to receive notifications of new comments that are posted to an entry.
|
7 |
-
Author: Mark Jaquith
|
8 |
-
Author URI: http://
|
9 |
-
*/
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
<
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
<?php
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
$
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
$
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
}
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
$this->
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
$
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
$
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
$
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
$this->
|
354 |
-
$
|
355 |
-
|
356 |
-
$this->
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
if (
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
if (
|
393 |
-
$
|
394 |
-
$
|
395 |
-
}
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
$email
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
$
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
if (
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
}
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
return
|
487 |
-
}
|
488 |
-
|
489 |
-
|
490 |
-
function
|
491 |
-
global $
|
492 |
-
if (
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
$
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
$
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
}
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
$
|
591 |
-
|
592 |
-
$
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
$
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
if (
|
636 |
-
|
637 |
-
$
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
$
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
$
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
$
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
$
|
757 |
-
$
|
758 |
-
|
759 |
-
|
760 |
-
}
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
$
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
$
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
}
|
820 |
-
|
821 |
-
|
822 |
-
function
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
$
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
)
|
854 |
-
|
855 |
-
if (
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
}
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
$
|
873 |
-
$
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
</
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Subscribe To Comments
|
4 |
+
Version: 2.3
|
5 |
+
Plugin URI: http://txfx.net/wordpress-plugins/subscribe-to-comments/
|
6 |
+
Description: Allows readers to choose to receive notifications of new comments that are posted to an entry.
|
7 |
+
Author: Mark Jaquith
|
8 |
+
Author URI: http://coveredwebservices.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Returns the CWS_STC singleton object
|
18 |
+
* @return CWS_STC the instantiated CWS_STC object
|
19 |
+
*/
|
20 |
+
function _stc() {
|
21 |
+
global $_cws_stc, $sg_subscribe;
|
22 |
+
if ( !isset( $_cws_stc ) || !is_object( $_cws_stc ) ) {
|
23 |
+
/**
|
24 |
+
* @global CWS_STC $_cws_stc
|
25 |
+
*/
|
26 |
+
$_cws_stc = new CWS_STC;
|
27 |
+
/**
|
28 |
+
* @global CWS_STC $sg_subscribe
|
29 |
+
* @deprecated
|
30 |
+
*/
|
31 |
+
$sg_subscribe = &$_cws_stc; // Backwards compat
|
32 |
+
}
|
33 |
+
return $_cws_stc;
|
34 |
+
}
|
35 |
+
|
36 |
+
// Backwards Compat
|
37 |
+
function show_subscription_checkbox( $id=0 ) {
|
38 |
+
_stc()->echo_add_checkbox();
|
39 |
+
}
|
40 |
+
|
41 |
+
function show_manual_subscription_form() {
|
42 |
+
global $id, $sg_subscribe, $user_email;
|
43 |
+
_stc()->show_errors( 'solo_subscribe', '<div class="solo-subscribe-errors">', '</div>', __( '<strong>Error: </strong>', 'subscribe-to-comments' ), '<br />' );
|
44 |
+
|
45 |
+
if ( !_stc()->current_viewer_subscription_status() ) :
|
46 |
+
get_currentuserinfo(); ?>
|
47 |
+
|
48 |
+
<form action="" method="post">
|
49 |
+
<input type="hidden" name="solo-comment-subscribe" value="solo-comment-subscribe" />
|
50 |
+
<input type="hidden" name="postid" value="<?php echo absint( $id ); ?>" />
|
51 |
+
<input type="hidden" name="ref" value="<?php echo esc_url( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); ?>" />
|
52 |
+
|
53 |
+
<p class="solo-subscribe-to-comments">
|
54 |
+
<?php _e( 'Subscribe without commenting', 'subscribe-to-comments' ); ?>
|
55 |
+
<br />
|
56 |
+
<label for="solo-subscribe-email"><?php _e( 'E-Mail:', 'subscribe-to-comments' ); ?>
|
57 |
+
<input type="text" name="email" id="solo-subscribe-email" size="22" value="<?php echo esc_attr( $user_email ); ?>" /></label>
|
58 |
+
<input type="submit" name="submit" value="<?php _e( 'Subscribe', 'subscribe-to-comments' ); ?>" />
|
59 |
+
</p>
|
60 |
+
</form>
|
61 |
+
|
62 |
+
<?php endif;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Returns the subscription status of the current comment in the comments loop
|
67 |
+
* @return bool
|
68 |
+
*/
|
69 |
+
function comment_subscription_status() {
|
70 |
+
global $comment;
|
71 |
+
return !!_stc()->is_subscribed( $comment->comment_ID );
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
class CWS_STC {
|
93 |
+
var $errors;
|
94 |
+
var $messages;
|
95 |
+
var $bid_post_subscriptions;
|
96 |
+
var $email_subscriptions;
|
97 |
+
var $subscriber_email;
|
98 |
+
var $site_email;
|
99 |
+
var $site_name;
|
100 |
+
var $standalone;
|
101 |
+
var $form_action;
|
102 |
+
var $checkbox_shown;
|
103 |
+
var $use_wp_style;
|
104 |
+
var $header;
|
105 |
+
var $sidebar;
|
106 |
+
var $footer;
|
107 |
+
var $clear_both;
|
108 |
+
var $before_manager;
|
109 |
+
var $after_manager;
|
110 |
+
var $email;
|
111 |
+
var $new_email;
|
112 |
+
var $ref;
|
113 |
+
var $key;
|
114 |
+
var $key_type;
|
115 |
+
var $action;
|
116 |
+
var $default_subscribed;
|
117 |
+
var $not_subscribed_text;
|
118 |
+
var $subscribed_text;
|
119 |
+
var $author_text;
|
120 |
+
var $subscribed_format;
|
121 |
+
var $salt;
|
122 |
+
var $settings;
|
123 |
+
var $version = '2.3-bleeding';
|
124 |
+
var $is_multisite;
|
125 |
+
var $ms_table;
|
126 |
+
|
127 |
+
function __construct() {
|
128 |
+
global $wpdb;
|
129 |
+
// Multisite code is disabled. It exists so that adventurous blog networks can play with it they like.
|
130 |
+
// IT IS NOT SUPPORTED. IT MAY BURN YOUR HOUSE DOWN.
|
131 |
+
$this->is_multisite = defined( 'STC_MULTISITE' ) && STC_MULTISITE;
|
132 |
+
if ( $this->is_multisite() )
|
133 |
+
$this->ms_table = $wpdb->base_prefix . 'comment_subscriptions';
|
134 |
+
$this->db_upgrade_check();
|
135 |
+
|
136 |
+
$this->register_hooks();
|
137 |
+
register_uninstall_hook( __FILE__, 'cws_stc_uninstall_hook' );
|
138 |
+
|
139 |
+
$this->settings = $this->get_options();
|
140 |
+
|
141 |
+
$this->salt = $this->settings['salt'];
|
142 |
+
$this->site_email = ( is_email( $this->settings['email'] ) && $this->settings['email'] != 'email@example.com' ) ? $this->settings['email'] : get_bloginfo( 'admin_email' );
|
143 |
+
$this->site_name = ( $this->settings['name'] != 'YOUR NAME' && !empty( $this->settings['name'] ) ) ? $this->settings['name'] : get_bloginfo( 'name' );
|
144 |
+
$this->default_subscribed = ( isset($this->settings['default_subscribed']) ) ? true : false;
|
145 |
+
|
146 |
+
$this->not_subscribed_text = $this->settings['not_subscribed_text'];
|
147 |
+
$this->subscribed_text = $this->settings['subscribed_text'];
|
148 |
+
$this->author_text = $this->settings['author_text'];
|
149 |
+
$this->subscribed_format = $this->settings['subscribed_format'];
|
150 |
+
$this->clear_both = $this->settings['clear_both'];
|
151 |
+
|
152 |
+
$this->errors = '';
|
153 |
+
$this->bid_post_subscriptions = array();
|
154 |
+
$this->email_subscriptions = '';
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Registers this plugin's WordPress hooks
|
159 |
+
*/
|
160 |
+
function register_hooks() {
|
161 |
+
/*
|
162 |
+
This will be overridden if the user manually places the function
|
163 |
+
in the comments form before the comment_form do_action() call
|
164 |
+
or if the user has a theme that supports a hookable comments form
|
165 |
+
*/
|
166 |
+
add_action( 'comment_form', array( $this, 'echo_add_checkbox' ));
|
167 |
+
// Hook in to themes that use comment_form()
|
168 |
+
add_filter( 'comment_form_defaults', array( $this, 'add_checkbox_to_default' ));
|
169 |
+
|
170 |
+
// priority is very low (50) because we want to let anti-spam plugins have their way first.
|
171 |
+
add_action( 'comment_post', array( $this, 'send_notifications' ));
|
172 |
+
add_action( 'comment_post', array( $this, 'maybe_add_subscriber' ));
|
173 |
+
add_action( 'wp_set_comment_status', array( $this, 'send_notifications' ));
|
174 |
+
add_action( 'admin_menu', array( $this, 'add_admin_menu' ));
|
175 |
+
add_action( 'admin_head', array( $this, 'admin_head' ));
|
176 |
+
add_action( 'edit_comment', array( $this, 'on_edit' ));
|
177 |
+
add_action( 'delete_comment', array( $this, 'on_delete' ));
|
178 |
+
add_filter( 'the_content', array( $this, 'manager' ));
|
179 |
+
|
180 |
+
add_filter( 'get_comment_author_link', 'stc_comment_author_filter' );
|
181 |
+
|
182 |
+
// save users' checkbox preference
|
183 |
+
add_filter( 'preprocess_comment', 'stc_checkbox_state', 1 );
|
184 |
+
|
185 |
+
// detect "subscribe without commenting" attempts
|
186 |
+
add_action( 'init', array( $this, 'maybe_solo_subscribe' ) );
|
187 |
+
|
188 |
+
if ( isset( $_REQUEST['wp-subscription-manager'] ) )
|
189 |
+
add_action( 'template_redirect', array( $this, 'single' ) );
|
190 |
+
}
|
191 |
+
|
192 |
+
function manager( $content ) {
|
193 |
+
global $post;
|
194 |
+
if ( $post->ID == $this->get_manage_id() ) {
|
195 |
+
$content = '';
|
196 |
+
ob_start();
|
197 |
+
sg_subscribe_admin( true );
|
198 |
+
$content = ob_get_clean();
|
199 |
+
}
|
200 |
+
return $content;
|
201 |
+
}
|
202 |
+
|
203 |
+
function get_manage_id() {
|
204 |
+
if ( !isset ($this->settings['manage_id']) || !get_post( $this->settings['manage_id'] ) ) {
|
205 |
+
$this->settings['manage_id'] = wp_insert_post( array(
|
206 |
+
'post_title' => __( 'Comment Manager', 'subscribe-to-comments' ),
|
207 |
+
'post_type' => 'stc',
|
208 |
+
'post_status' => 'publish',
|
209 |
+
'comment_status' => 'closed',
|
210 |
+
'ping_status' => 'closed'
|
211 |
+
) );
|
212 |
+
$this->update_settings( $this->settings );
|
213 |
+
}
|
214 |
+
// wp_delete_post( $this->settings['manage_id'] );
|
215 |
+
// die('deleted');
|
216 |
+
return $this->settings['manage_id'];
|
217 |
+
}
|
218 |
+
|
219 |
+
function wp_title( $title, $sep, $reverse ) {
|
220 |
+
if ( 'right' == $reverse )
|
221 |
+
return __( 'Comment Subscription Manager' ) . ' ' . $sep . ' ';
|
222 |
+
else
|
223 |
+
return ' ' . $sep . ' ' . __( 'Comment Subscription Manager' );
|
224 |
+
}
|
225 |
+
|
226 |
+
function standalone_css() {
|
227 |
+
if ( 'twentyten' == get_option( 'template' ) ) {
|
228 |
+
?>
|
229 |
+
<style>
|
230 |
+
.entry-meta, .entry-utility { display: none; }
|
231 |
+
</style>
|
232 |
+
<?php
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
function single() {
|
237 |
+
query_posts( array(
|
238 |
+
'post_type' => 'stc',
|
239 |
+
'p' => $this->get_manage_id(),
|
240 |
+
'post_status' => 'publish'
|
241 |
+
) );
|
242 |
+
add_action( 'wp_title', array( $this, 'wp_title' ), 10, 5 );
|
243 |
+
add_action( 'wp_head', array( $this, 'standalone_css' ) );
|
244 |
+
if ( $template = get_single_template() ) {
|
245 |
+
include( $template );
|
246 |
+
exit();
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
function uninstall() {
|
251 |
+
delete_option( 'sg_subscribe_settings' );
|
252 |
+
}
|
253 |
+
|
254 |
+
function manager_init() {
|
255 |
+
$this->messages = '';
|
256 |
+
$this->use_wp_style = ( $this->settings['use_custom_style'] == 'use_custom_style' ) ? false : true;
|
257 |
+
if ( !$this->use_wp_style ) {
|
258 |
+
$this->header = str_replace( '[theme_path]', get_template_directory(), $this->settings['header'] );
|
259 |
+
$this->sidebar = str_replace( '[theme_path]', get_template_directory(), $this->settings['sidebar'] );
|
260 |
+
$this->footer = str_replace( '[theme_path]', get_template_directory(), $this->settings['footer'] );
|
261 |
+
$this->before_manager = $this->settings['before_manager'];
|
262 |
+
$this->after_manager = $this->settings['after_manager'];
|
263 |
+
}
|
264 |
+
|
265 |
+
foreach ( array( 'email', 'key', 'ref', 'new_email' ) as $var )
|
266 |
+
if ( isset( $_REQUEST[$var]) && !empty($_REQUEST[$var] ) )
|
267 |
+
$this->{$var} = esc_attr( trim( stripslashes( $_REQUEST[$var] ) ) );
|
268 |
+
if ( !$this->key )
|
269 |
+
$this->key = 'unset';
|
270 |
+
}
|
271 |
+
|
272 |
+
function is_multisite() {
|
273 |
+
return (bool) $this->is_multisite;
|
274 |
+
}
|
275 |
+
|
276 |
+
function add_error( $text='generic error', $type='manager' ) {
|
277 |
+
$this->errors[$type][] = $text;
|
278 |
+
}
|
279 |
+
|
280 |
+
function add_checkbox_to_default( $defaults ) {
|
281 |
+
$defaults['comment_notes_after'] .= $this->add_checkbox();
|
282 |
+
return $defaults;
|
283 |
+
}
|
284 |
+
|
285 |
+
function echo_add_checkbox() {
|
286 |
+
echo $this->add_checkbox();
|
287 |
+
}
|
288 |
+
|
289 |
+
function add_checkbox( $text = '' ) {
|
290 |
+
if ( _stc()->checkbox_shown )
|
291 |
+
return;
|
292 |
+
if ( !$email = _stc()->current_viewer_subscription_status() ) {
|
293 |
+
$checked_status = (bool) ( !empty( $_COOKIE['subscribe_checkbox_'.COOKIEHASH] ) && 'checked' == $_COOKIE['subscribe_checkbox_'.COOKIEHASH] );
|
294 |
+
$text .= "<p " . ( ( _stc()->clear_both ) ? 'style="clear: both;" ' : '' ) . 'class="subscribe-to-comments">
|
295 |
+
<input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;" ' . ( ( $checked_status ) ? 'checked="checked" ' : '' ) . '/>
|
296 |
+
<label for="subscribe">' . _stc()->not_subscribed_text . '</label>
|
297 |
+
</p>';
|
298 |
+
} elseif ( $email == 'admin' && current_user_can( 'manage_options' ) ) {
|
299 |
+
$text .= '<p ' . ( ( _stc()->clear_both ) ? 'style="clear: both;" ' : '' ) . 'class="subscribe-to-comments">
|
300 |
+
' . str_replace( '[manager_link]', _stc()->manage_link($email, true, false ), _stc()->author_text ) . '</p>';
|
301 |
+
} else {
|
302 |
+
$text .= '<p ' . ( ( _stc()->clear_both ) ? 'style="clear: both;" ' : '' ) . 'class="subscribe-to-comments">' .
|
303 |
+
str_replace( '[manager_link]', _stc()->manage_link( $email, true, false ), _stc()->subscribed_text ) . '</p>';
|
304 |
+
}
|
305 |
+
_stc()->checkbox_shown = true;
|
306 |
+
return $text;
|
307 |
+
}
|
308 |
+
|
309 |
+
function show_errors( $type='manager', $before_all='<div class="updated updated-error">', $after_all='</div>', $before_each='<p>', $after_each='</p>' ){
|
310 |
+
if ( isset( $this->errors[$type] ) && is_array( $this->errors[$type] ) ) {
|
311 |
+
echo $before_all;
|
312 |
+
foreach ( $this->errors[$type] as $error )
|
313 |
+
echo $before_each . $error . $after_each;
|
314 |
+
echo $after_all;
|
315 |
+
}
|
316 |
+
unset( $this->errors);
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
function add_message( $text ) {
|
321 |
+
$this->messages[] = $text;
|
322 |
+
}
|
323 |
+
|
324 |
+
|
325 |
+
function show_messages( $before_all='', $after_all='', $before_each='<div class="updated"><p>', $after_each='</p></div>' ){
|
326 |
+
if ( is_array( $this->messages ) ) {
|
327 |
+
echo $before_all;
|
328 |
+
foreach ( $this->messages as $message )
|
329 |
+
echo $before_each . $message . $after_each;
|
330 |
+
echo $after_all;
|
331 |
+
}
|
332 |
+
unset( $this->messages );
|
333 |
+
}
|
334 |
+
|
335 |
+
|
336 |
+
function is_subscribed_email_post_bid( $email, $post_id, $bid = NULL ) {
|
337 |
+
global $wpdb, $blog_id;
|
338 |
+
$bid = ( NULL == $bid ) ? $blog_id : $bid;
|
339 |
+
$email = strtolower( $email );
|
340 |
+
if ( $this->is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT email FROM $this->ms_table WHERE email = %s AND post_id = %s AND blog_id = %s", $email, $post_id, $bid ) ) )
|
341 |
+
return true;
|
342 |
+
elseif ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE LCASE( meta_value ) = %s AND meta_key = '_sg_subscribe-to-comments' AND post_id = %s", $email, $post_id ) ) )
|
343 |
+
return true;
|
344 |
+
return false;
|
345 |
+
}
|
346 |
+
|
347 |
+
|
348 |
+
function subscriptions_from_post( $postid, $bid=NULL ) {
|
349 |
+
global $wpdb, $blog_id;
|
350 |
+
if ( NULL == $bid )
|
351 |
+
$bid = $blog_id;
|
352 |
+
if ( isset( $this->bid_post_subscriptions[$bid][$postid] ) && is_array( $this->bid_post_subscriptions[$bid][$postid] ) )
|
353 |
+
return $this->bid_post_subscriptions[$bid][$postid];
|
354 |
+
$postid = (int) $postid;
|
355 |
+
if ( $this->is_multisite() ) {
|
356 |
+
$this->bid_post_subscriptions[$bid][$postid] = (array) $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT email FROM $this->ms_table WHERE blog_id = %d AND post_id = %d", $bid, $postid ) );
|
357 |
+
} else {
|
358 |
+
$this->bid_post_subscriptions[$bid][$postid] = (array) get_post_meta( $postid, '_sg_subscribe-to-comments' );
|
359 |
+
}
|
360 |
+
|
361 |
+
// Cleanup!
|
362 |
+
$duplicates = $this->array_duplicates( $this->bid_post_subscriptions[$bid][$postid] );
|
363 |
+
if ( $this->is_multisite() ) {
|
364 |
+
if ( $duplicates ) {
|
365 |
+
foreach ( (array) $duplicates as $duplicate ) {
|
366 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $this->ms_table WHERE blog_id = %d AND post_id = %d", $bid, $postid ) );
|
367 |
+
$this->add_subscriber_by_post_id_and_email( $postid, $duplicate, $bid );
|
368 |
+
}
|
369 |
+
}
|
370 |
+
} else {
|
371 |
+
if ( $duplicates ) {
|
372 |
+
foreach ( (array) $duplicates as $duplicate ) {
|
373 |
+
delete_post_meta( $postid, '_sg_subscribe-to-comments', $duplicate );
|
374 |
+
$this->add_subscriber_by_post_id_and_email( $postid, $duplicate, $bid );
|
375 |
+
}
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
$this->bid_post_subscriptions[$bid][$postid] = array_unique( $this->bid_post_subscriptions[$bid][$postid] );
|
380 |
+
return $this->bid_post_subscriptions[$bid][$postid];
|
381 |
+
}
|
382 |
+
|
383 |
+
|
384 |
+
function subscriptions_from_email( $email='' ) {
|
385 |
+
global $wpdb, $blog_id;
|
386 |
+
if ( is_array( $this->email_subscriptions ) )
|
387 |
+
return $this->email_subscriptions;
|
388 |
+
if ( !is_email( $email ) )
|
389 |
+
$email = $this->email;
|
390 |
+
$email = strtolower( $email );
|
391 |
+
|
392 |
+
if ( $this->is_multisite() ) {
|
393 |
+
$where = ( current_user_can( 'manage_options' ) ) ? $wpdb->prepare( " AND blog_id = %d ", $blog_id ) : '';
|
394 |
+
$subscriptions = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, post_id FROM $this->ms_table WHERE email = %s AND status='active' $where", $email ) );
|
395 |
+
} else {
|
396 |
+
$subscriptions = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments' AND LCASE(meta_value) = %s GROUP BY post_id", $email ) );
|
397 |
+
}
|
398 |
+
foreach ( (array) $subscriptions as $subscription)
|
399 |
+
$this->email_subscriptions[] = array( ( isset( $subscription->blog_id ) ) ? $subscription->blog_id : $blog_id, $subscription->post_id );
|
400 |
+
if ( is_array( $this->email_subscriptions ) ) {
|
401 |
+
usort( $this->email_subscriptions, array( $this, 'email_sort' ) );
|
402 |
+
return $this->email_subscriptions;
|
403 |
+
}
|
404 |
+
return false;
|
405 |
+
}
|
406 |
+
|
407 |
+
function email_sort( $a, $b ) {
|
408 |
+
if ( $a[0] == $b[0] ) {
|
409 |
+
if ( $a[1] == $a[1] )
|
410 |
+
return 0;
|
411 |
+
return ( $a[1] < $b[1] ) ? -1 : 1;
|
412 |
+
} else {
|
413 |
+
return ( $a[0] < $b[0] ) ? -1 : 1;
|
414 |
+
}
|
415 |
+
}
|
416 |
+
|
417 |
+
function maybe_solo_subscribe() {
|
418 |
+
if ( isset( $_POST['solo-comment-subscribe'] ) && $_POST['solo-comment-subscribe'] == 'solo-comment-subscribe' && isset( $_POST['postid'] ) && is_numeric( $_POST['postid'] ) )
|
419 |
+
$this->solo_subscribe( stripslashes( $_POST['email'] ), (int) $_POST['postid'] );
|
420 |
+
}
|
421 |
+
|
422 |
+
function solo_subscribe ( $email, $postid ) {
|
423 |
+
global $wpdb, $blog_id, $cache_userdata, $user_email;
|
424 |
+
$postid = (int) $postid;
|
425 |
+
$email = strtolower( $email );
|
426 |
+
if ( !is_email( $email ) ) {
|
427 |
+
get_currentuserinfo();
|
428 |
+
if ( is_email( $user_email ) )
|
429 |
+
$email = strtolower( $user_email );
|
430 |
+
else
|
431 |
+
$this->add_error( __( 'Please provide a valid e-mail address.', 'subscribe-to-comments' ),'solo_subscribe' );
|
432 |
+
}
|
433 |
+
|
434 |
+
if ( ( $email == $this->site_email && is_email( $this->site_email ) ) || ( $email == get_option( 'admin_email' ) && is_email( get_option( 'admin_email' ) ) ) )
|
435 |
+
$this->add_error( __( 'This e-mail address may not be subscribed', 'subscribe-to-comments' ),'solo_subscribe' );
|
436 |
+
|
437 |
+
if ( $this->is_subscribed_email_post_bid( $email, $postid, $blog_id ) ) {
|
438 |
+
// already subscribed
|
439 |
+
setcookie( 'comment_author_email_' . COOKIEHASH, $email, time() + 30000000, COOKIEPATH );
|
440 |
+
$this->add_error( __( 'You appear to be already subscribed to this entry.', 'subscribe-to-comments' ),'solo_subscribe' );
|
441 |
+
}
|
442 |
+
$post = get_post( $postid );
|
443 |
+
|
444 |
+
if ( !$post )
|
445 |
+
$this->add_error( __( 'Comments are not allowed on this entry.', 'subscribe-to-comments' ),'solo_subscribe' );
|
446 |
+
|
447 |
+
if ( empty( $cache_userdata[$post->post_author] ) && $post->post_author != 0 ) {
|
448 |
+
$cache_userdata[$post->post_author] = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE ID = $post->post_author" );
|
449 |
+
$cache_userdata[$cache_userdata[$post->post_author]->user_login] =& $cache_userdata[$post->post_author];
|
450 |
+
}
|
451 |
+
|
452 |
+
$post_author = $cache_userdata[$post->post_author];
|
453 |
+
|
454 |
+
if ( strtolower( $post_author->user_email ) == ( $email ) )
|
455 |
+
$this->add_error( __( 'You appear to be already subscribed to this entry.', 'subscribe-to-comments' ),'solo_subscribe' );
|
456 |
+
|
457 |
+
if ( !is_array( $this->errors['solo_subscribe'] ) ) {
|
458 |
+
add_post_meta( $postid, '_sg_subscribe-to-comments', strtolower( $email ) );
|
459 |
+
setcookie( 'comment_author_email_' . COOKIEHASH, $email, time() + 30000000, COOKIEPATH );
|
460 |
+
$location = $this->manage_link( $email, false, false ) . '&subscribeid=' . $postid;
|
461 |
+
header( "Location: $location" );
|
462 |
+
exit();
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
// From: http://php.net/manual/en/function.array-unique.php#85109
|
468 |
+
function array_duplicates( $array ) {
|
469 |
+
if ( !is_array( $array ) )
|
470 |
+
return false;
|
471 |
+
|
472 |
+
$duplicates = array();
|
473 |
+
foreach ( $array as $key => $val ) {
|
474 |
+
end( $array );
|
475 |
+
$k = key( $array );
|
476 |
+
$v = current( $array );
|
477 |
+
while ( $k !== $key ) {
|
478 |
+
if ( $v === $val ) {
|
479 |
+
$duplicates[$key] = $v;
|
480 |
+
break;
|
481 |
+
}
|
482 |
+
$v = prev( $array );
|
483 |
+
$k = key( $array );
|
484 |
+
}
|
485 |
+
}
|
486 |
+
return $duplicates;
|
487 |
+
}
|
488 |
+
|
489 |
+
|
490 |
+
function maybe_add_subscriber( $cid ) {
|
491 |
+
global $wpdb;
|
492 |
+
if ( $this->settings['double_opt_in'] ) {
|
493 |
+
$comment = get_comment( $cid );
|
494 |
+
$email = strtolower( $comment->comment_author_email );
|
495 |
+
if ( $this->is_multisite() ) {
|
496 |
+
$proceed = !!$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $this->ms_table WHERE email = %s AND status = 'active'", $email ) );
|
497 |
+
} else {
|
498 |
+
$proceed = !!$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments' AND LCASE(meta_value) = %s", $email ) );
|
499 |
+
}
|
500 |
+
} else {
|
501 |
+
$proceed = true;
|
502 |
+
}
|
503 |
+
|
504 |
+
if ( 'spam' != $comment->comment_approved && $_POST['subscribe'] == 'subscribe' ) {
|
505 |
+
if ( $proceed )
|
506 |
+
$this->add_subscriber( $cid );
|
507 |
+
else
|
508 |
+
$this->add_pending_subscriber( $cid );
|
509 |
+
}
|
510 |
+
return $cid;
|
511 |
+
}
|
512 |
+
|
513 |
+
|
514 |
+
function add_subscriber_by_post_id_and_email( $postid, $email, $bid = NULL ) {
|
515 |
+
global $wpdb, $blog_id;
|
516 |
+
$email = strtolower( $email );
|
517 |
+
if ( $this->is_multisite() ) {
|
518 |
+
$bid = ( NULL == $bid ) ? $blog_id : $bid;
|
519 |
+
$already_subscribed_to_this_post = !!$wpdb->get_var( $wpdb->prepare( "SELECT email FROM $this->ms_table WHERE email = %s AND blog_id = %d AND post_id = %d AND status = 'active'", $email, $bid, $postid ) );
|
520 |
+
if ( is_email( $email ) && !$already_subscribed_to_this_post )
|
521 |
+
$wpdb->insert( $this->ms_table, array( 'email' => $email, 'blog_id' => $bid, 'post_id' => $postid, 'status' => 'active' ) );
|
522 |
+
} else {
|
523 |
+
$already_subscribed_to_this_post = in_array( $email, (array) get_post_meta( $postid, '_sg_subscribe-to-comments' ) );
|
524 |
+
if ( is_email( $email ) && !$already_subscribed_to_this_post )
|
525 |
+
add_post_meta( $postid, '_sg_subscribe-to-comments', $email );
|
526 |
+
}
|
527 |
+
}
|
528 |
+
|
529 |
+
|
530 |
+
function add_subscriber( $cid ) {
|
531 |
+
global $blog_id;
|
532 |
+
$comment = get_comment( $cid );
|
533 |
+
$email = strtolower( $comment->comment_author_email );
|
534 |
+
$postid = $comment->comment_post_ID;
|
535 |
+
$this->add_subscriber_by_post_id_and_email( $postid, $email, $blog_id );
|
536 |
+
return $cid;
|
537 |
+
}
|
538 |
+
|
539 |
+
|
540 |
+
function add_pending_subscriber( $cid ) {
|
541 |
+
global $wpdb, $blog_id;
|
542 |
+
$comment = get_comment( $cid );
|
543 |
+
$email = strtolower( $comment->comment_author_email );
|
544 |
+
$postid = $comment->comment_post_ID;
|
545 |
+
|
546 |
+
if ( $this->is_multisite() ) {
|
547 |
+
$already_pending_on_this_post = !!$wpdb->get_var( $wpdb->prepare( "SELECT email FROM $this->ms_table WHERE email = %s AND blog_id = %d AND post_id = %d AND status = 'pending'", $email, $blog_id, $postid ) );
|
548 |
+
if ( is_email( $email ) && !$already_pending_on_this_post ) {
|
549 |
+
if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $this->ms_table WHERE email = %s AND status = 'pending-with-email' AND date_gmt > DATE_SUB( NOW(), INTERVAL 1 DAY)", $email ) ) ) {
|
550 |
+
$wpdb->insert( $this->ms_table, array( 'email' => $email, 'blog_id' => $blog_id, 'post_id' => $postid, 'status' => 'pending-with-email', 'date_gmt' => current_time( 'mysql', 1 ) ) );
|
551 |
+
$this->send_pending_nag( $cid );
|
552 |
+
} else {
|
553 |
+
$wpdb->insert( $this->ms_table, array( 'email' => $email, 'blog_id' => $blog_id, 'post_id' => $postid, 'status' => 'pending', 'date_gmt' => current_time( 'mysql', 1 ) ) );
|
554 |
+
}
|
555 |
+
}
|
556 |
+
} else {
|
557 |
+
$already_pending_on_this_post = in_array( $email, (array) get_post_meta( $postid, '_sg_subscribe-to-comments-pending' ) );
|
558 |
+
if ( is_email( $email ) && !$already_pending_on_this_post ) {
|
559 |
+
if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments, $wpdb->postmeta WHERE comment_post_ID = post_id AND LCASE( meta_value ) = %s AND meta_key = '_sg_subscribe-to-comments-pending-with-email' AND comment_date_gmt > DATE_SUB( NOW(), INTERVAL 1 DAY)", $email ) ) ) {
|
560 |
+
add_post_meta( $postid, '_sg_subscribe-to-comments-pending-with-email', strtolower( $email ) );
|
561 |
+
$this->send_pending_nag( $cid );
|
562 |
+
} else {
|
563 |
+
add_post_meta( $postid, '_sg_subscribe-to-comments-pending', strtolower( $email ) );
|
564 |
+
}
|
565 |
+
}
|
566 |
+
}
|
567 |
+
return $cid;
|
568 |
+
}
|
569 |
+
|
570 |
+
|
571 |
+
function confirm_pending_subscriber( $email ) {
|
572 |
+
global $wpdb, $blog_id;
|
573 |
+
$email = strtolower( $email );
|
574 |
+
|
575 |
+
if ( $this->is_multisite() ) {
|
576 |
+
$wpdb->update( $this->ms_table, array( 'status' => 'active' ), array( 'email' => $email ) );
|
577 |
+
} else {
|
578 |
+
$pending = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE LCASE(meta_value) = %s AND meta_key IN( '_sg_subscribe-to-comments-pending', '_sg_subscribe-to-comments-pending-with-email' )", $email ) );
|
579 |
+
foreach ( (array) $pending as $p ) {
|
580 |
+
$this->add_subscriber_by_post_id_and_email( $p->post_id, $email, $blog_id );
|
581 |
+
delete_post_meta( $p->post_id, $p->meta_key, $email );
|
582 |
+
}
|
583 |
+
}
|
584 |
+
|
585 |
+
return !!count( $pending );
|
586 |
+
}
|
587 |
+
|
588 |
+
|
589 |
+
function is_subscribed( $cid ) {
|
590 |
+
$comment = &get_comment( $cid );
|
591 |
+
$email = strtolower( $comment->comment_author_email );
|
592 |
+
$postid = $comment->comment_post_ID;
|
593 |
+
return in_array( $email, (array) $this->subscriptions_from_post( $postid ) );
|
594 |
+
}
|
595 |
+
|
596 |
+
|
597 |
+
function is_blocked( $email='' ) {
|
598 |
+
global $wpdb;
|
599 |
+
if ( !is_email( $email ) )
|
600 |
+
$email = $this->email;
|
601 |
+
if ( empty( $email ) )
|
602 |
+
return false;
|
603 |
+
$email = strtolower( $email );
|
604 |
+
// add the option if it doesn't exist
|
605 |
+
add_option( 'do_not_mail', '' );
|
606 |
+
$blocked = (array) explode ( ' ', get_option( 'do_not_mail' ) );
|
607 |
+
if ( in_array( $email, $blocked ) )
|
608 |
+
return true;
|
609 |
+
return false;
|
610 |
+
}
|
611 |
+
|
612 |
+
|
613 |
+
function add_block( $email='' ) {
|
614 |
+
global $wpdb;
|
615 |
+
if ( !is_email( $email ) )
|
616 |
+
$email = $this->email;
|
617 |
+
$email = strtolower( $email );
|
618 |
+
|
619 |
+
// add the option if it doesn't exist
|
620 |
+
add_option( 'do_not_mail', '' );
|
621 |
+
|
622 |
+
// check to make sure this email isn't already in there
|
623 |
+
if ( !$this->is_blocked( $email ) ) {
|
624 |
+
// email hasn't already been added - so add it
|
625 |
+
$blocked = get_option( 'do_not_mail' ) . ' ' . $email;
|
626 |
+
update_option( 'do_not_mail', $blocked );
|
627 |
+
return true;
|
628 |
+
}
|
629 |
+
return false;
|
630 |
+
}
|
631 |
+
|
632 |
+
|
633 |
+
function remove_block( $email='' ) {
|
634 |
+
global $wpdb;
|
635 |
+
if ( !is_email( $email ) )
|
636 |
+
$email = $this->email;
|
637 |
+
$email = strtolower( $email );
|
638 |
+
|
639 |
+
if ( $this->is_blocked( $email ) ) {
|
640 |
+
// e-mail is in the list - so remove it
|
641 |
+
$blocked = str_replace ( ' ' . $email, '', explode( ' ', get_option( 'do_not_mail' ) ) );
|
642 |
+
update_option( 'do_not_mail', $blocked );
|
643 |
+
return true;
|
644 |
+
}
|
645 |
+
return false;
|
646 |
+
}
|
647 |
+
|
648 |
+
|
649 |
+
function has_subscribers() {
|
650 |
+
if ( count( $this->get_unique_subscribers() ) > 0 )
|
651 |
+
return true;
|
652 |
+
return false;
|
653 |
+
}
|
654 |
+
|
655 |
+
|
656 |
+
function get_unique_subscribers() {
|
657 |
+
global $comments, $comment, $sg_subscribers;
|
658 |
+
if ( isset( $sg_subscribers ) )
|
659 |
+
return $sg_subscribers;
|
660 |
+
|
661 |
+
$sg_subscribers = array();
|
662 |
+
$subscriber_emails = array();
|
663 |
+
|
664 |
+
// We run the comment loop, and put each unique subscriber into a new array
|
665 |
+
foreach ( (array) $comments as $comment ) {
|
666 |
+
if ( comment_subscription_status() && !in_array( $comment->comment_author_email, $subscriber_emails ) ) {
|
667 |
+
$sg_subscribers[] = $comment;
|
668 |
+
$subscriber_emails[] = $comment->comment_author_email;
|
669 |
+
}
|
670 |
+
}
|
671 |
+
return $sg_subscribers;
|
672 |
+
}
|
673 |
+
|
674 |
+
|
675 |
+
function hidden_form_fields() { ?>
|
676 |
+
<input type="hidden" name="ref" value="<?php echo $this->ref; ?>" />
|
677 |
+
<input type="hidden" name="key" value="<?php echo $this->key; ?>" />
|
678 |
+
<input type="hidden" name="email" value="<?php echo $this->email; ?>" />
|
679 |
+
<?php
|
680 |
+
}
|
681 |
+
|
682 |
+
|
683 |
+
function generate_key( $data='' ) {
|
684 |
+
if ( '' == $data )
|
685 |
+
return false;
|
686 |
+
if ( !$this->settings['salt'] )
|
687 |
+
die( 'fatal error: corrupted salt' );
|
688 |
+
return md5( md5( $this->settings['salt'] . $data ) );
|
689 |
+
}
|
690 |
+
|
691 |
+
|
692 |
+
function validate_key() {
|
693 |
+
if ( $this->key == $this->generate_key( $this->email ) )
|
694 |
+
$this->key_type = 'normal';
|
695 |
+
elseif ( $this->key == $this->generate_key( $this->email . $this->new_email ) )
|
696 |
+
$this->key_type = 'change_email';
|
697 |
+
elseif ( $this->key == $this->generate_key( $this->email . 'blockrequest' ) )
|
698 |
+
$this->key_type = 'block';
|
699 |
+
elseif ( $this->key == $this->generate_key( 'opt_in:' . $this->email ) )
|
700 |
+
$this->key_type = 'opt_in';
|
701 |
+
elseif ( current_user_can( 'manage_options' ) )
|
702 |
+
$this->key_type = 'admin';
|
703 |
+
else
|
704 |
+
return false;
|
705 |
+
return true;
|
706 |
+
}
|
707 |
+
|
708 |
+
|
709 |
+
function determine_action() {
|
710 |
+
// rather than check it a bunch of times
|
711 |
+
$is_email = is_email( $this->email );
|
712 |
+
|
713 |
+
if ( is_email( $this->new_email) && $is_email && $this->key_type == 'change_email' )
|
714 |
+
$this->action = 'change_email';
|
715 |
+
elseif ( $this->key_type == 'opt_in' && $is_email )
|
716 |
+
$this->action = 'opt_in';
|
717 |
+
elseif ( isset( $_POST['removesubscrips'] ) && $is_email )
|
718 |
+
$this->action = 'remove_subscriptions';
|
719 |
+
elseif ( isset( $_POST['removeBlock'] ) && $is_email && current_user_can( 'manage_options' ) )
|
720 |
+
$this->action = 'remove_block';
|
721 |
+
elseif ( isset( $_POST['changeemailrequest'] ) && $is_email && is_email( $this->new_email ) )
|
722 |
+
$this->action = 'email_change_request';
|
723 |
+
elseif ( $is_email && isset( $_POST['blockemail'] ) )
|
724 |
+
$this->action = 'block_request';
|
725 |
+
elseif ( isset( $_GET['subscribeid'] ) )
|
726 |
+
$this->action = 'solo_subscribe';
|
727 |
+
elseif ( $is_email && isset( $_GET['blockemailconfirm'] ) && $this->key == $this->generate_key( $this->email . 'blockrequest' ) )
|
728 |
+
$this->action = 'block';
|
729 |
+
else
|
730 |
+
$this->action = 'none';
|
731 |
+
}
|
732 |
+
|
733 |
+
|
734 |
+
function remove_subscriber( $email, $postid, $bid = NULL ) {
|
735 |
+
global $wpdb, $blog_id;
|
736 |
+
$postid = (int) $postid;
|
737 |
+
$bid = absint( ( NULL == $bid ) ? $blog_id : $bid );
|
738 |
+
$email = strtolower( $email );
|
739 |
+
|
740 |
+
if ( $this->is_multisite() ) {
|
741 |
+
echo "REMOVING $bid : $postid : $email";
|
742 |
+
if ( $wpdb->query( $wpdb->prepare( "DELETE FROM $this->ms_table WHERE email = %s AND post_id = %d AND blog_id = %d", $email, $postid, $bid ) ) )
|
743 |
+
return true;
|
744 |
+
} else {
|
745 |
+
if ( delete_post_meta( $postid, '_sg_subscribe-to-comments', $email ) || delete_post_meta( $postid, '_sg_subscribe-to-comments-pending-with-email', $email ) || delete_post_meta( $postid, '_sg_subscribe-to-comments-pending', $email ) )
|
746 |
+
return true;
|
747 |
+
}
|
748 |
+
return false;
|
749 |
+
}
|
750 |
+
|
751 |
+
|
752 |
+
function remove_subscriptions ( $bid_post_ids ) {
|
753 |
+
global $wpdb;
|
754 |
+
$removed = 0;
|
755 |
+
foreach ( $bid_post_ids as $bp ) {
|
756 |
+
$bp = explode( '-', $bp );
|
757 |
+
// echo 'Removing BID: ' . $bp[0] . ' PID:' . $bp[1];
|
758 |
+
if ( $this->remove_subscriber( $this->email, $bp[1], $bp[0] ) )
|
759 |
+
$removed++;
|
760 |
+
}
|
761 |
+
return $removed;
|
762 |
+
}
|
763 |
+
|
764 |
+
|
765 |
+
function send_notifications( $cid ) {
|
766 |
+
global $wpdb;
|
767 |
+
$comment =& get_comment( $cid );
|
768 |
+
$post = get_post( $comment->comment_post_ID );
|
769 |
+
|
770 |
+
if ( $comment->comment_approved == '1' && $comment->comment_type == '' ) {
|
771 |
+
// Comment has been approved and isn't a trackback or a pingback, so we should send out notifications
|
772 |
+
|
773 |
+
$message = sprintf( __( "There is a new comment on the post \"%s\"", 'subscribe-to-comments' ) . ". \n%s\n\n", $post->post_title, get_permalink( $comment->comment_post_ID ) );
|
774 |
+
$message .= sprintf( __( "Author: %s\n", 'subscribe-to-comments' ), $comment->comment_author );
|
775 |
+
$message .= __( "Comment:\n", 'subscribe-to-comments' ) . $comment->comment_content . "\n\n";
|
776 |
+
$message .= __( "See all comments on this post here:\n", 'subscribe-to-comments' );
|
777 |
+
$message .= get_permalink( $comment->comment_post_ID ) . "#comments\n\n";
|
778 |
+
//add link to manage comment notifications
|
779 |
+
$message .= __( "To manage your subscriptions or to block all notifications from this site, click the link below:\n", 'subscribe-to-comments' );
|
780 |
+
$message .= get_option( 'home' ) . '/?wp-subscription-manager=1&email=[email]&key=[key]';
|
781 |
+
|
782 |
+
$subject = sprintf( __( 'New Comment On: %s', 'subscribe-to-comments' ), $post->post_title );
|
783 |
+
|
784 |
+
$subscriptions = $this->subscriptions_from_post( $comment->comment_post_ID );
|
785 |
+
foreach ( (array) $subscriptions as $email ) {
|
786 |
+
if ( !$this->is_blocked( $email ) && $email != $comment->comment_author_email && is_email( $email ) ) {
|
787 |
+
$message_final = str_replace( '[email]', urlencode( $email ), $message );
|
788 |
+
$message_final = str_replace( '[key]', $this->generate_key( $email ), $message_final );
|
789 |
+
$this->send_mail( $email, $subject, $message_final );
|
790 |
+
}
|
791 |
+
} // foreach subscription
|
792 |
+
} // end if comment approved
|
793 |
+
return $cid;
|
794 |
+
}
|
795 |
+
|
796 |
+
|
797 |
+
function send_pending_nag( $cid ) {
|
798 |
+
$comment = get_comment( $cid );
|
799 |
+
$email = strtolower( $comment->comment_author_email );
|
800 |
+
$subject = __( 'Subscription Confirmation', 'subscribe-to-comments' );
|
801 |
+
$message = sprintf( __( "You are receiving this message to confirm your comment subscription at \"%s\"\n\n", 'subscribe-to-comments' ), get_bloginfo( 'blogname' ) );
|
802 |
+
$message .= __( "To confirm your subscription, click this link:\n\n", 'subscribe-to-comments' );
|
803 |
+
$message .= get_option( 'home' ) . "/?wp-subscription-manager=1&email=" . urlencode( $email ) . "&key=" . $this->generate_key( 'opt_in:' . $email ) . "\n\n";
|
804 |
+
$message .= __( 'If you did not request this subscription, please disregard this message.', 'subscribe-to-comments' );
|
805 |
+
return $this->send_mail( $email, $subject, $message );
|
806 |
+
}
|
807 |
+
|
808 |
+
|
809 |
+
function change_email_request() {
|
810 |
+
if ( $this->is_blocked() )
|
811 |
+
return false;
|
812 |
+
|
813 |
+
$subject = __( 'E-mail change confirmation', 'subscribe-to-comments' );
|
814 |
+
$message = sprintf( __( "You are receiving this message to confirm a change of e-mail address for your subscriptions at \"%s\"\n\n", 'subscribe-to-comments' ), get_bloginfo( 'blogname' ) );
|
815 |
+
$message .= sprintf( __( "To change your e-mail address to %s, click this link:\n\n", 'subscribe-to-comments' ), $this->new_email );
|
816 |
+
$message .= get_option( 'home' ) . "/?wp-subscription-manager=1&email=" . urlencode( $this->email ) . "&new_email=" . urlencode( $this->new_email ) . "&key=" . $this->generate_key( $this->email . $this->new_email ) . ".\n\n";
|
817 |
+
$message .= __( 'If you did not request this action, please disregard this message.', 'subscribe-to-comments' );
|
818 |
+
return $this->send_mail( $this->email, $subject, $message );
|
819 |
+
}
|
820 |
+
|
821 |
+
|
822 |
+
function block_email_request( $email ) {
|
823 |
+
if ( $this->is_blocked( $email ) )
|
824 |
+
return false;
|
825 |
+
$subject = __( 'E-mail block confirmation', 'subscribe-to-comments' );
|
826 |
+
$message = sprintf( __( "You are receiving this message to confirm that you no longer wish to receive e-mail comment notifications from \"%s\"\n\n", 'subscribe-to-comments' ), get_bloginfo( 'name' ) );
|
827 |
+
$message .= __( "To cancel all future notifications for this address, click this link:\n\n", 'subscribe-to-comments' );
|
828 |
+
$message .= get_option( 'home' ) . "/?wp-subscription-manager=1&email=" . urlencode( $email ) . "&key=" . $this->generate_key( $email . 'blockrequest' ) . "&blockemailconfirm=true" . ".\n\n";
|
829 |
+
$message .= __( "If you did not request this action, please disregard this message.", 'subscribe-to-comments' );
|
830 |
+
return $this->send_mail( $email, $subject, $message );
|
831 |
+
}
|
832 |
+
|
833 |
+
|
834 |
+
function send_mail( $to, $subject, $message ) {
|
835 |
+
$subject = '[' . get_bloginfo( 'name' ) . '] ' . $subject;
|
836 |
+
|
837 |
+
// strip out some chars that might cause issues, and assemble vars
|
838 |
+
$site_name = str_replace( '"', "'", $this->site_name );
|
839 |
+
$site_email = str_replace( array( '<', '>' ), array( '', '' ), $this->site_email );
|
840 |
+
$charset = get_option( 'blog_charset' );
|
841 |
+
|
842 |
+
$headers = "From: \"{$site_name}\" <{$site_email}>\n";
|
843 |
+
$headers .= "MIME-Version: 1.0\n";
|
844 |
+
$headers .= "Content-Type: text/plain; charset=\"{$charset}\"\n";
|
845 |
+
return wp_mail( $to, $subject, $message, $headers );
|
846 |
+
}
|
847 |
+
|
848 |
+
|
849 |
+
function change_email() {
|
850 |
+
global $wpdb;
|
851 |
+
$new_email = strtolower( $this->new_email );
|
852 |
+
$email = strtolower( $this->email );
|
853 |
+
if ( $wpdb->update( $wpdb->comments, array( 'comment_author_email' => $new_email ), array( 'comment_author_email' => $email ) ) )
|
854 |
+
$return = true;
|
855 |
+
if ( $wpdb->update( $wpdb->postmeta, array( 'meta_value' => $new_email ), array( 'meta_value' => $email, 'meta_key' => '_sg_subscribe-to-comments' ) ) )
|
856 |
+
$return = true;
|
857 |
+
if ( $wpdb->update( $this->ms_table, array( 'email' => $new_email ), array( 'email' => $email ) ) )
|
858 |
+
$return = true;
|
859 |
+
return $return;
|
860 |
+
}
|
861 |
+
|
862 |
+
|
863 |
+
function entry_link( $bid, $postid, $uri='') {
|
864 |
+
global $blog_id;
|
865 |
+
$switched = false;
|
866 |
+
if ( $blog_id != $bid ) {
|
867 |
+
$switched = true;
|
868 |
+
switch_to_blog( $bid );
|
869 |
+
}
|
870 |
+
if ( empty( $uri ) )
|
871 |
+
$uri = esc_url( get_permalink( $postid ) );
|
872 |
+
$postid = (int) $postid;
|
873 |
+
$title = get_the_title( $postid );
|
874 |
+
if ( empty( $title ) )
|
875 |
+
$title = __( 'click here', 'subscribe-to-comments' );
|
876 |
+
$output = '<a href="'.$uri.'">'. esc_html( get_option( 'blogname' ) ) . ' → ' . $title.'</a>';
|
877 |
+
if ( $switched )
|
878 |
+
restore_current_blog();
|
879 |
+
return $output;
|
880 |
+
}
|
881 |
+
|
882 |
+
|
883 |
+
function admin_head() { ?>
|
884 |
+
<style type="text/css" media="screen">
|
885 |
+
.updated-error {
|
886 |
+
background-color: #FF8080;
|
887 |
+
border: 1px solid #F00;
|
888 |
+
}
|
889 |
+
</style>
|
890 |
+
<?php
|
891 |
+
return true;
|
892 |
+
}
|
893 |
+
|
894 |
+
|
895 |
+
function db_upgrade_check () {
|
896 |
+
global $wpdb, $blog_id;
|
897 |
+
|
898 |
+
$update = false;
|
899 |
+
|
900 |
+
// add the options
|
901 |
+
add_option( 'sg_subscribe_settings', array( 'use_custom_style' => '', 'email' => get_bloginfo( 'admin_email' ), 'name' => get_bloginfo( 'name' ), 'header' => '[theme_path]/header.php', 'sidebar' => '', 'footer' => '[theme_path]/footer.php', 'before_manager' => '<div id="content" class="widecolumn subscription-manager">', 'after_manager' => '</div>', 'not_subscribed_text' => __( 'Notify me of followup comments via e-mail', 'subscribe-to-comments' ), 'subscribed_text' => __( 'You are subscribed to this entry. <a href="[manager_link]">Manage your subscriptions</a>.', 'subscribe-to-comments' ), 'author_text' => __( 'You are the author of this entry. <a href="[manager_link]">Manage subscriptions</a>.', 'subscribe-to-comments' ), 'version' => 0, 'double_opt_in' => '', 'subscribed_format' => '%NAME%' ) );
|
902 |
+
|
903 |
+
$settings = $this->get_options();
|
904 |
+
|
905 |
+
if ( !isset( $settings['salt'] ) ) {
|
906 |
+
$settings['salt'] = md5( md5( uniqid( rand() . rand() . rand() . rand() . rand(), true ) ) ); // random MD5 hash
|
907 |
+
$update = true;
|
908 |
+
}
|
909 |
+
|
910 |
+
if ( !isset( $settings['clear_both'] ) ) {
|
911 |
+
$settings['clear_both'] = 'clear_both';
|
912 |
+
$update = true;
|
913 |
+
}
|
914 |
+
|
915 |
+
if ( !isset( $settings['version'] ) ) {
|
916 |
+
$settings = stripslashes_deep( $settings );
|
917 |
+
$update = true;
|
918 |
+
}
|
919 |
+
|
920 |
+
if ( !isset( $settings['double_opt_in'] ) ) {
|
921 |
+
$settings['double_opt_in'] = '';
|
922 |
+
$update = true;
|
923 |
+
}
|
924 |
+
|
925 |
+
if ( !isset( $settings['subscribed_format'] ) ) {
|
926 |
+
$settings['subscribed_format'] = '%NAME%';
|
927 |
+
$update = true;
|
928 |
+
}
|
929 |
+
|
930 |
+
if ( !$this->is_multisite() && version_compare( $settings['version'], '2.2', '<' ) ) { // Upgrade to postmeta-driven subscriptions
|
931 |
+
foreach ( (array) $wpdb->get_col( "DESC $wpdb->comments", 0 ) as $column ) {
|
932 |
+
if ( $column == 'comment_subscribe' ) {
|
933 |
+
$upgrade_comments = $wpdb->get_results( "SELECT comment_post_ID, comment_author_email FROM $wpdb->comments WHERE comment_subscribe = 'Y'" );
|
934 |
+
foreach ( (array) $upgrade_comments as $upgrade_comment )
|
935 |
+
$this->add_subscriber_by_post_id_and_email( $upgrade_comment->comment_post_ID, $upgrade_comment->comment_author_email, $blog_id );
|
936 |
+
// Done. Drop the column
|
937 |
+
$wpdb->query( "ALTER TABLE $wpdb->comments DROP COLUMN comment_subscribe" );
|
938 |
+
}
|
939 |
+
}
|
940 |
+
$udpate = true;
|
941 |
+
}
|
942 |
+
|
943 |
+
elseif ( $this->is_multisite() && ( version_compare( $settings['version'], '2.2', '<' ) || !isset( $settings['version'] ) ) ) {
|
944 |
+
// Create WPMU tables
|
945 |
+
if ( $wpdb->has_cap( 'collation' ) ) {
|
946 |
+
if ( ! empty( $wpdb->charset ) )
|
947 |
+
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
948 |
+
if ( ! empty( $wpdb->collate ) )
|
949 |
+
$charset_collate .= " COLLATE $wpdb->collate";
|
950 |
+
}
|
951 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
952 |
+
$queries = "CREATE TABLE IF NOT EXISTS $this->ms_table (
|
953 |
+
id int(11) NOT NULL auto_increment,
|
954 |
+
email varchar(100) NOT NULL,
|
955 |
+
blog_id int(11) NOT NULL default 0,
|
956 |
+
post_id int(11) NOT NULL default 0,
|
957 |
+
date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
|
958 |
+
status varchar(20) NOT NULL default '',
|
959 |
+
PRIMARY KEY (id),
|
960 |
+
KEY email_blog_post_status (email,blog_id,post_id,status),
|
961 |
+
KEY email_status (email,status)
|
962 |
+
) $charset_collate";
|
963 |
+
dbDelta( $queries );
|
964 |
+
}
|
965 |
+
|
966 |
+
if ( $update || !isset( $settings['version'] ) )
|
967 |
+
$this->update_settings( $settings );
|
968 |
+
}
|
969 |
+
|
970 |
+
|
971 |
+
function update_settings( $settings ) {
|
972 |
+
$settings['version'] = $this->version;
|
973 |
+
$settings = $this->sanitize_settings( $settings );
|
974 |
+
update_option( 'sg_subscribe_settings', $settings );
|
975 |
+
}
|
976 |
+
|
977 |
+
function sanitize_settings( $settings ) {
|
978 |
+
if ( strpos( $settings['subscribed_format'], '%NAME%' ) === false ) {
|
979 |
+
$settings['subscribed_format'] = '%NAME%';
|
980 |
+
}
|
981 |
+
if ( ! empty( $settings['header'] ) ) {
|
982 |
+
$settings['header'] = '[theme_path]/header.php';
|
983 |
+
}
|
984 |
+
if ( ! empty( $settings['sidebar'] ) ) {
|
985 |
+
$settings['sidebar'] = '[theme_path]/sidebar.php';
|
986 |
+
}
|
987 |
+
if ( ! empty( $settings['footer'] ) ) {
|
988 |
+
$settings['footer'] = '[theme_path]/footer.php';
|
989 |
+
}
|
990 |
+
return $settings;
|
991 |
+
}
|
992 |
+
|
993 |
+
|
994 |
+
function current_viewer_subscription_status(){
|
995 |
+
global $wpdb, $blog_id, $post, $user_email;
|
996 |
+
|
997 |
+
$comment_author_email = ( isset( $_COOKIE['comment_author_email_'. COOKIEHASH] ) ) ? trim( $_COOKIE['comment_author_email_'. COOKIEHASH] ) : '';
|
998 |
+
get_currentuserinfo();
|
999 |
+
|
1000 |
+
if ( is_email( $user_email ) ) {
|
1001 |
+
$email = strtolower( $user_email );
|
1002 |
+
$loggedin = true;
|
1003 |
+
} elseif ( is_email( $comment_author_email ) ) {
|
1004 |
+
$email = strtolower( $comment_author_email );
|
1005 |
+
} else {
|
1006 |
+
return false;
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
$post_author = get_userdata( $post->post_author );
|
1010 |
+
if ( strtolower( $post_author->user_email ) == $email && $loggedin )
|
1011 |
+
return 'admin';
|
1012 |
+
|
1013 |
+
if ( in_array( $email, (array) $this->subscriptions_from_post( $post->ID ) ) )
|
1014 |
+
return $email;
|
1015 |
+
return false;
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
function manage_link( $email='', $html=true, $echo=true ) {
|
1019 |
+
$link = get_option( 'home' ) . '/?wp-subscription-manager=1';
|
1020 |
+
if ( $email != 'admin' ) {
|
1021 |
+
$link = add_query_arg( 'email', urlencode( $email ), $link );
|
1022 |
+
$link = add_query_arg( 'key', $this->generate_key( $email ), $link );
|
1023 |
+
}
|
1024 |
+
$link = add_query_arg( 'ref', rawurlencode( 'http://' . $_SERVER['HTTP_HOST'] . esc_attr( $_SERVER['REQUEST_URI'] ) ), $link);
|
1025 |
+
//$link = str_replace('+', '%2B', $link);
|
1026 |
+
if ( $html )
|
1027 |
+
$link = esc_url( $link );
|
1028 |
+
if ( !$echo )
|
1029 |
+
return $link;
|
1030 |
+
echo $link;
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
|
1034 |
+
function on_edit( $cid ) {
|
1035 |
+
global $blog_id;
|
1036 |
+
$comment =& get_comment( $cid );
|
1037 |
+
$email = strtolower( $comment->comment_author_email );
|
1038 |
+
$postid = $comment->comment_post_ID;
|
1039 |
+
if ( !is_email( $email ) )
|
1040 |
+
_stc()->remove_subscriber( $email, $postid, $blog_id );
|
1041 |
+
return $cid;
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
|
1045 |
+
function on_delete( $cid ) {
|
1046 |
+
global $blog_id;
|
1047 |
+
$comment = &get_comment( $cid );
|
1048 |
+
$email = strtolower( $comment->comment_author_email );
|
1049 |
+
$postid = $comment->comment_post_ID;
|
1050 |
+
_stc()->remove_subscriber( $email, $postid, $blog_id );
|
1051 |
+
return $cid;
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
function get_comment_author_format() {
|
1055 |
+
if ( strpos( $this->subscribed_format, '%NAME%' ) === false )
|
1056 |
+
return '%NAME%';
|
1057 |
+
else
|
1058 |
+
return $this->subscribed_format;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
function comment_author_filter( $author ) {
|
1062 |
+
if ( comment_subscription_status() )
|
1063 |
+
$author = str_replace( '%NAME%', $author, $this->get_comment_author_format() );
|
1064 |
+
return $author;
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
function add_admin_menu() {
|
1068 |
+
$manager_callback = add_submenu_page( 'edit-comments.php', __( 'Comment Subscription Manager', 'subscribe-to-comments' ), __( 'Subscriptions', 'subscribe-to-comments' ), 'manage_options', 'stc-management', 'sg_subscribe_admin' );
|
1069 |
+
$opt_callback = add_options_page( __( 'Subscribe to Comments', 'subscribe-to-comments' ), __( 'Subscribe to Comments', 'subscribe-to-comments' ), 'publish_posts', 'stc-options', array( _stc(), 'options_page' ) );
|
1070 |
+
add_action( "load-{$opt_callback}", array( _stc(), 'save_options' ) );
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
|
1074 |
+
|
1075 |
+
|
1076 |
+
|
1077 |
+
|
1078 |
+
|
1079 |
+
|
1080 |
+
|
1081 |
+
|
1082 |
+
|
1083 |
+
//////////////////// OPTIONS ////////////////////////
|
1084 |
+
|
1085 |
+
|
1086 |
+
|
1087 |
+
function tr( $option_slug, $option_title, $option_text, $description ='' ) {
|
1088 |
+
echo "<tr valign='top'>\n\t<th scope='row'><label for='" . $option_slug . "'>" . $option_title . "</label></th>\n\t<td>" . $option_text;
|
1089 |
+
if ( !empty( $description ) )
|
1090 |
+
echo '<span class="setting-description">' . $description . '</span>';
|
1091 |
+
echo "</td>\n</tr>\n";
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
function save_options() {
|
1095 |
+
if ( isset( $_POST['sg_subscribe_settings_submit'] ) ) {
|
1096 |
+
check_admin_referer( 'subscribe-to-comments-update_options' );
|
1097 |
+
$update_settings = stripslashes_deep( $_POST['sg_subscribe_settings'] );
|
1098 |
+
_stc()->update_settings( $update_settings );
|
1099 |
+
wp_redirect( add_query_arg( 'updated', '1', menu_page_url( 'stc-options', false ) ) );
|
1100 |
+
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
1101 |
+
set_transient( 'settings_errors', get_settings_errors(), 30 );
|
1102 |
+
exit();
|
1103 |
+
}
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
function options_page_contents() {
|
1107 |
+
echo '<h2>' . __( 'Subscribe to Comments Settings', 'subscribe-to-comments' ) . '</h2>';
|
1108 |
+
|
1109 |
+
|
1110 |
+
echo '<h3>' . __( 'Notification e-mails', 'subscribe-to-comments' ) . '</h3>';
|
1111 |
+
echo '<table class="form-table">';
|
1112 |
+
$this->tr( 'name', __( '"From" name', 'subscribe-to-comments' ), '<input type="text" size="40" id="name" name="sg_subscribe_settings[name]" value="' . $this->form_setting( 'name' ) . '" />' );
|
1113 |
+
$this->tr( 'email', __( '"From" address', 'subscribe-to-comments' ), '<input type="text" size="40" id="email" name="sg_subscribe_settings[email]" value="' . $this->form_setting( 'email' ) . '" />', __( 'You may want this to be a special account that you set up for this purpose, as it will go out to everyone who subscribes', 'subscribe-to-comments' ) );
|
1114 |
+
$this->tr( 'double_opt_in', __( 'Double opt-in', 'subscribe-to-comments' ), '<input type="checkbox" id="double_opt_in" name="sg_subscribe_settings[double_opt_in]" value="double_opt_in"' . $this->checkflag( 'double_opt_in' ) . ' /> <label for="double_opt_in">' . __( 'Require verification of first-time subscription e-mails (this is known as "double opt-in" and is required by law in some countries)', 'subscribe-to-comments') . '</label>' );
|
1115 |
+
echo '</table>';
|
1116 |
+
|
1117 |
+
echo '<h3>' . __( 'Subscriber name formatting', 'subscribe_to_comments' ) . '</h3>';
|
1118 |
+
echo '<table class="form-table">';
|
1119 |
+
$this->tr( 'subscribed_format', __( 'Subscribed format', 'subscribe-to-comments' ), '<input type="text" size="40" id="subscribed_format" name="sg_subscribe_settings[subscribed_format]" value="' . $this->form_setting( 'subscribed_format' ) . '" />', __( 'e.g. <code>%NAME% (subscribed)</code> will display <code>John Smith (subscribed)</code>', 'subscribe-to-comments' ) );
|
1120 |
+
echo '</table>';
|
1121 |
+
|
1122 |
+
|
1123 |
+
echo '<h3>' . __( 'Comment form layout' ) . '</h3>';
|
1124 |
+
echo '<table class="form-table">';
|
1125 |
+
$this->tr( 'clear_both', 'CSS clearing', '<input type="checkbox" id="clear_both" name="sg_subscribe_settings[clear_both]" value="clear_both"' . $this->checkflag( 'clear_both' ) . ' /> <label for="clear_both">' . __( 'Do a CSS "clear" on the subscription checkbox/message (uncheck this if the checkbox/message appears in a strange location in your theme)', 'subscribe-to-comments' ) . '</label>' );
|
1126 |
+
echo '</table>';
|
1127 |
+
|
1128 |
+
echo '<h3>' . __( 'Comment form text', 'subscribe-to-comments' ) . '</h3>';
|
1129 |
+
echo '<p>' . __( 'Customize the messages shown to different people. Use <code>[manager_link]</code> to insert the URI to the Subscription Manager.', 'subscribe-to-comments' ) . '</p>';
|
1130 |
+
echo '<table class="form-table">';
|
1131 |
+
$this->tr( 'not_subscribed_text', __( 'Not subscribed text', 'subscribe-to-comments' ), '<textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="not_subscribed_text" name="sg_subscribe_settings[not_subscribed_text]">' . $this->textarea_setting( 'not_subscribed_text' ) . '</textarea>' );
|
1132 |
+
$this->tr( 'subscribed_text', __( 'Subscribed text', 'subscribe-to-comments' ), '<textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="subscribed_text" name="sg_subscribe_settings[subscribed_text]">' . $this->textarea_setting( 'subscribed_text' ) . '</textarea>' );
|
1133 |
+
$this->tr( 'author_text', __( 'Entry author text', 'subscribe-to-comments' ), '<textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="author_text" name="sg_subscribe_settings[author_text]">' . $this->textarea_setting( 'author_text' ) . '</textarea>' );
|
1134 |
+
echo '</table>';
|
1135 |
+
|
1136 |
+
echo '<h3>' . __( 'Subscription manager', 'subscribe-to-comments' ) . '</h3>';
|
1137 |
+
echo '<table class="form-table">';
|
1138 |
+
$this->tr( 'use_custom_style', __( 'Custom style', 'subscribe-to-comments' ), '<input type="checkbox" onchange="if(this.checked){document.getElementById(\'stc-custom-style-div\').style.display=\'block\';}else{document.getElementById(\'stc-custom-style-div\').style.display=\'none\';}" id="use_custom_style" name="sg_subscribe_settings[use_custom_style]" value="use_custom_style"' . $this->checkflag( 'use_custom_style' ) . ' /> <label for="use_custom_style">' . __( 'Use custom style for Subscription Manager', 'subscribe-to-comments' ) . '</label>' );
|
1139 |
+
echo '</table>';
|
1140 |
+
|
1141 |
+
echo '<div id="stc-custom-style-div" style="' . ( ( $this->form_setting( 'use_custom_style' ) != 'use_custom_style' ) ? 'display:none' : '' ) . '">';
|
1142 |
+
echo '<p>' . __( 'These settings only matter if you are using a custom style. <code>[theme_path]</code> will be replaced with the path to your current theme.', 'subscribe-to-comments' ) . '</p>';
|
1143 |
+
echo '<table class="form-table">';
|
1144 |
+
$this->tr( 'header', __( 'Path to header', 'subscribe-to-comments' ), '<input type="text" size="40" id="sg_sub_header" name="sg_subscribe_settings[header]" value="' . $this->form_setting( 'header' ) . '" />' );
|
1145 |
+
$this->tr( 'sidebar', __( 'Path to sidebar', 'subscribe-to-comments' ), '<input type="text" size="40" id="sg_sub_sidebar" name="sg_subscribe_settings[sidebar]" value="' . $this->form_setting( 'sidebar' ) . '" />' );
|
1146 |
+
$this->tr( 'footer', __( 'Path to footer', 'subscribe-to-comments' ), '<input type="text" size="40" id="sg_sub_footer" name="sg_subscribe_settings[footer]" value="' . $this->form_setting( 'footer' ) . '" />' );
|
1147 |
+
$this->tr( 'before_manager', __( 'HTML for before the subscription manager', 'subscribe-to-comments' ), '<textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="before_manager" name="sg_subscribe_settings[before_manager]">' . $this->textarea_setting( 'before_manager' ) . '</textarea>' );
|
1148 |
+
$this->tr( 'after_manager', __( 'HTML for after the subscription manager', 'subscribe-to-comments' ), '<textarea style="width: 98%; font-size: 12px;" rows="2" cols="60" id="after_manager" name="sg_subscribe_settings[after_manager]">' . $this->textarea_setting( 'after_manager' ) . '</textarea>' );
|
1149 |
+
echo '</table>';
|
1150 |
+
echo '</div>';
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
function get_options() {
|
1154 |
+
return $this->sanitize_settings( get_option( 'sg_subscribe_settings' ) );
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
function checkflag( $optname ) {
|
1158 |
+
$options = $this->get_options();
|
1159 |
+
if ( !isset( $options[$optname] ) || $options[$optname] != $optname )
|
1160 |
+
return;
|
1161 |
+
return ' checked="checked"';
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
/**
|
1165 |
+
* Returns an HTML attribute sanitized version of a setting
|
1166 |
+
* @param string $option_name The name of the STC option to fetch
|
1167 |
+
* @return string the sanitized setting
|
1168 |
+
*/
|
1169 |
+
function form_setting( $option_name ) {
|
1170 |
+
$options = $this->get_options();
|
1171 |
+
if ( isset( $options[$option_name] ) )
|
1172 |
+
return esc_attr( $options[$option_name] );
|
1173 |
+
else
|
1174 |
+
return '';
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
function textarea_setting( $optname ) {
|
1178 |
+
$options = $this->get_options();
|
1179 |
+
if ( isset( $options[$optname] ) )
|
1180 |
+
return esc_textarea( $options[$optname] );
|
1181 |
+
else
|
1182 |
+
return '';
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
function options_page() {
|
1186 |
+
echo '<form method="post">';
|
1187 |
+
screen_icon();
|
1188 |
+
echo '<div class="wrap">';
|
1189 |
+
|
1190 |
+
$this->options_page_contents();
|
1191 |
+
|
1192 |
+
echo '<p class="submit"><input type="submit" name="sg_subscribe_settings_submit" value="';
|
1193 |
+
_e( 'Save Changes', 'subscribe-to-comments' );
|
1194 |
+
echo '" class="button-primary" /></p></div>';
|
1195 |
+
|
1196 |
+
wp_nonce_field( 'subscribe-to-comments-update_options' );
|
1197 |
+
|
1198 |
+
echo '</form>';
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
|
1202 |
+
|
1203 |
+
|
1204 |
+
|
1205 |
+
|
1206 |
+
|
1207 |
+
|
1208 |
+
|
1209 |
+
|
1210 |
+
|
1211 |
+
|
1212 |
+
|
1213 |
+
|
1214 |
+
|
1215 |
+
|
1216 |
+
|
1217 |
+
|
1218 |
+
|
1219 |
+
|
1220 |
+
|
1221 |
+
|
1222 |
+
|
1223 |
+
|
1224 |
+
|
1225 |
+
|
1226 |
+
|
1227 |
+
|
1228 |
+
|
1229 |
+
|
1230 |
+
|
1231 |
+
|
1232 |
+
|
1233 |
+
|
1234 |
+
|
1235 |
+
|
1236 |
+
|
1237 |
+
|
1238 |
+
|
1239 |
+
|
1240 |
+
} // class sg_subscribe
|
1241 |
+
|
1242 |
+
|
1243 |
+
|
1244 |
+
|
1245 |
+
|
1246 |
+
function stc_checkbox_state( $data ) {
|
1247 |
+
if ( isset( $_POST['subscribe'] ) )
|
1248 |
+
setcookie( 'subscribe_checkbox_'. COOKIEHASH, 'checked', time() + 30000000, COOKIEPATH );
|
1249 |
+
else
|
1250 |
+
setcookie( 'subscribe_checkbox_'. COOKIEHASH, 'unchecked', time() + 30000000, COOKIEPATH );
|
1251 |
+
return $data;
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
|
1255 |
+
function stc_comment_author_filter( $author ) {
|
1256 |
+
return _stc()->comment_author_filter( $author );
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
|
1260 |
+
function sg_subscribe_start() {
|
1261 |
+
if ( !$sg_subscribe ) {
|
1262 |
+
load_plugin_textdomain( 'subscribe-to-comments', false, dirname( plugin_basename( __FILE__ ) ) );
|
1263 |
+
$sg_subscribe = new CWS_STC();
|
1264 |
+
}
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
|
1268 |
+
|
1269 |
+
function sg_subscribe_admin_standalone() {
|
1270 |
+
sg_subscribe_admin( true );
|
1271 |
+
}
|
1272 |
+
|
1273 |
+
function sg_subscribe_admin( $standalone = false ) {
|
1274 |
+
global $wpdb, $sg_subscribe, $wp_version, $blog_id;
|
1275 |
+
|
1276 |
+
|
1277 |
+
if ( $standalone ) {
|
1278 |
+
_stc()->form_action = get_option( 'home' ) . '/?wp-subscription-manager=1';
|
1279 |
+
_stc()->standalone = true;
|
1280 |
+
} else {
|
1281 |
+
_stc()->form_action = 'edit-comments.php?page=stc-management';
|
1282 |
+
_stc()->standalone = false;
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
_stc()->manager_init();
|
1286 |
+
|
1287 |
+
get_currentuserinfo();
|
1288 |
+
|
1289 |
+
if ( !_stc()->validate_key() )
|
1290 |
+
die ( __( 'You may not access this page without a valid key.', 'subscribe-to-comments' ) );
|
1291 |
+
|
1292 |
+
_stc()->determine_action();
|
1293 |
+
|
1294 |
+
switch ( _stc()->action ) :
|
1295 |
+
|
1296 |
+
case "opt_in" :
|
1297 |
+
if ( _stc()->confirm_pending_subscriber( _stc()->email ) ) {
|
1298 |
+
_stc()->add_message( sprintf( __( 'Thank you! <strong>%1$s</strong> has been confirmed, and is now subscribed to comments.', 'subscribe-to-comments' ), _stc()->email ) );
|
1299 |
+
}
|
1300 |
+
break;
|
1301 |
+
|
1302 |
+
case "change_email" :
|
1303 |
+
if ( _stc()->change_email() ) {
|
1304 |
+
_stc()->add_message( sprintf( __('All notifications that were formerly sent to <strong>%1$s</strong> will now be sent to <strong>%2$s</strong>!', 'subscribe-to-comments' ), _stc()->email, _stc()->new_email ) );
|
1305 |
+
// change info to the new email
|
1306 |
+
_stc()->email = _stc()->new_email;
|
1307 |
+
unset( _stc()->new_email );
|
1308 |
+
_stc()->key = _stc()->generate_key( _stc()->email );
|
1309 |
+
_stc()->validate_key();
|
1310 |
+
}
|
1311 |
+
break;
|
1312 |
+
|
1313 |
+
case "remove_subscriptions" :
|
1314 |
+
$postsremoved = _stc()->remove_subscriptions( $_POST['subscrips'] );
|
1315 |
+
if ( $postsremoved > 0 )
|
1316 |
+
_stc()->add_message( sprintf( __( '<strong>%1$s</strong> %2$s removed successfully.', 'subscribe-to-comments' ), $postsremoved, ( $postsremoved != 1 ) ? __( 'subscriptions', 'subscribe-to-comments' ) : __( 'subscription', 'subscribe-to-comments' ) ) );
|
1317 |
+
break;
|
1318 |
+
|
1319 |
+
case "remove_block" :
|
1320 |
+
if ( _stc()->remove_block( _stc()->email ) )
|
1321 |
+
_stc()->add_message( sprintf( __( 'The block on <strong>%s</strong> has been successfully removed.', 'subscribe-to-comments' ), _stc()->email ) );
|
1322 |
+
else
|
1323 |
+
_stc()->add_error( sprintf( __( '<strong>%s</strong> isn\'t blocked!', 'subscribe-to-comments' ), _stc()->email ), 'manager' );
|
1324 |
+
break;
|
1325 |
+
|
1326 |
+
case "email_change_request" :
|
1327 |
+
if ( _stc()->is_blocked( _stc()->email ) )
|
1328 |
+
_stc()->add_error( sprintf( __( '<strong>%s</strong> has been blocked from receiving notifications. You will have to have the administrator remove the block before you will be able to change your notification address.', 'subscribe-to-comments' ), _stc()->email ) );
|
1329 |
+
else
|
1330 |
+
if ( _stc()->change_email_request( _stc()->email, _stc()->new_email ) )
|
1331 |
+
_stc()->add_message( sprintf( __( 'Your change of e-mail request was successfully received. Please check your old account (<strong>%s</strong>) in order to confirm the change.', 'subscribe-to-comments' ), _stc()->email ) );
|
1332 |
+
break;
|
1333 |
+
|
1334 |
+
case "block_request" :
|
1335 |
+
if ( _stc()->block_email_request( _stc()->email ) )
|
1336 |
+
_stc()->add_message( sprintf( __( 'Your request to block <strong>%s</strong> from receiving any further notifications has been received. In order for you to complete the block, please check your e-mail and click on the link in the message that has been sent to you.', 'subscribe-to-comments' ), _stc()->email ) );
|
1337 |
+
break;
|
1338 |
+
|
1339 |
+
case "solo_subscribe" :
|
1340 |
+
_stc()->add_message( sprintf( __( '<strong>%1$s</strong> has been successfully subscribed to %2$s', 'subscribe-to-comments' ), _stc()->email, _stc()->entry_link( $blog_id, $_GET['subscribeid'] ) ) );
|
1341 |
+
break;
|
1342 |
+
|
1343 |
+
case "block" :
|
1344 |
+
if ( _stc()->add_block( _stc()->email ) )
|
1345 |
+
_stc()->add_message( sprintf( __( '<strong>%1$s</strong> has been added to the "do not mail" list. You will no longer receive any notifications from this site. If this was done in error, please contact the <a href="mailto:%2$s">site administrator</a> to remove this block.', 'subscribe-to-comments' ), _stc()->email, _stc()->site_email ) );
|
1346 |
+
else
|
1347 |
+
_stc()->add_error( sprintf( __( '<strong>%s</strong> has already been blocked!', 'subscribe-to-comments'), _stc()->email), 'manager');
|
1348 |
+
_stc()->key = _stc()->generate_key( _stc()->email );
|
1349 |
+
_stc()->validate_key();
|
1350 |
+
break;
|
1351 |
+
|
1352 |
+
endswitch;
|
1353 |
+
|
1354 |
+
?>
|
1355 |
+
|
1356 |
+
<?php _stc()->show_messages(); ?>
|
1357 |
+
|
1358 |
+
<?php _stc()->show_errors(); ?>
|
1359 |
+
|
1360 |
+
<?php if ( function_exists( 'screen_icon' ) ) screen_icon(); ?>
|
1361 |
+
<div class="wrap">
|
1362 |
+
<?php if ( ! _stc()->standalone ) : ?>
|
1363 |
+
<h2><?php _e( 'Comment Subscription Manager', 'subscribe-to-comments' ); ?></h2>
|
1364 |
+
<?php endif; ?>
|
1365 |
+
|
1366 |
+
<?php if ( !empty( _stc()->ref ) ) : ?>
|
1367 |
+
<?php _stc()->add_message( sprintf( __( 'Return to the page you were viewing: %s', 'subscribe-to-comments' ), _stc()->entry_link( $blog_id, url_to_postid( _stc()->ref ), _stc()->ref ) ) ); ?>
|
1368 |
+
<?php _stc()->show_messages(); ?>
|
1369 |
+
<?php endif; ?>
|
1370 |
+
|
1371 |
+
|
1372 |
+
|
1373 |
+
<?php if ( _stc()->is_blocked() ) { ?>
|
1374 |
+
|
1375 |
+
<?php if ( current_user_can( 'manage_options' ) ) : ?>
|
1376 |
+
|
1377 |
+
<h3><?php _e( 'Remove Block', 'subscribe-to-comments' ); ?></h3
|
1378 |
+
|
1379 |
+
<p>
|
1380 |
+
<?php printf( __( 'Click the button below to remove the block on <strong>%s</strong>. This should only be done if the user has specifically requested it.', 'subscribe-to-comments' ), _stc()->email ); ?>
|
1381 |
+
</p>
|
1382 |
+
|
1383 |
+
<form name="removeBlock" method="post" action="<?php echo _stc()->form_action; ?>">
|
1384 |
+
<input type="hidden" name="removeBlock" value="removeBlock /">
|
1385 |
+
<?php _stc()->hidden_form_fields(); ?>
|
1386 |
+
|
1387 |
+
<p class="submit">
|
1388 |
+
<input type="submit" name="submit" value="<?php _e( 'Remove Block »', 'subscribe-to-comments' ); ?>" />
|
1389 |
+
</p>
|
1390 |
+
</form>
|
1391 |
+
|
1392 |
+
<?php else : ?>
|
1393 |
+
|
1394 |
+
<h3><?php _e( 'Blocked', 'subscribe-to-comments' ); ?></h3>
|
1395 |
+
|
1396 |
+
<p>
|
1397 |
+
<?php printf( __( 'You have indicated that you do not wish to receive any notifications at <strong>%1$s</strong> from this site. If this is incorrect, or if you wish to have the block removed, please contact the <a href="mailto:%2$s">site administrator</a>.', 'subscribe-to-comments' ), _stc()->email, _stc()->site_email ); ?>
|
1398 |
+
</p>
|
1399 |
+
|
1400 |
+
<?php endif; ?>
|
1401 |
+
|
1402 |
+
|
1403 |
+
<?php } else { ?>
|
1404 |
+
|
1405 |
+
|
1406 |
+
<?php $postlist = _stc()->subscriptions_from_email(); ?>
|
1407 |
+
|
1408 |
+
<?php
|
1409 |
+
if ( isset( _stc()->email ) && !is_array( $postlist ) && _stc()->email != _stc()->site_email && _stc()->email != get_bloginfo( 'admin_email' ) ) {
|
1410 |
+
if ( is_email( _stc()->email ) )
|
1411 |
+
_stc()->add_error( sprintf( __( '<strong>%s</strong> is not subscribed to any posts on this site.', 'subscribe-to-comments' ), _stc()->email ) );
|
1412 |
+
else
|
1413 |
+
_stc()->add_error( sprintf( __( '<strong>%s</strong> is not a valid e-mail address.', 'subscribe-to-comments' ), _stc()->email ) );
|
1414 |
+
}
|
1415 |
+
?>
|
1416 |
+
|
1417 |
+
<?php _stc()->show_errors(); ?>
|
1418 |
+
|
1419 |
+
|
1420 |
+
|
1421 |
+
|
1422 |
+
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
1423 |
+
|
1424 |
+
<?php if ( isset( $_REQUEST['email'] ) && $_REQUEST['email'] ) : ?>
|
1425 |
+
<p><a href="<?php echo esc_url( _stc()->form_action ); ?>"><?php _e( '« Back' ); ?></a></p>
|
1426 |
+
<?php endif; ?>
|
1427 |
+
|
1428 |
+
<h3><?php _e( 'Find Subscriptions', 'subscribe-to-comments' ); ?></h3>
|
1429 |
+
|
1430 |
+
<p>
|
1431 |
+
<?php _e( 'Enter an e-mail address to view its subscriptions or undo a block.', 'subscribe-to-comments' ); ?>
|
1432 |
+
</p>
|
1433 |
+
|
1434 |
+
<form name="getemail" method="post" action="<?php echo esc_url( _stc()->form_action ); ?>">
|
1435 |
+
<input type="hidden" name="ref" value="<?php echo _stc()->ref; ?>" />
|
1436 |
+
|
1437 |
+
<p>
|
1438 |
+
<input name="email" type="text" id="email" size="40" />
|
1439 |
+
<input type="submit" class="button-secondary" value="<?php _e( 'Search »', 'subscribe-to-comments' ); ?>" />
|
1440 |
+
</p>
|
1441 |
+
</form>
|
1442 |
+
|
1443 |
+
<?php if ( !isset( $_REQUEST['email'] ) || !$_REQUEST['email'] ) : ?>
|
1444 |
+
<?php if ( !isset( $_REQUEST['showallsubscribers'] ) || !$_REQUEST['showallsubscribers'] ) : ?>
|
1445 |
+
<h3><?php _e( 'Top Subscriber List', 'subscribe-to-comments' ); ?></h3>
|
1446 |
+
<?php else : ?>
|
1447 |
+
<h3><?php _e( 'Subscriber List', 'subscribe-to-comments' ); ?></h3>
|
1448 |
+
<?php endif; ?>
|
1449 |
+
|
1450 |
+
<?php
|
1451 |
+
$stc_limit = ( !isset( $_REQUEST['showallsubscribers'] ) || !$_REQUEST['showallsubscribers'] ) ? 'LIMIT 25' : '';
|
1452 |
+
if ( _stc()->is_multisite() ) {
|
1453 |
+
$all_pm_subscriptions = $wpdb->get_results( "SELECT DISTINCT email, count(post_id) as ccount FROM _stc()->ms_table WHERE status = 'active' GROUP BY email ORDER BY ccount DESC $stc_limit" );
|
1454 |
+
} else {
|
1455 |
+
$all_pm_subscriptions = $wpdb->get_results( "SELECT DISTINCT LCASE(meta_value) as email, count(post_id) as ccount FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments' GROUP BY email ORDER BY ccount DESC $stc_limit" );
|
1456 |
+
}
|
1457 |
+
$all_subscriptions = array();
|
1458 |
+
|
1459 |
+
foreach ( (array) $all_pm_subscriptions as $sub ) {
|
1460 |
+
if ( !isset( $all_subscriptions[$sub->email] ) )
|
1461 |
+
$all_subscriptions[$sub->email] = (int) $sub->ccount;
|
1462 |
+
else
|
1463 |
+
$all_subscriptions[$sub->email] += (int) $sub->ccount;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
if ( !isset( $_REQUEST['showallsubscribers'] ) || !$_REQUEST['showallsubscribers'] ) : ?>
|
1467 |
+
<p><a href="<?php echo esc_url( esc_attr( add_query_arg( 'showallsubscribers', '1', _stc()->form_action ) ) ); ?>"><?php _e( 'Show all subscribers',
|
1468 |
+
'subscribe-to-comments' ); ?></a></p>
|
1469 |
+
<?php elseif ( !isset( $_REQUEST['showccfield'] ) || !$_REQUEST['showccfield'] ) : ?>
|
1470 |
+
<p><a href="<?php echo add_query_arg( 'showccfield', '1' ); ?>"><?php _e( 'Show list of subscribers in <code>CC:</code>-field format (for bulk e-mailing)', 'subscribe-to-comments' ); ?></a></p>
|
1471 |
+
<?php else : ?>
|
1472 |
+
<p><a href="<?php echo esc_url( _stc()->form_action ); ?>"><?php _e( '« Back to regular view' ); ?></a></p>
|
1473 |
+
<p><textarea cols="60" rows="10"><?php echo implode( ', ', array_keys( $all_subscriptions ) ); ?></textarea></p>
|
1474 |
+
<?php endif;
|
1475 |
+
|
1476 |
+
|
1477 |
+
if ( $all_subscriptions ) {
|
1478 |
+
if ( !$_REQUEST['showccfield'] ) {
|
1479 |
+
echo "<ul>\n";
|
1480 |
+
foreach ( (array) $all_subscriptions as $email => $ccount ) {
|
1481 |
+
$enc_email = urlencode( $email );
|
1482 |
+
echo "<li>($ccount) <a href='" . esc_url( _stc()->form_action . "&email=$enc_email" ) . "'>" . esc_html( $email ) .
|
1483 |
+
"</a></li>\n";
|
1484 |
+
}
|
1485 |
+
echo "</ul>\n";
|
1486 |
+
}
|
1487 |
+
?>
|
1488 |
+
<h3><?php _e( 'Top Subscribed Posts', 'subscribe-to-comments' ); ?></h3>
|
1489 |
+
<?php
|
1490 |
+
if ( _stc()->is_multisite() ) {
|
1491 |
+
$top_subscribed_posts = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT post_id, count( distinct post_id ) as ccount FROM _stc()->ms_table WHERE status = 'active' AND blog_id = %s ORDER BY ccount DEST LIMIT 25", $blog_id ) );
|
1492 |
+
} else {
|
1493 |
+
$top_subscribed_posts = $wpdb->get_results( "SELECT DISTINCT post_id, count(distinct meta_value) as ccount FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments' GROUP BY post_id ORDER BY ccount DESC LIMIT 25" );
|
1494 |
+
}
|
1495 |
+
$all_top_posts = array();
|
1496 |
+
|
1497 |
+
foreach ( (array) $top_subscribed_posts as $pid ) {
|
1498 |
+
if ( !isset( $all_top_posts[$pid->post_id] ) )
|
1499 |
+
$all_top_posts[$pid->post_id] = (int) $pid->ccount;
|
1500 |
+
else
|
1501 |
+
$all_top_posts[$pid->post_id] += (int) $pid->ccount;
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
arsort( $all_top_posts );
|
1505 |
+
|
1506 |
+
echo "<ul>\n";
|
1507 |
+
foreach ( $all_top_posts as $pid => $ccount ) {
|
1508 |
+
echo "<li>($ccount) <a href='" . get_permalink( $pid ) . "'>" . get_the_title( $pid ) . "</a></li>\n";
|
1509 |
+
}
|
1510 |
+
echo "</ul>";
|
1511 |
+
?>
|
1512 |
+
|
1513 |
+
<?php } ?>
|
1514 |
+
|
1515 |
+
<?php endif; ?>
|
1516 |
+
|
1517 |
+
<?php } ?>
|
1518 |
+
|
1519 |
+
<?php if ( count( $postlist ) > 0 && is_array( $postlist ) ) { ?>
|
1520 |
+
|
1521 |
+
|
1522 |
+
<script type="text/javascript">
|
1523 |
+
<!--
|
1524 |
+
function checkAll(form) {
|
1525 |
+
for ( i = 0, n = form.elements.length; i < n; i++ ) {
|
1526 |
+
if ( form.elements[i].type == "checkbox" ) {
|
1527 |
+
if ( form.elements[i].checked == true )
|
1528 |
+
form.elements[i].checked = false;
|
1529 |
+
else
|
1530 |
+
form.elements[i].checked = true;
|
1531 |
+
}
|
1532 |
+
}
|
1533 |
+
}
|
1534 |
+
//-->
|
1535 |
+
</script>
|
1536 |
+
|
1537 |
+
<h3><?php _e( 'Subscriptions', 'subscribe-to-comments' ); ?></h3>
|
1538 |
+
|
1539 |
+
<p>
|
1540 |
+
<?php printf( __( '<strong>%s</strong> is subscribed to the posts listed below. To unsubscribe to one or more posts, click the checkbox next to the title, then click "Remove Selected Subscription(s)" at the bottom of the list.', 'subscribe-to-comments' ), _stc()->email ); ?>
|
1541 |
+
</p>
|
1542 |
+
|
1543 |
+
<form name="removeSubscription" id="removeSubscription" method="post" action="<?php echo esc_url( _stc()->form_action ); ?>">
|
1544 |
+
<input type="hidden" name="removesubscrips" value="removesubscrips" />
|
1545 |
+
<?php _stc()->hidden_form_fields(); ?>
|
1546 |
+
|
1547 |
+
<ol>
|
1548 |
+
<?php $i = 0;
|
1549 |
+
foreach ( $postlist as $pl ) { $i++; ?>
|
1550 |
+
<li><label for="subscrip-<?php echo $i; ?>"><input id="subscrip-<?php echo $i; ?>" type="checkbox" name="subscrips[]" value="<?php echo $pl[0] .'-'. $pl[1]; ?>" /> <?php echo _stc()->entry_link( $pl[0], $pl[1] ); ?></label></li>
|
1551 |
+
<?php } ?>
|
1552 |
+
</ol>
|
1553 |
+
|
1554 |
+
<p>
|
1555 |
+
<a href="javascript:;" onclick="checkAll(document.getElementById('removeSubscription')); return false; "><?php _e( 'Invert Checkbox Selection', 'subscribe-to-comments' ); ?></a>
|
1556 |
+
</p>
|
1557 |
+
|
1558 |
+
<p class="submit">
|
1559 |
+
<input type="submit" name="submit" value="<?php _e( 'Remove Selected Subscription(s) »', 'subscribe-to-comments' ); ?>" />
|
1560 |
+
</p>
|
1561 |
+
</form>
|
1562 |
+
|
1563 |
+
</div>
|
1564 |
+
|
1565 |
+
<div class="wrap">
|
1566 |
+
<h2><?php _e( 'Advanced Options', 'subscribe-to-comments' ); ?></h2>
|
1567 |
+
|
1568 |
+
<h3><?php _e( 'Block All Notifications', 'subscribe-to-comments' ); ?></h3>
|
1569 |
+
|
1570 |
+
<form name="blockemail" method="post" action="<?php echo esc_url( _stc()->form_action ); ?>">
|
1571 |
+
<input type="hidden" name="blockemail" value="blockemail" />
|
1572 |
+
<?php _stc()->hidden_form_fields(); ?>
|
1573 |
+
|
1574 |
+
<p>
|
1575 |
+
<?php printf( __( 'If you would like <strong>%s</strong> to be blocked from receiving any notifications from this site, click the button below. This should be reserved for cases where someone is signing you up for notifications without your consent.', 'subscribe-to-comments' ), _stc()->email ); ?>
|
1576 |
+
</p>
|
1577 |
+
|
1578 |
+
<p class="submit">
|
1579 |
+
<input type="submit" name="submit" value="<?php _e( 'Block Notifications »', 'subscribe-to-comments' ); ?>" />
|
1580 |
+
</p>
|
1581 |
+
</form>
|
1582 |
+
|
1583 |
+
|
1584 |
+
|
1585 |
+
<h3><?php _e( 'Change E-mail Address', 'subscribe-to-comments' ); ?></h3>
|
1586 |
+
|
1587 |
+
<form name="changeemailrequest" method="post" action="<?php echo esc_url( _stc()->form_action ); ?>">
|
1588 |
+
<input type="hidden" name="changeemailrequest" value="changeemailrequest" />
|
1589 |
+
<?php _stc()->hidden_form_fields(); ?>
|
1590 |
+
|
1591 |
+
<p>
|
1592 |
+
<?php printf( __( 'If you would like to change the e-mail address for your subscriptions, enter the new address below. You will be required to verify this request by clicking a special link sent to your current address (<strong>%s</strong>).', 'subscribe-to-comments' ), _stc()->email ); ?>
|
1593 |
+
</p>
|
1594 |
+
|
1595 |
+
<p>
|
1596 |
+
<?php _e( 'New E-mail Address:', 'subscribe-to-comments' ); ?>
|
1597 |
+
<input name="new_email" type="text" id="new_email" size="40" />
|
1598 |
+
<input type="submit" name="submit" class="button-secondary" value="<?php _e( 'Change E-mail Address »', 'subscribe-to-comments' ); ?>" />
|
1599 |
+
</p>
|
1600 |
+
</form>
|
1601 |
+
|
1602 |
+
|
1603 |
+
<?php } ?>
|
1604 |
+
<?php } //end if not in do not mail ?>
|
1605 |
+
</div>
|
1606 |
+
|
1607 |
+
<?php if ( _stc()->standalone ) : ?>
|
1608 |
+
<?php if ( !_stc()->use_wp_style ) :
|
1609 |
+
echo _stc()->after_manager;
|
1610 |
+
|
1611 |
+
if ( !empty( _stc()->sidebar ) )
|
1612 |
+
@include_once( _stc()->sidebar );
|
1613 |
+
if ( !empty( _stc()->footer ) )
|
1614 |
+
@include_once( _stc()->footer );
|
1615 |
+
?>
|
1616 |
+
<?php else : ?>
|
1617 |
+
</body>
|
1618 |
+
</html>
|
1619 |
+
<?php endif; ?>
|
1620 |
+
<?php endif; ?>
|
1621 |
+
|
1622 |
+
<?php }
|
1623 |
+
|
1624 |
+
function cws_stc_uninstall_hook() {
|
1625 |
+
_stc()->uninstall();
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
// Bootstrap the whole thing
|
1629 |
+
_stc();
|