Version Description
Download this release
Release Info
Developer | wpkube |
Plugin | Subscribe To Comments Reloaded |
Version | 220502 |
Comparing to | |
See all releases |
Code changes from version 211130 to 220502
- includes/css/stcr-admin-style.css +541 -464
- options/index.php +26 -27
- options/options_template.php +133 -112
- options/panel1-add-subscription.php +3 -0
- options/panel1-business-logic.php +52 -0
- options/panel1-edit-subscription.php +1 -0
- options/stcr_comment_form.php +388 -373
- options/stcr_manage_subscriptions.php +360 -354
- options/stcr_management_page.php +455 -440
- options/stcr_notifications.php +385 -371
- options/stcr_options.php +827 -727
- options/stcr_support.php +57 -57
- options/stcr_system.php +790 -764
- readme.txt +10 -2
- subscribe-to-comments-reloaded.php +87 -82
- templates/key_expired.php +92 -86
- templates/request-management-link.php +331 -275
- templates/subscribe.php +343 -287
- utils/stcr_manage.php +773 -754
- utils/stcr_upgrade.php +819 -761
- utils/stcr_utils.php +87 -24
- wp_subscribe_reloaded.php +1780 -1746
includes/css/stcr-admin-style.css
CHANGED
@@ -1,464 +1,541 @@
|
|
1 |
-
/*
|
2 |
-
Admin styles for StCR.
|
3 |
-
|
4 |
-
@author reedyseth
|
5 |
-
@since 21-Sep-2015
|
6 |
-
*/
|
7 |
-
/* ----------------------------------------------------------
|
8 |
-
Common styles and utilities on pages.
|
9 |
-
@author Israel Barragan (Reedyseth)
|
10 |
-
@since 01-Apr-2018
|
11 |
-
---------------------------------------------------------- */
|
12 |
-
.validate-error-text {
|
13 |
-
color: #f55252;
|
14 |
-
font-weight: bold;
|
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 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
-
|
65 |
-
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
border-
|
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 |
-
.form-control-input-
|
172 |
-
width:
|
173 |
-
display: inline !important;
|
174 |
-
font-size: 0.9rem !important;
|
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 |
-
width:
|
203 |
-
|
204 |
-
font-size:
|
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 |
-
|
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 |
-
background-
|
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 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
}
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
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 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/*
|
2 |
+
Admin styles for StCR.
|
3 |
+
|
4 |
+
@author reedyseth
|
5 |
+
@since 21-Sep-2015
|
6 |
+
*/
|
7 |
+
/* ----------------------------------------------------------
|
8 |
+
Common styles and utilities on pages.
|
9 |
+
@author Israel Barragan (Reedyseth)
|
10 |
+
@since 01-Apr-2018
|
11 |
+
---------------------------------------------------------- */
|
12 |
+
.validate-error-text {
|
13 |
+
color: #f55252;
|
14 |
+
font-weight: bold;
|
15 |
+
}
|
16 |
+
|
17 |
+
.validate-error-field {
|
18 |
+
border: 1px solid #ff9595 !important;
|
19 |
+
}
|
20 |
+
|
21 |
+
.stcr-hidden {
|
22 |
+
position: absolute !important;
|
23 |
+
top: -9999px !important;
|
24 |
+
left: -9999px !important;
|
25 |
+
}
|
26 |
+
|
27 |
+
.clearFix {
|
28 |
+
clear: both;
|
29 |
+
}
|
30 |
+
|
31 |
+
.hidden {
|
32 |
+
display: none;
|
33 |
+
}
|
34 |
+
|
35 |
+
.float-right {
|
36 |
+
float: right;
|
37 |
+
}
|
38 |
+
|
39 |
+
.float-left {
|
40 |
+
float: left;
|
41 |
+
}
|
42 |
+
|
43 |
+
.stcr-alert-box {
|
44 |
+
font-size: 0.85em;
|
45 |
+
}
|
46 |
+
|
47 |
+
/* ----------------------------------------------------------
|
48 |
+
Styles use on the interaction with the user.
|
49 |
+
@author Israel Barragan (Reedyseth)
|
50 |
+
@since 01-Apr-2018
|
51 |
+
---------------------------------------------------------- */
|
52 |
+
.stcr-loading-animation {
|
53 |
+
display: none;
|
54 |
+
}
|
55 |
+
|
56 |
+
.dismiss {
|
57 |
+
background: #00a0d2;
|
58 |
+
border-color: #0073aa;
|
59 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5), 0 1px 0 rgba(0, 0, 0, 0.15);
|
60 |
+
box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5), 0 1px 0 rgba(0, 0, 0, 0.15);
|
61 |
+
color: #fff;
|
62 |
+
text-decoration: none;
|
63 |
+
display: inline-block;
|
64 |
+
text-decoration: none;
|
65 |
+
font-size: 13px;
|
66 |
+
line-height: 26px;
|
67 |
+
height: 28px;
|
68 |
+
margin: 0 0 0 10px;
|
69 |
+
padding: 0 10px 1px;
|
70 |
+
cursor: pointer;
|
71 |
+
border-width: 1px;
|
72 |
+
border-style: solid;
|
73 |
+
-webkit-appearance: none;
|
74 |
+
-webkit-border-radius: 3px;
|
75 |
+
border-radius: 3px;
|
76 |
+
white-space: nowrap;
|
77 |
+
-webkit-box-sizing: border-box;
|
78 |
+
-moz-box-sizing: border-box;
|
79 |
+
box-sizing: border-box;
|
80 |
+
}
|
81 |
+
|
82 |
+
.dismiss:hover {
|
83 |
+
background: #0091cd;
|
84 |
+
border-color: #0073aa;
|
85 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
|
86 |
+
box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
|
87 |
+
color: #fff;
|
88 |
+
}
|
89 |
+
|
90 |
+
.info-panel {
|
91 |
+
background-color: #BBBBBB;
|
92 |
+
padding: 8px;
|
93 |
+
font-style: italic;
|
94 |
+
}
|
95 |
+
|
96 |
+
.more-info {
|
97 |
+
color: #008ec2;
|
98 |
+
cursor: pointer;
|
99 |
+
width: 10%;
|
100 |
+
font-size: 1.4rem;
|
101 |
+
}
|
102 |
+
|
103 |
+
.stcr-dismiss-notice p {
|
104 |
+
font-size: 0.8rem !important;
|
105 |
+
}
|
106 |
+
.stcr-dismiss-notice h2 {
|
107 |
+
font-size: 1rem !important;
|
108 |
+
}
|
109 |
+
|
110 |
+
li {
|
111 |
+
margin-bottom: 0;
|
112 |
+
}
|
113 |
+
|
114 |
+
.navbar-expand-lg .navbar-nav .dropdown-menu {
|
115 |
+
top: 30px;
|
116 |
+
font-size: 0.9rem;
|
117 |
+
}
|
118 |
+
|
119 |
+
/* ----------------------------------------------------------
|
120 |
+
Styles use on form styles. Helpful to customize Bootstrap behavior.
|
121 |
+
@author Israel Barragan (Reedyseth)
|
122 |
+
@since 01-Apr-2018
|
123 |
+
---------------------------------------------------------- */
|
124 |
+
.form-controls-font {
|
125 |
+
font-size: 1em !important;
|
126 |
+
}
|
127 |
+
|
128 |
+
.col-form-label {
|
129 |
+
font-size: 0.95rem !important;
|
130 |
+
font-weight: 600 !important;
|
131 |
+
}
|
132 |
+
|
133 |
+
.subscribers-mass-actions {
|
134 |
+
margin-top: 20px;
|
135 |
+
font-size: 0.9rem;
|
136 |
+
}
|
137 |
+
|
138 |
+
.subscribers-mass-actions select,
|
139 |
+
.subscribers-mass-actions button,
|
140 |
+
.subscribers-mass-actions input {
|
141 |
+
font-size: 0.9rem !important;
|
142 |
+
}
|
143 |
+
|
144 |
+
.mass-update-subs {
|
145 |
+
/*height: 100%;*/
|
146 |
+
margin-top: 0 !important;
|
147 |
+
}
|
148 |
+
|
149 |
+
.mass-update-select-status {
|
150 |
+
width: 70% !important;
|
151 |
+
display: inline !important;
|
152 |
+
}
|
153 |
+
|
154 |
+
.new-sub-select-status {
|
155 |
+
width: 76% !important;
|
156 |
+
display: inline !important;
|
157 |
+
}
|
158 |
+
|
159 |
+
.form-control-select {
|
160 |
+
width: 42% !important;
|
161 |
+
display: inline !important;
|
162 |
+
font-size: 0.9rem !important;
|
163 |
+
}
|
164 |
+
|
165 |
+
.form-control-input-3 {
|
166 |
+
width: 30% !important;
|
167 |
+
display: inline !important;
|
168 |
+
font-size: 0.9rem !important;
|
169 |
+
}
|
170 |
+
|
171 |
+
.form-control-input-4 {
|
172 |
+
width: 40% !important;
|
173 |
+
display: inline !important;
|
174 |
+
font-size: 0.9rem !important;
|
175 |
+
}
|
176 |
+
|
177 |
+
.form-control-input-5 {
|
178 |
+
width: 50% !important;
|
179 |
+
display: inline !important;
|
180 |
+
font-size: 0.9rem !important;
|
181 |
+
}
|
182 |
+
|
183 |
+
.form-control-input-6 {
|
184 |
+
width: 60% !important;
|
185 |
+
display: inline !important;
|
186 |
+
font-size: 0.9rem !important;
|
187 |
+
}
|
188 |
+
|
189 |
+
.form-control-input-7 {
|
190 |
+
width: 70% !important;
|
191 |
+
display: inline !important;
|
192 |
+
font-size: 0.9rem !important;
|
193 |
+
}
|
194 |
+
|
195 |
+
.form-control-input-8 {
|
196 |
+
width: 80% !important;
|
197 |
+
display: inline !important;
|
198 |
+
font-size: 0.9rem !important;
|
199 |
+
}
|
200 |
+
|
201 |
+
.form-control-input-9 {
|
202 |
+
width: 90% !important;
|
203 |
+
display: inline !important;
|
204 |
+
font-size: 0.9rem !important;
|
205 |
+
}
|
206 |
+
|
207 |
+
.add-new-subs {
|
208 |
+
/*height: 100%;*/
|
209 |
+
margin-top: 0 !important;
|
210 |
+
}
|
211 |
+
|
212 |
+
.mass-update-subs h6,
|
213 |
+
.add-new-subs h6 {
|
214 |
+
cursor: pointer;
|
215 |
+
}
|
216 |
+
|
217 |
+
.subscribe-form-button {
|
218 |
+
font-size: 0.8rem !important;
|
219 |
+
}
|
220 |
+
|
221 |
+
.switch {
|
222 |
+
position: relative;
|
223 |
+
display: inline-flex;
|
224 |
+
margin-top: 7px;
|
225 |
+
height: 26px;
|
226 |
+
width: 120px;
|
227 |
+
background: rgba(45, 43, 42, 0.1);
|
228 |
+
border-radius: 3px;
|
229 |
+
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.13), 0 1px rgba(255, 255, 255, 0.1);
|
230 |
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.13), 0 1px rgba(255, 255, 255, 0.1);
|
231 |
+
}
|
232 |
+
|
233 |
+
.switch-label {
|
234 |
+
position: relative;
|
235 |
+
z-index: 2;
|
236 |
+
float: left;
|
237 |
+
width: 58px;
|
238 |
+
line-height: 26px;
|
239 |
+
font-size: 11px;
|
240 |
+
color: #949494;
|
241 |
+
text-align: center;
|
242 |
+
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
|
243 |
+
cursor: pointer;
|
244 |
+
}
|
245 |
+
|
246 |
+
.switch-label:active {
|
247 |
+
font-weight: bold;
|
248 |
+
}
|
249 |
+
|
250 |
+
.switch-label-off {
|
251 |
+
padding-left: 2px;
|
252 |
+
}
|
253 |
+
|
254 |
+
.switch-label-on {
|
255 |
+
padding-right: 2px;
|
256 |
+
}
|
257 |
+
|
258 |
+
.switch-input {
|
259 |
+
display: none !important;
|
260 |
+
}
|
261 |
+
|
262 |
+
.switch-input:checked + .switch-label {
|
263 |
+
font-weight: bold;
|
264 |
+
color: rgba(0, 0, 0, 0.65);
|
265 |
+
text-shadow: 0 1px rgba(255, 255, 255, 0.25);
|
266 |
+
-webkit-transition: 0.15s ease-out;
|
267 |
+
-moz-transition: 0.15s ease-out;
|
268 |
+
-o-transition: 0.15s ease-out;
|
269 |
+
transition: 0.15s ease-out;
|
270 |
+
}
|
271 |
+
|
272 |
+
.switch-input:checked + .switch-label-on ~ .switch-selection {
|
273 |
+
/* Note: left: 50% doesn't transition in WebKit */
|
274 |
+
left: 60px;
|
275 |
+
background-image: -webkit-linear-gradient(top, #f3e4f6, #82928f);
|
276 |
+
background-image: -moz-linear-gradient(top, #f3e4f6, #82928f);
|
277 |
+
background-image: -o-linear-gradient(top, #f3e4f6, #82928f);
|
278 |
+
background-image: linear-gradient(to bottom, #f3e4f6, #82928f);
|
279 |
+
}
|
280 |
+
|
281 |
+
.switch-selection {
|
282 |
+
display: block;
|
283 |
+
position: absolute;
|
284 |
+
z-index: 1;
|
285 |
+
top: 2px;
|
286 |
+
left: 2px;
|
287 |
+
width: 58px;
|
288 |
+
height: 22px;
|
289 |
+
background: #65bd63;
|
290 |
+
border-radius: 3px;
|
291 |
+
background-image: -webkit-linear-gradient(top, #9dd993, #46d443);
|
292 |
+
background-image: -moz-linear-gradient(top, #9dd993, #46d443);
|
293 |
+
background-image: -o-linear-gradient(top, #9dd993, #46d443);
|
294 |
+
background-image: linear-gradient(to bottom, #9dd993, #46d443);
|
295 |
+
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
|
296 |
+
box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
|
297 |
+
-webkit-transition: left 0.15s ease-out;
|
298 |
+
-moz-transition: left 0.15s ease-out;
|
299 |
+
-o-transition: left 0.15s ease-out;
|
300 |
+
transition: left 0.15s ease-out;
|
301 |
+
}
|
302 |
+
|
303 |
+
.switch-blue .switch-selection {
|
304 |
+
background: #3aa2d0;
|
305 |
+
background-image: -webkit-linear-gradient(top, #4fc9ee, #3aa2d0);
|
306 |
+
background-image: -moz-linear-gradient(top, #4fc9ee, #3aa2d0);
|
307 |
+
background-image: -o-linear-gradient(top, #4fc9ee, #3aa2d0);
|
308 |
+
background-image: linear-gradient(to bottom, #4fc9ee, #3aa2d0);
|
309 |
+
}
|
310 |
+
|
311 |
+
.switch-yellow .switch-selection {
|
312 |
+
background: #c4bb61;
|
313 |
+
background-image: -webkit-linear-gradient(top, #e0dd94, #c4bb61);
|
314 |
+
background-image: -moz-linear-gradient(top, #e0dd94, #c4bb61);
|
315 |
+
background-image: -o-linear-gradient(top, #e0dd94, #c4bb61);
|
316 |
+
background-image: linear-gradient(to bottom, #e0dd94, #c4bb61);
|
317 |
+
}
|
318 |
+
|
319 |
+
.helpDescription {
|
320 |
+
margin-left: 10px;
|
321 |
+
display: inline-flex;
|
322 |
+
color: #008ec2;
|
323 |
+
font-size: 0.9rem;
|
324 |
+
cursor: pointer;
|
325 |
+
}
|
326 |
+
|
327 |
+
.webui-popover-helpDescriptionContent {
|
328 |
+
font-size: 0.85rem;
|
329 |
+
}
|
330 |
+
|
331 |
+
.arrow {
|
332 |
+
left: -8px !important;
|
333 |
+
}
|
334 |
+
|
335 |
+
.arrow:after {
|
336 |
+
left: 4px !important;
|
337 |
+
top: 0px !important;
|
338 |
+
width: 17px !important;
|
339 |
+
height: 2px !important;
|
340 |
+
}
|
341 |
+
|
342 |
+
/* ----------------------------------------------------------
|
343 |
+
Styles use on Cards styles. Helpful to customize Bootstrap Cards behavior.
|
344 |
+
@author Israel Barragan (Reedyseth)
|
345 |
+
@since 01-Apr-2018
|
346 |
+
---------------------------------------------------------- */
|
347 |
+
.card {
|
348 |
+
padding: 0 !important;
|
349 |
+
}
|
350 |
+
|
351 |
+
.card-subscribers {
|
352 |
+
-webkit-box-shadow: 0 0 6px 0 #9E9E9E;
|
353 |
+
box-shadow: 0 0 6px 0 #9E9E9E;
|
354 |
+
}
|
355 |
+
|
356 |
+
.card-header {
|
357 |
+
background-color: #008ec2 !important;
|
358 |
+
color: #ffffff;
|
359 |
+
}
|
360 |
+
|
361 |
+
.card-font-size {
|
362 |
+
font-size: 0.85em;
|
363 |
+
}
|
364 |
+
|
365 |
+
.original-card-padding {
|
366 |
+
padding: 1.25rem !important;
|
367 |
+
}
|
368 |
+
|
369 |
+
.card-no-max-width {
|
370 |
+
max-width: 100% !important;
|
371 |
+
}
|
372 |
+
|
373 |
+
/* ----------------------------------------------------------
|
374 |
+
Styles use on Table styles. Helpful to customize Bootstrap Tables behavior.
|
375 |
+
@author Israel Barragan (Reedyseth)
|
376 |
+
@since 01-Apr-2018
|
377 |
+
---------------------------------------------------------- */
|
378 |
+
table.subscribers-table {
|
379 |
+
width: 100% !important;
|
380 |
+
}
|
381 |
+
|
382 |
+
table.subscribers-table thead {
|
383 |
+
background-color: #b3e0f1;
|
384 |
+
}
|
385 |
+
|
386 |
+
table.subscribers-table thead th {
|
387 |
+
line-height: normal;
|
388 |
+
vertical-align: middle;
|
389 |
+
padding: 0.55rem;
|
390 |
+
}
|
391 |
+
|
392 |
+
table.subscribers-table thead th:first-child {
|
393 |
+
width: 15%;
|
394 |
+
text-align: center;
|
395 |
+
}
|
396 |
+
|
397 |
+
table.subscribers-table tbody tr td:first-child {
|
398 |
+
text-align: center;
|
399 |
+
}
|
400 |
+
|
401 |
+
table.subscribers-table thead th i {
|
402 |
+
margin-right: 5px;
|
403 |
+
font-size: 1rem;
|
404 |
+
}
|
405 |
+
|
406 |
+
table.subscribers-table thead th span {
|
407 |
+
vertical-align: text-bottom;
|
408 |
+
font-size: 0.9rem;
|
409 |
+
text-transform: uppercase;
|
410 |
+
}
|
411 |
+
|
412 |
+
@media screen and (max-width: 651px) {
|
413 |
+
table.dataTable.dtr-inline.collapsed > tbody > tr[role=row] > td:first-child,
|
414 |
+
table.dataTable.dtr-inline.collapsed > tbody > tr[role=row] > th:first-child {
|
415 |
+
padding-left: 40px !important;
|
416 |
+
}
|
417 |
+
}
|
418 |
+
@media screen and (max-width: 350px) {
|
419 |
+
table.dataTable.dtr-inline.collapsed > tbody > tr[role=row] > td:first-child,
|
420 |
+
table.dataTable.dtr-inline.collapsed > tbody > tr[role=row] > th:first-child {
|
421 |
+
padding-left: 57px !important;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
/* Override rules from DataTables causing styling issues.*/
|
425 |
+
.dataTables_wrapper .dataTables_paginate .paginate_button {
|
426 |
+
padding: 0 !important;
|
427 |
+
margin-left: 0 !important;
|
428 |
+
border: none !important;
|
429 |
+
border-radius: 0px !important;
|
430 |
+
}
|
431 |
+
|
432 |
+
.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
|
433 |
+
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
|
434 |
+
background: none !important;
|
435 |
+
-webkit-box-shadow: none !important;
|
436 |
+
-moz-box-shadow: none !important;
|
437 |
+
box-shadow: none !important;
|
438 |
+
}
|
439 |
+
|
440 |
+
.system-info-table a {
|
441 |
+
color: #0073aa;
|
442 |
+
}
|
443 |
+
|
444 |
+
/* ----------------------------------------------------------
|
445 |
+
Styles use on form styles. Helpful to customize Bootstrap Buttons behavior.
|
446 |
+
@author Israel Barragan (Reedyseth)
|
447 |
+
@since 01-Apr-2018
|
448 |
+
---------------------------------------------------------- */
|
449 |
+
.btn-primary {
|
450 |
+
color: #fff !important;
|
451 |
+
background-color: #0085ba !important;
|
452 |
+
border-color: #80bbd2 !important;
|
453 |
+
}
|
454 |
+
|
455 |
+
.btn-primary:hover {
|
456 |
+
color: #fff !important;
|
457 |
+
background-color: #4299b9 !important;
|
458 |
+
border-color: #5495ad !important;
|
459 |
+
}
|
460 |
+
|
461 |
+
.btn-third {
|
462 |
+
color: #444 !important;
|
463 |
+
background-color: #ffc63c !important;
|
464 |
+
border-color: #dcb456 !important;
|
465 |
+
}
|
466 |
+
|
467 |
+
.btn-third:hover {
|
468 |
+
color: #444 !important;
|
469 |
+
background-color: #fdd575 !important;
|
470 |
+
border-color: #dcb456 !important;
|
471 |
+
}
|
472 |
+
|
473 |
+
.btn-download {
|
474 |
+
color: #445435;
|
475 |
+
background-color: #7bd774;
|
476 |
+
border-color: #28a745 !important;
|
477 |
+
}
|
478 |
+
|
479 |
+
.btn-download:hover {
|
480 |
+
color: #445435;
|
481 |
+
background-color: #78c771;
|
482 |
+
border-color: #28a745 !important;
|
483 |
+
}
|
484 |
+
|
485 |
+
/* ----------------------------------------------------------
|
486 |
+
Styles use on loading events.
|
487 |
+
@author Israel Barragan (Reedyseth)
|
488 |
+
@since 01-Apr-2018
|
489 |
+
---------------------------------------------------------- */
|
490 |
+
.fa-spinner, .fa-play-circle {
|
491 |
+
color: #ffc53a;
|
492 |
+
-webkit-animation-name: spin;
|
493 |
+
-webkit-animation-duration: 900ms;
|
494 |
+
-webkit-animation-iteration-count: infinite;
|
495 |
+
-webkit-animation-timing-function: cubic-bezier(0.4, 0.62, 0.93, 0.98);
|
496 |
+
-moz-animation-name: spin;
|
497 |
+
-moz-animation-duration: 900ms;
|
498 |
+
-moz-animation-iteration-count: infinite;
|
499 |
+
-moz-animation-timing-function: cubic-bezier(0.4, 0.62, 0.93, 0.98);
|
500 |
+
-ms-animation-name: spin;
|
501 |
+
-ms-animation-duration: 900ms;
|
502 |
+
-ms-animation-iteration-count: infinite;
|
503 |
+
-ms-animation-timing-function: cubic-bezier(0.4, 0.62, 0.93, 0.98);
|
504 |
+
animation-name: spin;
|
505 |
+
animation-duration: 900ms;
|
506 |
+
animation-iteration-count: infinite;
|
507 |
+
animation-timing-function: cubic-bezier(0.4, 0.62, 0.93, 0.98);
|
508 |
+
}
|
509 |
+
|
510 |
+
@-ms-keyframes spin {
|
511 |
+
from {
|
512 |
+
-ms-transform: rotate(0deg);
|
513 |
+
}
|
514 |
+
to {
|
515 |
+
-ms-transform: rotate(360deg);
|
516 |
+
}
|
517 |
+
}
|
518 |
+
@-moz-keyframes spin {
|
519 |
+
from {
|
520 |
+
-moz-transform: rotate(0deg);
|
521 |
+
}
|
522 |
+
to {
|
523 |
+
-moz-transform: rotate(360deg);
|
524 |
+
}
|
525 |
+
}
|
526 |
+
@-webkit-keyframes spin {
|
527 |
+
from {
|
528 |
+
-webkit-transform: rotate(0deg);
|
529 |
+
}
|
530 |
+
to {
|
531 |
+
-webkit-transform: rotate(360deg);
|
532 |
+
}
|
533 |
+
}
|
534 |
+
@keyframes spin {
|
535 |
+
from {
|
536 |
+
transform: rotate(0deg);
|
537 |
+
}
|
538 |
+
to {
|
539 |
+
transform: rotate(360deg);
|
540 |
+
}
|
541 |
+
}
|
options/index.php
CHANGED
@@ -1,27 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
// Avoid direct access to this piece of code
|
3 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
4 |
-
header( 'Location: /' );
|
5 |
-
exit;
|
6 |
-
}
|
7 |
-
global $wp_subscribe_reloaded;
|
8 |
-
global $wp_locale;
|
9 |
-
|
10 |
-
?>
|
11 |
-
|
12 |
-
<link href="<?php echo plugins_url(
|
13 |
-
<link href="<?php echo plugins_url(
|
14 |
-
<style type="text/css">
|
15 |
-
#wpcontent {
|
16 |
-
background: #f1f1f1 !important;
|
17 |
-
padding-left: 0 !important;
|
18 |
-
position: relative;
|
19 |
-
/* WordPress Fonts */
|
20 |
-
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
|
21 |
-
color: #464646 !important;
|
22 |
-
}
|
23 |
-
.navbar a { font-size: 1em !important; font-weight: 600; color: #464646 !important;}
|
24 |
-
</style>
|
25 |
-
|
26 |
-
<script type="text/javascript" src="<?php echo plugins_url(
|
27 |
-
|
1 |
+
<?php
|
2 |
+
// Avoid direct access to this piece of code
|
3 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
4 |
+
header( 'Location: /' );
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
global $wp_subscribe_reloaded;
|
8 |
+
global $wp_locale;
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/bootstrap/dist/css/bootstrap.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
13 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/Font-Awesome/web-fonts-with-css/css/fontawesome-all.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
14 |
+
<style type="text/css">
|
15 |
+
#wpcontent {
|
16 |
+
background: #f1f1f1 !important;
|
17 |
+
padding-left: 0 !important;
|
18 |
+
position: relative;
|
19 |
+
/* WordPress Fonts */
|
20 |
+
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
|
21 |
+
color: #464646 !important;
|
22 |
+
}
|
23 |
+
.navbar a { font-size: 1em !important; font-weight: 600; color: #464646 !important;}
|
24 |
+
</style>
|
25 |
+
|
26 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/bootstrap/dist/js/bootstrap.bundle.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
Â
|
options/options_template.php
CHANGED
@@ -1,112 +1,133 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
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 |
-
|
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 |
-
?>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This is just a template/example file, not used
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Options
|
7 |
+
|
8 |
+
// Avoid direct access to this piece of code
|
9 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
10 |
+
header( 'Location: /' );
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
|
14 |
+
$options = array(
|
15 |
+
'show_subscription_box' => 'yesno',
|
16 |
+
'safely_uninstall' => 'yesno',
|
17 |
+
'purge_days' => 'integer',
|
18 |
+
'date_format' => 'text',
|
19 |
+
'stcr_position' => 'yesno',
|
20 |
+
'enable_double_check' => 'yesno',
|
21 |
+
'notify_authors' => 'yesno',
|
22 |
+
'enable_html_emails' => 'yesno',
|
23 |
+
'process_trackbacks' => 'yesno',
|
24 |
+
'enable_admin_messages' => 'yesno',
|
25 |
+
'admin_subscribe' => 'yesno',
|
26 |
+
'admin_bcc' => 'yesno',
|
27 |
+
'enable_font_awesome' => 'yesno',
|
28 |
+
'delete_options_subscriptions' => 'yesno',
|
29 |
+
'only_for_logged_in' => 'yesno',
|
30 |
+
'use_cookies' => 'yesno',
|
31 |
+
'use_challenge_question' => 'yesno',
|
32 |
+
'challenge_question' => 'text',
|
33 |
+
'challenge_answer' => 'text',
|
34 |
+
'use_captcha' => 'yesno',
|
35 |
+
'captcha_site_key' => 'text',
|
36 |
+
'captcha_secret_key' => 'text',
|
37 |
+
'allow_subscribe_without_comment' => 'yesno',
|
38 |
+
'allow_request_management_link' => 'yesno',
|
39 |
+
'recaptcha_version' => 'select',
|
40 |
+
'blacklisted_emails' => 'textarea',
|
41 |
+
'post_type_supports' => 'multicheck',
|
42 |
+
);
|
43 |
+
|
44 |
+
// Update options
|
45 |
+
if ( isset( $_POST['options'] ) ) {
|
46 |
+
|
47 |
+
if ( empty( $_POST['stcr_action_nonce'] ) ) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( ! wp_verify_nonce( $_POST['stcr_action_nonce'], 'stcr_action_nonce' ) ) {
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$faulty_fields = array();
|
60 |
+
|
61 |
+
foreach ( $_POST['options'] as $option => $value )
|
62 |
+
{
|
63 |
+
// echo $option . '<br>';
|
64 |
+
|
65 |
+
if ( ! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
66 |
+
{
|
67 |
+
array_push( $faulty_fields, $option );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
// Display an alert in the admin interface if something went wrong
|
72 |
+
echo '<div class="updated"><p>';
|
73 |
+
if ( sizeof( $faulty_fields ) == 0 ) {
|
74 |
+
_e( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
75 |
+
} else {
|
76 |
+
_e( 'There was an error updating the options.', 'subscribe-to-comments-reloaded' );
|
77 |
+
// echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
|
78 |
+
}
|
79 |
+
echo "</p></div>";
|
80 |
+
}
|
81 |
+
wp_print_scripts( 'quicktags' );
|
82 |
+
|
83 |
+
?>
|
84 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
85 |
+
|
86 |
+
<div class="container-fluid">
|
87 |
+
<div class="mt-3"></div>
|
88 |
+
<div class="row">
|
89 |
+
<div class="col-sm-9">
|
90 |
+
<form action="" method="post">
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
<div class="form-group row">
|
95 |
+
<div class="col-sm-9 offset-sm-1">
|
96 |
+
<button type="submit" class="btn btn-primary subscribe-form-button" name="Submit">
|
97 |
+
<?php _e( 'Save Changes', 'subscribe-to-comments-reloaded' ) ?>
|
98 |
+
</button>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
<?php wp_nonce_field( 'stcr_action_nonce', 'stcr_action_nonce' ); ?>
|
103 |
+
|
104 |
+
</form>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="col-md-3">
|
108 |
+
<div class="card card-font-size">
|
109 |
+
<div class="card-body">
|
110 |
+
<p>
|
111 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
112 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
113 |
+
</p>
|
114 |
+
<p>
|
115 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
116 |
+
</p>
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
124 |
+
<?php
|
125 |
+
//global $wp_subscribe_reloaded;
|
126 |
+
// Tell WP that we are going to use a resource.
|
127 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-options", "subs_options.js", "includes/js/admin");
|
128 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
129 |
+
//$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-subs-options", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
130 |
+
// Enqueue the JS File
|
131 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-options" );
|
132 |
+
|
133 |
+
?>
|
options/panel1-add-subscription.php
CHANGED
@@ -28,5 +28,8 @@ echo ' <strong>' . get_the_title( intval( $_GET['srp'] ) ) . " (" . intval( $_GE
|
|
28 |
Â
<input type='hidden' name='sra' value='add' />
|
29 |
Â
<input type='hidden' name='srp' value='<?php echo intval( $_GET['srp'] ) ?>' />
|
30 |
Â
</fieldset>
|
Â
|
|
Â
|
|
Â
|
|
31 |
Â
</form>
|
32 |
Â
</div>
|
28 |
Â
<input type='hidden' name='sra' value='add' />
|
29 |
Â
<input type='hidden' name='srp' value='<?php echo intval( $_GET['srp'] ) ?>' />
|
30 |
Â
</fieldset>
|
31 |
+
|
32 |
+
<?php wp_nonce_field( 'stcr_add_subscription_nonce', 'stcr_add_subscription_nonce' ); ?>
|
33 |
+
|
34 |
Â
</form>
|
35 |
Â
</div>
|
options/panel1-business-logic.php
CHANGED
@@ -17,6 +17,19 @@ $status = sanitize_text_field( trim( $status ) );
|
|
17 |
Â
|
18 |
Â
switch ( $action ) {
|
19 |
Â
case 'add':
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
20 |
Â
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
|
21 |
Â
$valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
|
22 |
Â
|
@@ -41,6 +54,19 @@ switch ( $action ) {
|
|
41 |
Â
break;
|
42 |
Â
|
43 |
Â
case 'edit':
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
44 |
Â
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
|
45 |
Â
$stcr_old_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_old_post_email );
|
46 |
Â
$valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
|
@@ -66,6 +92,19 @@ switch ( $action ) {
|
|
66 |
Â
break;
|
67 |
Â
|
68 |
Â
case 'delete-subscription':
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
|
70 |
Â
$valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
|
71 |
Â
|
@@ -82,6 +121,19 @@ switch ( $action ) {
|
|
82 |
Â
|
83 |
Â
default:
|
84 |
Â
if ( ! empty( $_POST['subscriptions_list'] ) ) {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
85 |
Â
$post_list = $email_list = array();
|
86 |
Â
foreach ( $_POST['subscriptions_list'] as $a_subscription ) {
|
87 |
Â
list( $a_post, $a_email ) = explode( ',', $a_subscription );
|
17 |
Â
|
18 |
Â
switch ( $action ) {
|
19 |
Â
case 'add':
|
20 |
+
|
21 |
+
if ( empty( $_POST['stcr_add_subscription_nonce'] ) ) {
|
22 |
+
exit();
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! wp_verify_nonce( $_POST['stcr_add_subscription_nonce'], 'stcr_add_subscription_nonce' ) ) {
|
26 |
+
exit();
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
30 |
+
exit();
|
31 |
+
}
|
32 |
+
|
33 |
Â
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
|
34 |
Â
$valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
|
35 |
Â
|
54 |
Â
break;
|
55 |
Â
|
56 |
Â
case 'edit':
|
57 |
+
|
58 |
+
if ( empty( $_POST['stcr_edit_subscription_nonce'] ) ) {
|
59 |
+
exit();
|
60 |
+
}
|
61 |
+
|
62 |
+
if ( ! wp_verify_nonce( $_POST['stcr_edit_subscription_nonce'], 'stcr_edit_subscription_nonce' ) ) {
|
63 |
+
exit();
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
67 |
+
exit();
|
68 |
+
}
|
69 |
+
|
70 |
Â
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
|
71 |
Â
$stcr_old_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_old_post_email );
|
72 |
Â
$valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
|
92 |
Â
break;
|
93 |
Â
|
94 |
Â
case 'delete-subscription':
|
95 |
+
|
96 |
+
if ( empty( $_GET['stcr_delete_subscription_nonce'] ) ) {
|
97 |
+
exit();
|
98 |
+
}
|
99 |
+
|
100 |
+
if ( ! wp_verify_nonce( $_GET['stcr_delete_subscription_nonce'], 'stcr_delete_subscription_nonce' ) ) {
|
101 |
+
exit();
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
105 |
+
exit();
|
106 |
+
}
|
107 |
+
|
108 |
Â
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
|
109 |
Â
$valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
|
110 |
Â
|
121 |
Â
|
122 |
Â
default:
|
123 |
Â
if ( ! empty( $_POST['subscriptions_list'] ) ) {
|
124 |
+
|
125 |
+
if ( empty( $_POST['stcr_update_subscriptions_nonce'] ) ) {
|
126 |
+
exit();
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( ! wp_verify_nonce( $_POST['stcr_update_subscriptions_nonce'], 'stcr_update_subscriptions_nonce' ) ) {
|
130 |
+
exit();
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
134 |
+
exit();
|
135 |
+
}
|
136 |
+
|
137 |
Â
$post_list = $email_list = array();
|
138 |
Â
foreach ( $_POST['subscriptions_list'] as $a_subscription ) {
|
139 |
Â
list( $a_post, $a_email ) = explode( ',', $a_subscription );
|
options/panel1-edit-subscription.php
CHANGED
@@ -34,6 +34,7 @@ echo ' <strong>' . get_the_title( intval( $_GET['srp'] ) ) . " (" . intval( $_GE
|
|
34 |
Â
</p>
|
35 |
Â
<input type='hidden' name='sra' value='edit' />
|
36 |
Â
<input type='hidden' name='srp' value='<?php echo intval( $_GET['srp'] ) ?>' />
|
Â
|
|
37 |
Â
</fieldset>
|
38 |
Â
</form>
|
39 |
Â
</div>
|
34 |
Â
</p>
|
35 |
Â
<input type='hidden' name='sra' value='edit' />
|
36 |
Â
<input type='hidden' name='srp' value='<?php echo intval( $_GET['srp'] ) ?>' />
|
37 |
+
<?php wp_nonce_field( 'stcr_edit_subscription_nonce', 'stcr_edit_subscription_nonce' ); ?>
|
38 |
Â
</fieldset>
|
39 |
Â
</form>
|
40 |
Â
</div>
|
options/stcr_comment_form.php
CHANGED
@@ -1,373 +1,388 @@
|
|
1 |
-
<?php
|
2 |
-
// Comment Form
|
3 |
-
//
|
4 |
-
// Avoid direct access to this piece of code
|
5 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
-
header( 'Location: /' );
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
$options = array(
|
11 |
-
"show_subscription_box" => "yesno",
|
12 |
-
"checked_by_default" => "yesno",
|
13 |
-
"checked_by_default_value" => "integer",
|
14 |
-
"enable_advanced_subscriptions" => "yesno",
|
15 |
-
"default_subscription_type" => "integer",
|
16 |
-
"checkbox_inline_style" => "text-html",
|
17 |
-
"checkbox_html" => "text-html",
|
18 |
-
"checkbox_label" => "text-html",
|
19 |
-
"subscribed_label" => "text-html",
|
20 |
-
"subscribed_waiting_label" => "text-html",
|
21 |
-
"author_label" => "text-html"
|
22 |
-
);
|
23 |
-
|
24 |
-
// Update options
|
25 |
-
if ( isset( $_POST['options'] ) ) {
|
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 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
<div class="
|
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 |
-
<div class="
|
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 |
-
<div class="helpDescription subsOptDescriptions"
|
202 |
-
data-content="<?php _e( 'Custom
|
203 |
-
data-placement="right"
|
204 |
-
aria-label="<?php _e( 'Custom
|
205 |
-
<i class="fas fa-question-circle"></i>
|
206 |
-
</div>
|
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 |
-
|
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 |
-
<div class="
|
349 |
-
<
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
<
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
// Comment Form
|
3 |
+
//
|
4 |
+
// Avoid direct access to this piece of code
|
5 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
+
header( 'Location: /' );
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
$options = array(
|
11 |
+
"show_subscription_box" => "yesno",
|
12 |
+
"checked_by_default" => "yesno",
|
13 |
+
"checked_by_default_value" => "integer",
|
14 |
+
"enable_advanced_subscriptions" => "yesno",
|
15 |
+
"default_subscription_type" => "integer",
|
16 |
+
"checkbox_inline_style" => "text-html",
|
17 |
+
"checkbox_html" => "text-html",
|
18 |
+
"checkbox_label" => "text-html",
|
19 |
+
"subscribed_label" => "text-html",
|
20 |
+
"subscribed_waiting_label" => "text-html",
|
21 |
+
"author_label" => "text-html"
|
22 |
+
);
|
23 |
+
|
24 |
+
// Update options
|
25 |
+
if ( isset( $_POST['options'] ) ) {
|
26 |
+
|
27 |
+
if ( empty( $_POST['stcr_save_comment_form_nonce'] ) ) {
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_comment_form_nonce'], 'stcr_save_comment_form_nonce' ) ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
$faulty_fields = array();
|
40 |
+
|
41 |
+
foreach ( $_POST['options'] as $option => $value )
|
42 |
+
{
|
43 |
+
|
44 |
+
if ( ! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
45 |
+
{
|
46 |
+
array_push( $faulty_fields, $option );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
// Display an alert in the admin interface if something went wrong
|
51 |
+
echo '<div class="updated"><p>';
|
52 |
+
if ( sizeof( $faulty_fields ) == 0 ) {
|
53 |
+
_e( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
54 |
+
} else {
|
55 |
+
_e( 'There was an error updating the following fields:', 'subscribe-to-comments-reloaded' );
|
56 |
+
// echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
|
57 |
+
}
|
58 |
+
echo "</p></div>";
|
59 |
+
}
|
60 |
+
?>
|
61 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
62 |
+
|
63 |
+
<div class="container-fluid">
|
64 |
+
<div class="mt-3"></div>
|
65 |
+
<div class="row">
|
66 |
+
<div class="col-sm-9">
|
67 |
+
<form action="" method="post">
|
68 |
+
<div class="form-group row">
|
69 |
+
<label for="show_subscription_box" class="col-sm-3 col-form-label text-right"><?php _e( 'Enable default checkbox', 'subscribe-to-comments-reloaded' ) ?></label>
|
70 |
+
<div class="col-sm-7">
|
71 |
+
<div class="switch">
|
72 |
+
<input type="radio" class="switch-input" name="options[show_subscription_box]"
|
73 |
+
value="yes" id="show_subscription_box-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'show_subscription_box' ) == 'yes' ) ? ' checked' : ''; ?> />
|
74 |
+
<label for="show_subscription_box-yes" class="switch-label switch-label-off">
|
75 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
76 |
+
</label>
|
77 |
+
<input type="radio" class="switch-input" name="options[show_subscription_box]" value="no" id="show_subscription_box-no"
|
78 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'show_subscription_box' ) == 'no' ) ? ' checked' : ''; ?> />
|
79 |
+
<label for="show_subscription_box-no" class="switch-label switch-label-on">
|
80 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
81 |
+
</label>
|
82 |
+
<span class="switch-selection"></span>
|
83 |
+
</div>
|
84 |
+
<div class="helpDescription subsOptDescriptions"
|
85 |
+
data-content="<?php _e( 'Disable this option if you want to move the subscription checkbox to a different place on your page.', 'subscribe-to-comments-reloaded' ); ?>"
|
86 |
+
data-placement="right"
|
87 |
+
aria-label="<?php _e( 'Disable this option if you want to move the subscription checkbox to a different place on your page.', 'subscribe-to-comments-reloaded' ); ?>">
|
88 |
+
<i class="fas fa-question-circle"></i>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<div class="form-group row">
|
94 |
+
<label for="checked_by_default" class="col-sm-3 col-form-label text-right"><?php _e( 'Checked by default', 'subscribe-to-comments-reloaded' ) ?></label>
|
95 |
+
<div class="col-sm-7">
|
96 |
+
<div class="switch">
|
97 |
+
<input type="radio" class="switch-input" name="options[checked_by_default]"
|
98 |
+
value="yes" id="checked_by_default-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'checked_by_default' ) == 'yes' ) ? ' checked' : ''; ?> />
|
99 |
+
<label for="checked_by_default-yes" class="switch-label switch-label-off">
|
100 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
101 |
+
</label>
|
102 |
+
<input type="radio" class="switch-input" name="options[checked_by_default]" value="no" id="checked_by_default-no"
|
103 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'checked_by_default' ) == 'no' ) ? ' checked' : ''; ?> />
|
104 |
+
<label for="checked_by_default-no" class="switch-label switch-label-on">
|
105 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
106 |
+
</label>
|
107 |
+
<span class="switch-selection"></span>
|
108 |
+
</div>
|
109 |
+
<div class="helpDescription subsOptDescriptions"
|
110 |
+
data-content="<?php _e( 'Decide if the checkbox should be checked by default or not.', 'subscribe-to-comments-reloaded' ); ?>"
|
111 |
+
data-placement="right"
|
112 |
+
aria-label="<?php _e( 'Decide if the checkbox should be checked by default or not.', 'subscribe-to-comments-reloaded' ); ?>">
|
113 |
+
<i class="fas fa-question-circle"></i>
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
<?php
|
118 |
+
// This option will be visible only when the Checkbox option is enable
|
119 |
+
if ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_advanced_subscriptions' ) == 'no' ) :
|
120 |
+
?>
|
121 |
+
<div class="form-group row">
|
122 |
+
<label for="checked_by_default_value" class="col-sm-3 col-form-label text-right"><?php _e( 'Subscription type', 'subscribe-to-comments-reloaded' ) ?></label>
|
123 |
+
<div class="col-sm-7">
|
124 |
+
<select name="options[checked_by_default_value]" id="checked_by_default_value" class="form-control form-control-select">
|
125 |
+
<option value="0" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'checked_by_default_value' ) === '0' ) ? "selected='selected'" : ''; ?>><?php _e( 'All new comments', 'subscribe-to-comments-reloaded' ); ?></option>
|
126 |
+
<option value="1" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'checked_by_default_value' ) === '1' ) ? "selected='selected'" : ''; ?>><?php _e( 'Replies to this comment', 'subscribe-to-comments-reloaded' ); ?></option>
|
127 |
+
</select>
|
128 |
+
<div class="helpDescription subsOptDescriptions"
|
129 |
+
data-content="<?php _e( 'Select the type of subscription.', 'subscribe-to-comments-reloaded' ); ?>"
|
130 |
+
data-placement="right"
|
131 |
+
aria-label="<?php _e( 'Select the type of subscription.', 'subscribe-to-comments-reloaded' ); ?>">
|
132 |
+
<i class="fas fa-question-circle"></i>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
<?php
|
137 |
+
else :
|
138 |
+
echo "<input type='hidden' name='options[checked_by_default_value]' value = '0'>";
|
139 |
+
endif; ?>
|
140 |
+
|
141 |
+
<div class="form-group row">
|
142 |
+
<label for="enable_advanced_subscriptions" class="col-sm-3 col-form-label text-right">
|
143 |
+
<?php _e( 'Advanced subscription', 'subscribe-to-comments-reloaded' ) ?></label>
|
144 |
+
<div class="col-sm-7">
|
145 |
+
<div class="switch">
|
146 |
+
<input type="radio" class="switch-input" name="options[enable_advanced_subscriptions]"
|
147 |
+
value="yes" id="enable_advanced_subscriptions-yes"
|
148 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_advanced_subscriptions' ) == 'yes' ) ? ' checked' : ''; ?> />
|
149 |
+
<label for="enable_advanced_subscriptions-yes" class="switch-label switch-label-off">
|
150 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
151 |
+
</label>
|
152 |
+
<input type="radio" class="switch-input" name="options[enable_advanced_subscriptions]" value="no" id="enable_advanced_subscriptions-no"
|
153 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_advanced_subscriptions' ) == 'no' ) ? ' checked' : ''; ?> />
|
154 |
+
<label for="enable_advanced_subscriptions-no" class="switch-label switch-label-on">
|
155 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
156 |
+
</label>
|
157 |
+
<span class="switch-selection"></span>
|
158 |
+
</div>
|
159 |
+
<div class="helpDescription subsOptDescriptions"
|
160 |
+
data-content="<?php _e( 'Allow users to choose from different subscription types (all, replies only).', 'subscribe-to-comments-reloaded' ); ?>"
|
161 |
+
data-placement="right"
|
162 |
+
aria-label="<?php _e( 'Allow users to choose from different subscription types (all, replies only).', 'subscribe-to-comments-reloaded' ); ?>">
|
163 |
+
<i class="fas fa-question-circle"></i>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
|
168 |
+
<?php
|
169 |
+
// Make sure that the default subscription type is visible only when advance subscriptions are set to yes.
|
170 |
+
if ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_advanced_subscriptions' ) == 'yes' ): ?>
|
171 |
+
<div class="form-group row">
|
172 |
+
<label for="default_subscription_type" class="col-sm-3 col-form-label text-right">
|
173 |
+
<?php _e( 'Advanced default', 'subscribe-to-comments-reloaded' ) ?></label>
|
174 |
+
<div class="col-sm-7">
|
175 |
+
<select name="options[default_subscription_type]" id="default_subscription_type" class="form-control form-control-select">
|
176 |
+
<option value="0" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'default_subscription_type' ) === '0' ) ? "selected='selected'" : ''; ?>><?php _e( 'None', 'subscribe-to-comments-reloaded' ); ?></option>
|
177 |
+
<option value="1" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'default_subscription_type' ) === '1' ) ? "selected='selected'" : ''; ?>><?php _e( 'All new comments', 'subscribe-to-comments-reloaded' ); ?></option>
|
178 |
+
<option value="2" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'default_subscription_type' ) === '2' ) ? "selected='selected'" : ''; ?>><?php _e( 'Replies to this comment', 'subscribe-to-comments-reloaded' ); ?></option>
|
179 |
+
</select>
|
180 |
+
<div class="helpDescription subsOptDescriptions"
|
181 |
+
data-content="<?php _e( 'The default subscription type that should be selected when Advanced subscriptions are enable.', 'subscribe-to-comments-reloaded' ); ?>"
|
182 |
+
data-placement="right"
|
183 |
+
aria-label="<?php _e( 'The default subscription type that should be selected when Advanced subscriptions are enable.', 'subscribe-to-comments-reloaded' ); ?>">
|
184 |
+
<i class="fas fa-question-circle"></i>
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
</div>
|
188 |
+
<?php
|
189 |
+
else :
|
190 |
+
echo "<input type='hidden' name='options[default_subscription_type]' value = '0'>";
|
191 |
+
endif; ?>
|
192 |
+
|
193 |
+
<div class="form-group row">
|
194 |
+
<label for="checkbox_inline_style" class="col-sm-3 col-form-label text-right">
|
195 |
+
<?php _e( 'Custom inline style', 'subscribe-to-comments-reloaded' ) ?></label>
|
196 |
+
<div class="col-sm-7">
|
197 |
+
<input type="text" name="options[checkbox_inline_style]" id="checkbox_inline_style"
|
198 |
+
class="form-control form-control-input-8"
|
199 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'checkbox_inline_style' ) ); ?>" size="20">
|
200 |
+
|
201 |
+
<div class="helpDescription subsOptDescriptions"
|
202 |
+
data-content="<?php _e( 'Custom inline CSS to add to the checkbox.', 'subscribe-to-comments-reloaded' ); ?>"
|
203 |
+
data-placement="right"
|
204 |
+
aria-label="<?php _e( 'Custom inline CSS to add to the checkbox.', 'subscribe-to-comments-reloaded' ); ?>">
|
205 |
+
<i class="fas fa-question-circle"></i>
|
206 |
+
</div>
|
207 |
+
</div>
|
208 |
+
</div>
|
209 |
+
|
210 |
+
<div class="form-group row">
|
211 |
+
<label for="checkbox_html" class="col-sm-3 offset-sm-1 col-form-label">
|
212 |
+
<?php _e( 'Custom HTML', 'subscribe-to-comments-reloaded' ) ?>
|
213 |
+
|
214 |
+
<div class="helpDescription subsOptDescriptions"
|
215 |
+
data-content="<?php _e( 'Custom HTML code to be used when displaying the checkbox. Allowed tags: [checkbox_field], [checkbox_label]', 'subscribe-to-comments-reloaded' ); ?>"
|
216 |
+
data-placement="right"
|
217 |
+
aria-label="<?php _e( 'Custom HTML code to be used when displaying the checkbox. Allowed tags: [checkbox_field], [checkbox_label]', 'subscribe-to-comments-reloaded' ); ?>">
|
218 |
+
<i class="fas fa-question-circle"></i>
|
219 |
+
</div>
|
220 |
+
|
221 |
+
</label>
|
222 |
+
<div class="clearfix"></div>
|
223 |
+
<div class="col-sm-9 offset-sm-1">
|
224 |
+
<?php
|
225 |
+
$id_checkbox_html = "checkbox_html";
|
226 |
+
$args_notificationContent = array(
|
227 |
+
"media_buttons" => false,
|
228 |
+
"textarea_rows" => 5,
|
229 |
+
"teeny" => true,
|
230 |
+
"textarea_name" => "options[{$id_checkbox_html}]",
|
231 |
+
"tinymce" => false
|
232 |
+
);
|
233 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_checkbox_html ), $id_checkbox_html, $args_notificationContent );
|
234 |
+
?>
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
|
238 |
+
<h3><?php _e( 'Messages for your visitors', 'subscribe-to-comments-reloaded' ) ?></h3>
|
239 |
+
|
240 |
+
<div class="form-group row">
|
241 |
+
<label for="checkbox_label" class="col-sm-3 offset-sm-1 col-form-label" style="z-index: 9999;">
|
242 |
+
<?php _e( 'Default label', 'subscribe-to-comments-reloaded' ) ?>
|
243 |
+
|
244 |
+
<div class="helpDescription subsOptDescriptions"
|
245 |
+
data-content="<?php _e( 'Label associated to the checkbox. Allowed tag: [subscribe_link]', 'subscribe-to-comments-reloaded' ); ?>"
|
246 |
+
data-placement="right"
|
247 |
+
aria-label="<?php _e( 'Label associated to the checkbox. Allowed tag: [subscribe_link]', 'subscribe-to-comments-reloaded' ); ?>">
|
248 |
+
<i class="fas fa-question-circle"></i>
|
249 |
+
</div>
|
250 |
+
|
251 |
+
</label>
|
252 |
+
<div class="clearfix"></div>
|
253 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
254 |
+
<?php
|
255 |
+
$id_checkbox_label = "checkbox_label";
|
256 |
+
$args_notificationContent = array(
|
257 |
+
"media_buttons" => false,
|
258 |
+
"textarea_rows" => 3,
|
259 |
+
"teeny" => true,
|
260 |
+
"textarea_name" => "options[{$id_checkbox_label}]"
|
261 |
+
);
|
262 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_checkbox_label ), $id_checkbox_label, $args_notificationContent );
|
263 |
+
?>
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
|
267 |
+
<div class="form-group row">
|
268 |
+
<label for="subscribed_label" class="col-sm-3 offset-sm-1 col-form-label" style="z-index: 9999;">
|
269 |
+
<?php _e( 'Subscribed label', 'subscribe-to-comments-reloaded' ) ?>
|
270 |
+
|
271 |
+
<div class="helpDescription subsOptDescriptions"
|
272 |
+
data-content="<?php _e( 'Label shown to those who are already subscribed to a post. Allowed tag: [manager_link]', 'subscribe-to-comments-reloaded' ); ?>"
|
273 |
+
data-placement="right"
|
274 |
+
aria-label="<?php _e( 'Label shown to those who are already subscribed to a post. Allowed tag: [manager_link]', 'subscribe-to-comments-reloaded' ); ?>">
|
275 |
+
<i class="fas fa-question-circle"></i>
|
276 |
+
</div>
|
277 |
+
|
278 |
+
</label>
|
279 |
+
<div class="clearfix"></div>
|
280 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
281 |
+
<?php
|
282 |
+
$id_subscribed_label = "subscribed_label";
|
283 |
+
$args_notificationContent = array(
|
284 |
+
"media_buttons" => false,
|
285 |
+
"textarea_rows" => 3,
|
286 |
+
"teeny" => true,
|
287 |
+
"textarea_name" => "options[{$id_subscribed_label}]"
|
288 |
+
);
|
289 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_subscribed_label ), $id_subscribed_label, $args_notificationContent );
|
290 |
+
?>
|
291 |
+
</div>
|
292 |
+
</div>
|
293 |
+
|
294 |
+
<div class="form-group row">
|
295 |
+
<label for="subscribed_waiting_label" class="col-sm-3 offset-sm-1 col-form-label" style="z-index: 9999;">
|
296 |
+
<?php _e( 'Pending label', 'subscribe-to-comments-reloaded' ) ?>
|
297 |
+
|
298 |
+
<div class="helpDescription subsOptDescriptions"
|
299 |
+
data-content="<?php _e( "Label shown to those who are already subscribed, but haven't clicked on the confirmation link yet. Allowed tag: [manager_link]", 'subscribe-to-comments-reloaded' ); ?>"
|
300 |
+
data-placement="right"
|
301 |
+
aria-label="<?php _e( "Label shown to those who are already subscribed, but haven't clicked on the confirmation link yet. Allowed tag: [manager_link]", 'subscribe-to-comments-reloaded' ); ?>">
|
302 |
+
<i class="fas fa-question-circle"></i>
|
303 |
+
</div>
|
304 |
+
|
305 |
+
</label>
|
306 |
+
<div class="clearfix"></div>
|
307 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
308 |
+
<?php
|
309 |
+
$id_subscribed_waiting_label = "subscribed_waiting_label";
|
310 |
+
$args_notificationContent = array(
|
311 |
+
"media_buttons" => false,
|
312 |
+
"textarea_rows" => 3,
|
313 |
+
"teeny" => true,
|
314 |
+
"textarea_name" => "options[{$id_subscribed_waiting_label}]"
|
315 |
+
);
|
316 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_subscribed_waiting_label ), $id_subscribed_waiting_label, $args_notificationContent );
|
317 |
+
?>
|
318 |
+
</div>
|
319 |
+
</div>
|
320 |
+
|
321 |
+
<div class="form-group row">
|
322 |
+
<label for="author_label" class="col-sm-3 offset-sm-1 col-form-label" style="z-index: 9999;">
|
323 |
+
<?php _e( 'Author label', 'subscribe-to-comments-reloaded' ) ?>
|
324 |
+
|
325 |
+
<div class="helpDescription subsOptDescriptions"
|
326 |
+
data-content="<?php _e( "Label shown to authors (and administrators). Allowed tag: [manager_link]", 'subscribe-to-comments-reloaded' ); ?>"
|
327 |
+
data-placement="right"
|
328 |
+
aria-label="<?php _e( "Label shown to authors (and administrators). Allowed tag: [manager_link]", 'subscribe-to-comments-reloaded' ); ?>">
|
329 |
+
<i class="fas fa-question-circle"></i>
|
330 |
+
</div>
|
331 |
+
|
332 |
+
</label>
|
333 |
+
<div class="clearfix"></div>
|
334 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
335 |
+
<?php
|
336 |
+
$id_author_label = "author_label";
|
337 |
+
$args_notificationContent = array(
|
338 |
+
"media_buttons" => false,
|
339 |
+
"textarea_rows" => 3,
|
340 |
+
"teeny" => true,
|
341 |
+
"textarea_name" => "options[{$id_author_label}]"
|
342 |
+
);
|
343 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_author_label ), $id_author_label, $args_notificationContent );
|
344 |
+
?>
|
345 |
+
</div>
|
346 |
+
</div>
|
347 |
+
|
348 |
+
<div class="form-group row">
|
349 |
+
<div class="col-sm-9 offset-sm-1">
|
350 |
+
<button type="submit" class="btn btn-primary subscribe-form-button" name="Submit">
|
351 |
+
<?php _e( 'Save Changes', 'subscribe-to-comments-reloaded' ) ?>
|
352 |
+
</button>
|
353 |
+
</div>
|
354 |
+
</div>
|
355 |
+
|
356 |
+
<?php wp_nonce_field( 'stcr_save_comment_form_nonce', 'stcr_save_comment_form_nonce' ); ?>
|
357 |
+
|
358 |
+
</form>
|
359 |
+
</div>
|
360 |
+
|
361 |
+
<div class="col-md-3">
|
362 |
+
<div class="card card-font-size">
|
363 |
+
<div class="card-body">
|
364 |
+
<p>
|
365 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
366 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
367 |
+
</p>
|
368 |
+
<p>
|
369 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
370 |
+
</p>
|
371 |
+
</div>
|
372 |
+
</div>
|
373 |
+
</div>
|
374 |
+
|
375 |
+
</div>
|
376 |
+
</div>
|
377 |
+
|
378 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
379 |
+
<?php
|
380 |
+
global $wp_subscribe_reloaded;
|
381 |
+
// Tell WP that we are going to use a resource.
|
382 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-options", "subs_options.js", "includes/js/admin");
|
383 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
384 |
+
//$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-subs-options", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
385 |
+
// Enqueue the JS File
|
386 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-options" );
|
387 |
+
|
388 |
+
?>
|
options/stcr_manage_subscriptions.php
CHANGED
@@ -1,354 +1,360 @@
|
|
1 |
-
<?php
|
2 |
-
// Avoid direct access to this piece of code
|
3 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
4 |
-
header( 'Location: /' );
|
5 |
-
exit;
|
6 |
-
}
|
7 |
-
|
8 |
-
$action = esc_attr( ! empty( $_POST['sra'] ) ? $_POST['sra'] : ( ! empty( $_GET['sra'] ) ? $_GET['sra'] : '' ) );
|
9 |
-
if ( $action == 'edit-subscription' || $action == 'add-subscription' ) {
|
10 |
-
require_once
|
11 |
-
|
12 |
-
return;
|
13 |
-
}
|
14 |
-
if ( is_readable(
|
15 |
-
|
16 |
-
require_once
|
17 |
-
|
18 |
-
// Display an alert in the admin interface if the email is wrong or the post id is not a number.
|
19 |
-
if ( ! $valid_email )
|
20 |
-
{
|
21 |
-
echo '<div class="notice notice-error is-dismissible"><p>';
|
22 |
-
_e( 'The email that you typed is not correct.', 'subscribe-to-comments-reloaded' );
|
23 |
-
echo "</p></div>";
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( ! $valid_post_id )
|
27 |
-
{
|
28 |
-
echo '<div class="notice notice-error is-dismissible"><p>';
|
29 |
-
_e( 'Please enter a valid Post ID.', 'subscribe-to-comments-reloaded' );
|
30 |
-
echo "</p></div>";
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
?>
|
35 |
-
<style type="text/css">
|
36 |
-
|
37 |
-
</style>
|
38 |
-
|
39 |
-
<link href="<?php echo plugins_url(
|
40 |
-
<link href="<?php echo plugins_url(
|
41 |
-
<link href="<?php echo plugins_url(
|
42 |
-
|
43 |
-
<div class="container-fluid">
|
44 |
-
|
45 |
-
<div class="row mx-auto">
|
46 |
-
<div class="col-sm-6">
|
47 |
-
<div class="card card-font-size mass-update-subs">
|
48 |
-
<h6 class="card-header">
|
49 |
-
<i class="fas fa-exchange-alt"></i> <?php _e( 'Mass Update Subscriptions', 'subscribe-to-comments-reloaded' ) ?>
|
50 |
-
<i class="fas fa-caret-down pull-right"></i>
|
51 |
-
</h6>
|
52 |
-
<div class="card-body cbody-mass" style="padding: 0;">
|
53 |
-
<div class="card-text stcr-hidden">
|
54 |
-
<form action="" method="post" id="mass_update_address_form">
|
55 |
-
|
56 |
-
<table>
|
57 |
-
<tr>
|
58 |
-
<td><label for='oldsre'><?php _e( 'From', 'subscribe-to-comments-reloaded' ) ?></label></td>
|
59 |
-
<td><input class="form-control form-controls-font" type='text' size='30' name='oldsre' id='oldsre' value='<?php esc_attr_e( 'email address', 'subscribe-to-comments-reloaded' ) ?>' style="color:#ccc;"></td>
|
60 |
-
<td><span class="validate-error-text validate-error-text-oldsre stcr-hidden "></span></td>
|
61 |
-
</tr>
|
62 |
-
<tr>
|
63 |
-
<td><label for='sre'><?php _e( 'To', 'subscribe-to-comments-reloaded' ) ?></label></td>
|
64 |
-
<td><input class="form-control form-controls-font" type='text' size='30' name='sre' id='sre' value='<?php esc_attr_e( 'optional - new email address', 'subscribe-to-comments-reloaded' ) ?>' style="color:#ccc;"
|
65 |
-
>
|
66 |
-
</td>
|
67 |
-
<td><span class="validate-error-text validate-error-text-sre stcr-hidden "></span></td>
|
68 |
-
</tr>
|
69 |
-
<tr>
|
70 |
-
<td><label for='srs'><?php _e( 'Status', 'subscribe-to-comments-reloaded' ) ?></label></td>
|
71 |
-
<td><select class="form-control form-controls-font mass-update-select-status" name="srs" id="srs">
|
72 |
-
<option value=''><?php _e( 'Keep unchanged', 'subscribe-to-comments-reloaded' ) ?></option>
|
73 |
-
<option value='Y'><?php _e( 'Active', 'subscribe-to-comments-reloaded' ) ?></option>
|
74 |
-
<option value='R'><?php _e( 'Replies only', 'subscribe-to-comments-reloaded' ) ?></option>
|
75 |
-
<option value='C'><?php _e( 'Suspended', 'subscribe-to-comments-reloaded' ) ?></option>
|
76 |
-
</select>
|
77 |
-
<input type='submit' style="font-size: 0.8rem;" class='subscribe-form-button btn btn-primary' value='<?php esc_attr_e( 'Update', 'subscribe-to-comments-reloaded' ) ?>' ></td>
|
78 |
-
</tr>
|
79 |
-
<tr>
|
80 |
-
<td colspan="2">
|
81 |
-
<div class="more-info" data-infopanel="info-panel-mass-update" aria-label="<?php _e("More info", 'subscribe-to-comments-reloaded'); ?>">
|
82 |
-
<i class="fas fa-question-circle"></i>
|
83 |
-
</div>
|
84 |
-
</td>
|
85 |
-
|
86 |
-
</tr>
|
87 |
-
<tr>
|
88 |
-
<td colspan="2"><input type='hidden' name='sra' value='edit' /></td>
|
89 |
-
</tr>
|
90 |
-
</table>
|
91 |
-
|
92 |
-
<div class="alert alert-info hidden info-panel-mass-update" role="alert">
|
93 |
-
<?php _e('This option will allow you to change an email address for another one or to update the same status for all the subscription on a specific email address.', 'subscribe-to-comments-reloaded' ); ?>
|
94 |
-
</div>
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
<td
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
<td
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
<option value='
|
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 |
-
<th scope=\"col\"><i class=\"fas fa-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<th scope=\"col\"><i class=\"fas fa-
|
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 |
-
<td
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
<td>
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
<td
|
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 |
-
|
354 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
// Avoid direct access to this piece of code
|
3 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
4 |
+
header( 'Location: /' );
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
$action = esc_attr( ! empty( $_POST['sra'] ) ? $_POST['sra'] : ( ! empty( $_GET['sra'] ) ? $_GET['sra'] : '' ) );
|
9 |
+
if ( $action == 'edit-subscription' || $action == 'add-subscription' ) {
|
10 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/panel1-' . $action . '.php';
|
11 |
+
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/panel1-business-logic.php' ) ) {
|
15 |
+
|
16 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/panel1-business-logic.php';
|
17 |
+
|
18 |
+
// Display an alert in the admin interface if the email is wrong or the post id is not a number.
|
19 |
+
if ( ! $valid_email )
|
20 |
+
{
|
21 |
+
echo '<div class="notice notice-error is-dismissible"><p>';
|
22 |
+
_e( 'The email that you typed is not correct.', 'subscribe-to-comments-reloaded' );
|
23 |
+
echo "</p></div>";
|
24 |
+
}
|
25 |
+
|
26 |
+
if ( ! $valid_post_id )
|
27 |
+
{
|
28 |
+
echo '<div class="notice notice-error is-dismissible"><p>';
|
29 |
+
_e( 'Please enter a valid Post ID.', 'subscribe-to-comments-reloaded' );
|
30 |
+
echo "</p></div>";
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
?>
|
35 |
+
<style type="text/css">
|
36 |
+
|
37 |
+
</style>
|
38 |
+
|
39 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/datatables/media/css/jquery.dataTables.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
40 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/datatables/media/css/dataTables.bootstrap4.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
41 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
42 |
+
|
43 |
+
<div class="container-fluid">
|
44 |
+
|
45 |
+
<div class="row mx-auto">
|
46 |
+
<div class="col-sm-6">
|
47 |
+
<div class="card card-font-size mass-update-subs">
|
48 |
+
<h6 class="card-header">
|
49 |
+
<i class="fas fa-exchange-alt"></i> <?php _e( 'Mass Update Subscriptions', 'subscribe-to-comments-reloaded' ) ?>
|
50 |
+
<i class="fas fa-caret-down pull-right"></i>
|
51 |
+
</h6>
|
52 |
+
<div class="card-body cbody-mass" style="padding: 0;">
|
53 |
+
<div class="card-text stcr-hidden">
|
54 |
+
<form action="" method="post" id="mass_update_address_form">
|
55 |
+
|
56 |
+
<table>
|
57 |
+
<tr>
|
58 |
+
<td><label for='oldsre'><?php _e( 'From', 'subscribe-to-comments-reloaded' ) ?></label></td>
|
59 |
+
<td><input class="form-control form-controls-font" type='text' size='30' name='oldsre' id='oldsre' value='<?php esc_attr_e( 'email address', 'subscribe-to-comments-reloaded' ) ?>' style="color:#ccc;"></td>
|
60 |
+
<td><span class="validate-error-text validate-error-text-oldsre stcr-hidden "></span></td>
|
61 |
+
</tr>
|
62 |
+
<tr>
|
63 |
+
<td><label for='sre'><?php _e( 'To', 'subscribe-to-comments-reloaded' ) ?></label></td>
|
64 |
+
<td><input class="form-control form-controls-font" type='text' size='30' name='sre' id='sre' value='<?php esc_attr_e( 'optional - new email address', 'subscribe-to-comments-reloaded' ) ?>' style="color:#ccc;"
|
65 |
+
>
|
66 |
+
</td>
|
67 |
+
<td><span class="validate-error-text validate-error-text-sre stcr-hidden "></span></td>
|
68 |
+
</tr>
|
69 |
+
<tr>
|
70 |
+
<td><label for='srs'><?php _e( 'Status', 'subscribe-to-comments-reloaded' ) ?></label></td>
|
71 |
+
<td><select class="form-control form-controls-font mass-update-select-status" name="srs" id="srs">
|
72 |
+
<option value=''><?php _e( 'Keep unchanged', 'subscribe-to-comments-reloaded' ) ?></option>
|
73 |
+
<option value='Y'><?php _e( 'Active', 'subscribe-to-comments-reloaded' ) ?></option>
|
74 |
+
<option value='R'><?php _e( 'Replies only', 'subscribe-to-comments-reloaded' ) ?></option>
|
75 |
+
<option value='C'><?php _e( 'Suspended', 'subscribe-to-comments-reloaded' ) ?></option>
|
76 |
+
</select>
|
77 |
+
<input type='submit' style="font-size: 0.8rem;" class='subscribe-form-button btn btn-primary' value='<?php esc_attr_e( 'Update', 'subscribe-to-comments-reloaded' ) ?>' ></td>
|
78 |
+
</tr>
|
79 |
+
<tr>
|
80 |
+
<td colspan="2">
|
81 |
+
<div class="more-info" data-infopanel="info-panel-mass-update" aria-label="<?php _e("More info", 'subscribe-to-comments-reloaded'); ?>">
|
82 |
+
<i class="fas fa-question-circle"></i>
|
83 |
+
</div>
|
84 |
+
</td>
|
85 |
+
|
86 |
+
</tr>
|
87 |
+
<tr>
|
88 |
+
<td colspan="2"><input type='hidden' name='sra' value='edit' /></td>
|
89 |
+
</tr>
|
90 |
+
</table>
|
91 |
+
|
92 |
+
<div class="alert alert-info hidden info-panel-mass-update" role="alert">
|
93 |
+
<?php _e('This option will allow you to change an email address for another one or to update the same status for all the subscription on a specific email address.', 'subscribe-to-comments-reloaded' ); ?>
|
94 |
+
</div>
|
95 |
+
|
96 |
+
<?php wp_nonce_field( 'stcr_edit_subscription_nonce', 'stcr_edit_subscription_nonce' ); ?>
|
97 |
+
</form>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
|
103 |
+
<div class="col-sm-6">
|
104 |
+
<div class="card card-font-size add-new-subs">
|
105 |
+
<h6 class="card-header">
|
106 |
+
<i class="fas fa-plus-square"></i> <?php _e( 'Add New Subscription', 'subscribe-to-comments-reloaded' ) ?>
|
107 |
+
<i class="fas fa-caret-down pull-right"></i>
|
108 |
+
</h6>
|
109 |
+
<div class="card-body" style="padding: 0;">
|
110 |
+
<div class="card-text stcr-hidden">
|
111 |
+
<form action="" method="post" id="add_new_subscription">
|
112 |
+
<fieldset style="border:0">
|
113 |
+
<table>
|
114 |
+
<tr>
|
115 |
+
<td><?php _e( 'Post ID', 'subscribe-to-comments-reloaded' ) ?></td>
|
116 |
+
<td><input class="form-control form-controls-font" type='text' size='30' name='srp' value='' ></td>
|
117 |
+
<td><span class="validate-error-text validate-error-text-srp stcr-hidden "></span></td>
|
118 |
+
</tr>
|
119 |
+
<tr>
|
120 |
+
<td><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></td>
|
121 |
+
<td><input class="form-control form-controls-font" type='text' size='30' name='sre' value='' ></td>
|
122 |
+
<td><span class="validate-error-text validate-error-text-sre stcr-hidden "></span></td>
|
123 |
+
</tr>
|
124 |
+
<tr>
|
125 |
+
<td><?php _e( 'Status', 'subscribe-to-comments-reloaded' ) ?></td>
|
126 |
+
<td>
|
127 |
+
<select name="srs" class="form-control form-controls-font new-sub-select-status">
|
128 |
+
<option value='Y'><?php _e( 'Active', 'subscribe-to-comments-reloaded' ) ?></option>
|
129 |
+
<option value='R'><?php _e( 'Replies only', 'subscribe-to-comments-reloaded' ) ?></option>
|
130 |
+
<option value='YC'><?php _e( 'Ask user to confirm', 'subscribe-to-comments-reloaded' ) ?></option>
|
131 |
+
</select>
|
132 |
+
<input type='submit' style="font-size: 0.8rem;" class='subscribe-form-button btn btn-primary' value='<?php esc_attr_e( 'Add', 'subscribe-to-comments-reloaded' ) ?>' >
|
133 |
+
</td>
|
134 |
+
</tr>
|
135 |
+
<tr>
|
136 |
+
<td><input type='hidden' name='sra' value='add' ></td>
|
137 |
+
</tr>
|
138 |
+
</table>
|
139 |
+
|
140 |
+
</fieldset>
|
141 |
+
<?php wp_nonce_field( 'stcr_add_subscription_nonce', 'stcr_add_subscription_nonce' ); ?>
|
142 |
+
</form>
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
|
149 |
+
<div class="clearfix"></div>
|
150 |
+
|
151 |
+
<div class="row mx-auto">
|
152 |
+
<div class="col-sm-12 col-md-12 col-lg-12">
|
153 |
+
<div class="card card-subscribers" style="max-width: 100% !important;">
|
154 |
+
<div class="card-body">
|
155 |
+
|
156 |
+
<div class="card-text postbox" style="border: none;">
|
157 |
+
|
158 |
+
<h4><i class="fas fa-search"></i> <?php _e( 'Search subscriptions', 'subscribe-to-comments-reloaded' ) ?></h4>
|
159 |
+
|
160 |
+
<?php if ( ! empty( $_POST['srv'] ) || ( is_array( $subscriptions ) && count( $subscriptions ) == 1000 ) ) : ?>
|
161 |
+
|
162 |
+
<?php
|
163 |
+
$search_term = '';
|
164 |
+
if ( ! empty( $_POST['srv'] ) ) {
|
165 |
+
$search_term = sanitize_text_field( $_POST['srv'] );
|
166 |
+
}
|
167 |
+
?>
|
168 |
+
<form action="" method="post" style="background: #f5f5f5; padding: 15px; margin-top: 20px;">
|
169 |
+
<p>
|
170 |
+
<strong><?php esc_html_e( 'The table below is limited to loading 1000 latest subscriptions.', 'subscribe-to-comments-reloaded' ); ?></strong>
|
171 |
+
<br><?php esc_html_e( 'You have more than that, if you need to find an older subscription just enter a search term ( full email, partial email, post ID...) below.', 'subscribe-to-comments-reloaded' ); ?>
|
172 |
+
</p>
|
173 |
+
<p>
|
174 |
+
<input type="text" name="srv" placeholder="<?php esc_attr_e( 'Enter search term', 'subscribe-to-comments-reloaded' ); ?>" value="<?php echo esc_attr( $search_term ); ?>">
|
175 |
+
<input type="submit" class="button button-primary">
|
176 |
+
</p>
|
177 |
+
</form>
|
178 |
+
|
179 |
+
<?php endif; ?>
|
180 |
+
|
181 |
+
<div class="col-md-2 subs-spinner mx-auto"><h5><?php _e( "Loading", 'subscribe-to-comments-reloaded'); ?> <i class="fas fa-play-circle"></i></h5></div>
|
182 |
+
|
183 |
+
<div class="clearfix"></div>
|
184 |
+
|
185 |
+
<form style="border: 1px solid #eee; padding: 15px; margin-top: 20px;" action="" method="post" id="subscription_form" name="subscription_form"
|
186 |
+
onsubmit="if(this.sra[0].checked) return confirm('<?php _e( 'Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-to-comments-reloaded' ) ?>')">
|
187 |
+
|
188 |
+
<?php
|
189 |
+
|
190 |
+
$alternate = '';
|
191 |
+
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
|
192 |
+
// Let us form those status
|
193 |
+
$status_arry = array(
|
194 |
+
'R' => __( 'Replies', 'subscribe-to-comments-reloaded'),
|
195 |
+
'RC' => __( 'Replies Unconfirmed', 'subscribe-to-comments-reloaded'),
|
196 |
+
'Y' => __( "All Comments", 'subscribe-to-comments-reloaded'),
|
197 |
+
'YC' => __( "Unconfirmed", 'subscribe-to-comments-reloaded'),
|
198 |
+
'C' => __( "Inactive", 'subscribe-to-comments-reloaded'),
|
199 |
+
'-C' => __( "Active", 'subscribe-to-comments-reloaded')
|
200 |
+
);
|
201 |
+
|
202 |
+
if ( ! empty( $subscriptions ) && is_array( $subscriptions ) ) {
|
203 |
+
|
204 |
+
$show_post_column = ( $operator != 'equals' || $search_field != 'post_id' ) ? __( 'Post (ID)', 'subscribe-to-comments-reloaded' ) : '';
|
205 |
+
$show_email_column = ( $operator != 'equals' || $search_field != 'email' ) ? __( 'Email', 'subscribe-to-comments-reloaded' ) : '';
|
206 |
+
|
207 |
+
echo "<table class=\"table table-smx table-hover table-striped subscribers-table stcr-hidden\" style=\"font-size: 0.8em\">
|
208 |
+
<thead>";
|
209 |
+
|
210 |
+
if( $wp_locale->text_direction == 'rtl' )
|
211 |
+
{
|
212 |
+
|
213 |
+
echo "<tr>
|
214 |
+
<th scope=\"col\">
|
215 |
+
<i class=\"fas fa-exchange-alt\"></i> <span>" . __('Actions', 'subscribe-to-comments-reloaded') ."</span>
|
216 |
+
<input class='checkbox' type='checkbox' name='subscription_list_select_all' id='stcr_select_all' class='stcr_select_all'/>
|
217 |
+
</th>
|
218 |
+
<th scope=\"col\"><i class=\"fas fa-thumbtack\"></i><span>$show_post_column</span></th>
|
219 |
+
<th scope=\"col\"><i class=\"fas fa-address-card\"></i><span>$show_email_column</span></th>
|
220 |
+
<th scope=\"col\"><i class=\"fas fa-calendar-alt\"></i><span>". __( 'Date and Time', 'subscribe-to-comments-reloaded' ) . "</span></th>
|
221 |
+
<th scope=\"col\"><i class=\"fas fa-info-circle\"></i><span>". __( 'Status', 'subscribe-to-comments-reloaded' ) . "</span></th>
|
222 |
+
</tr>";
|
223 |
+
}
|
224 |
+
else
|
225 |
+
{
|
226 |
+
echo "<tr>
|
227 |
+
<th scope=\"col\">
|
228 |
+
<input class='checkbox' type='checkbox' name='subscription_list_select_all' id='stcr_select_all' class='stcr_select_all'/>
|
229 |
+
<i class=\"fas fa-exchange-alt\"></i> <span>" . __('Actions', 'subscribe-to-comments-reloaded') ."</span>
|
230 |
+
</th>
|
231 |
+
<th scope=\"col\"><i class=\"fas fa-thumbtack\"></i><span>$show_post_column</span></th>
|
232 |
+
<th scope=\"col\"><i class=\"fas fa-address-card\"></i><span>$show_email_column</span></th>
|
233 |
+
<th scope=\"col\"><i class=\"fas fa-calendar-alt\"></i><span>". __( 'Date and Time', 'subscribe-to-comments-reloaded' ) . "</span></th>
|
234 |
+
<th scope=\"col\"><i class=\"fas fa-info-circle\"></i><span>". __( 'Status', 'subscribe-to-comments-reloaded' ) . "</span></th>
|
235 |
+
</tr>";
|
236 |
+
}
|
237 |
+
|
238 |
+
echo "</thead>";
|
239 |
+
echo "<tbody>";
|
240 |
+
|
241 |
+
foreach ( $subscriptions as $a_subscription ) {
|
242 |
+
//$wp_subscribe_reloaded->stcr->utils->stcr_logger( print_r($a_subscription, true) );
|
243 |
+
$title = get_the_title( $a_subscription->post_id );
|
244 |
+
$title = ( strlen( $title ) > 35 ) ? substr( $title, 0, 35 ) . '..' : $title;
|
245 |
+
if( $wp_locale->text_direction == 'rtl' )
|
246 |
+
{
|
247 |
+
$row_post = ( $operator != 'equals' || $search_field != 'post_id' ) ? "<a href='admin.php?page=stcr_manage_subscriptions&srf=post_id&srt=equals&srv=$a_subscription->post_id'>($a_subscription->post_id) $title</a> " : '';
|
248 |
+
}
|
249 |
+
else
|
250 |
+
{
|
251 |
+
$row_post = ( $operator != 'equals' || $search_field != 'post_id' ) ? "<a href='admin.php?page=stcr_manage_subscriptions&srf=post_id&srt=equals&srv=$a_subscription->post_id'>$title ($a_subscription->post_id)</a> " : '';
|
252 |
+
}
|
253 |
+
$row_email = ( $operator != 'equals' || $search_field != 'email' ) ? "<a href='admin.php?page=stcr_manage_subscriptions&srf=email&srt=equals&srv=" . urlencode( $a_subscription->email ) . "' title='email unique key: ( $a_subscription->email_key )'>$a_subscription->email</a> " : '';
|
254 |
+
$date_time = date_i18n( $date_time_format, strtotime( $a_subscription->dt ) );
|
255 |
+
$date_time_sort = date_i18n( 'YmdHis', strtotime( $a_subscription->dt ) );
|
256 |
+
|
257 |
+
$status_desc = $status_arry[$a_subscription->status];
|
258 |
+
|
259 |
+
$delete_url = "admin.php?page=stcr_manage_subscriptions&sra=delete-subscription&srp=" . $a_subscription->post_id . "&sre=" . urlencode( $a_subscription->email );
|
260 |
+
$delete_url = wp_nonce_url( $delete_url, 'stcr_delete_subscription_nonce', 'stcr_delete_subscription_nonce' );
|
261 |
+
|
262 |
+
if( $wp_locale->text_direction == 'rtl' )
|
263 |
+
{
|
264 |
+
echo "<tr>
|
265 |
+
<td>
|
266 |
+
<label for='sub_{$a_subscription->meta_id}' class='hidden'>" . __( 'Subscription', 'subscribe-to-comments-reloaded' ) . " {$a_subscription->meta_id}</label>
|
267 |
+
<input class='checkbox' type='checkbox' name='subscriptions_list[]' value='$a_subscription->post_id," . urlencode( $a_subscription->email ) . "' id='sub_{$a_subscription->meta_id}' />
|
268 |
+
<a href='admin.php?page=stcr_manage_subscriptions&sra=edit-subscription&srp=" . $a_subscription->post_id . "&sre=" . urlencode( $a_subscription->email ) . "' alt='" . __( 'Edit', 'subscribe-to-comments-reloaded' ) . "'><i class=\"fas fa-edit\" style='font-size: 1.1em;color: #ffc53a;'></i></a>
|
269 |
+
<a href='$delete_url' onclick='return confirm(\"" . __( 'Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-to-comments-reloaded' ) . "\");' alt='" . __( 'Delete', 'subscribe-to-comments-reloaded' ) . "'><i class=\"fas fa-trash-alt\" style='font-size: 1.1em;color: #ff695a;'></i></a>
|
270 |
+
</td>
|
271 |
+
<td>$row_post</td>
|
272 |
+
<td>$row_email</td>
|
273 |
+
<td data-sort='$date_time_sort'>$date_time</td>
|
274 |
+
<td>$status_desc</td>
|
275 |
+
</tr>";
|
276 |
+
}
|
277 |
+
else
|
278 |
+
{
|
279 |
+
echo "<tr>
|
280 |
+
<td>
|
281 |
+
<label for='sub_{$a_subscription->meta_id}' class='hidden'>" . __( 'Subscription', 'subscribe-to-comments-reloaded' ) . " {$a_subscription->meta_id}</label>
|
282 |
+
<input class='checkbox' type='checkbox' name='subscriptions_list[]' value='$a_subscription->post_id," . urlencode( $a_subscription->email ) . "' id='sub_{$a_subscription->meta_id}' />
|
283 |
+
<a href='admin.php?page=stcr_manage_subscriptions&sra=edit-subscription&srp=" . $a_subscription->post_id . "&sre=" . urlencode( $a_subscription->email ) . "' alt='" . __( 'Edit', 'subscribe-to-comments-reloaded' ) . "'><i class=\"fas fa-edit\" style='font-size: 1.1em;color: #ffc53a;'></i></a>
|
284 |
+
<a href='$delete_url' onclick='return confirm(\"" . __( 'Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-to-comments-reloaded' ) . "\");' alt='" . __( 'Delete', 'subscribe-to-comments-reloaded' ) . "'><i class=\"fas fa-trash-alt\" style='font-size: 1.1em;color: #ff695a;'></i></a>
|
285 |
+
</td>
|
286 |
+
<td>$row_post</td>
|
287 |
+
<td>$row_email</td>
|
288 |
+
<td data-sort='$date_time_sort'>$date_time</td>
|
289 |
+
<td>$status_desc</td>
|
290 |
+
</tr>";
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
294 |
+
echo "</tbody>";
|
295 |
+
|
296 |
+
echo "</table>";
|
297 |
+
|
298 |
+
echo "<div class='subscribers-mass-actions form-group row'>";
|
299 |
+
echo '<label for="action_type" class="col-sm-1 col-form-label">' . __( 'Action:', 'subscribe-to-comments-reloaded' ) . '</label >' ;
|
300 |
+
?> <div class="col-sm-3">
|
301 |
+
<select name="sra" id="action_type" class="form-control">
|
302 |
+
<option value="delete"><?php _e( 'Delete forever', 'subscribe-to-comments-reloaded' ) ?></option>
|
303 |
+
<option value="suspend"><?php _e( 'Suspend', 'subscribe-to-comments-reloaded' ) ?></option>
|
304 |
+
<option value="force_y"><?php _e( 'Activate and set to notify on all comments', 'subscribe-to-comments-reloaded' ) ?></option>
|
305 |
+
<option value="force_r"><?php _e( 'Activate and set to notify on replies only ', 'subscribe-to-comments-reloaded' ) ?></option>
|
306 |
+
<option value="activate"><?php _e( 'Activate', 'subscribe-to-comments-reloaded' ) ?></option>
|
307 |
+
</select>
|
308 |
+
</div>
|
309 |
+
<?php
|
310 |
+
echo '<div class="col-sm-2"><button type="submit" class="subscribe-form-button btn btn-primary" >' . __( 'Update subscriptions', 'subscribe-to-comments-reloaded' ) . '</button></div>';
|
311 |
+
echo "<input type='hidden' name='srf' value='$search_field'/><input type='hidden' name='srt' value='$operator'/><input type='hidden' name='srv' value='$search_value'/><input type='hidden' name='srsf' value='$offset'/><input type='hidden' name='srrp' value='$limit_results'/><input type='hidden' name='srob' value='$order_by'/><input type='hidden' name='sro' value='$order'/>";
|
312 |
+
echo "</div>";
|
313 |
+
|
314 |
+
} elseif ( $action == 'search' ) {
|
315 |
+
echo '<p>' . __( 'Sorry, no subscriptions match your search criteria.', 'subscribe-to-comments-reloaded' ) . "</p>";
|
316 |
+
}
|
317 |
+
?>
|
318 |
+
|
319 |
+
<?php wp_nonce_field( 'stcr_update_subscriptions_nonce', 'stcr_update_subscriptions_nonce' ); ?>
|
320 |
+
|
321 |
+
</form>
|
322 |
+
</div>
|
323 |
+
</div>
|
324 |
+
</div>
|
325 |
+
</div>
|
326 |
+
</div>
|
327 |
+
|
328 |
+
<div class="clearfix"></div>
|
329 |
+
|
330 |
+
<div class="row">
|
331 |
+
<div class="col-sm-6 col-md-6 col-lg-6 mx-auto">
|
332 |
+
<div class="card" style="max-width: 100% !important;">
|
333 |
+
<div class="card-body">
|
334 |
+
<p>
|
335 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
336 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
337 |
+
</p>
|
338 |
+
<p>
|
339 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
340 |
+
</p>
|
341 |
+
</div>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
|
347 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/datatables/media/js/jquery.dataTables.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
348 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/datatables/media/js/dataTables.bootstrap4.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
349 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/datatables.net-responsive/js/dataTables.responsive.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
350 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
351 |
+
|
352 |
+
<?php
|
353 |
+
// Tell WP that we are going to use a resource.
|
354 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-management", "subs_management.js", "includes/js/admin");
|
355 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
356 |
+
$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-subs-management", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
357 |
+
// Enqueue the JS File
|
358 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-management" );
|
359 |
+
|
360 |
+
?>
|
options/stcr_management_page.php
CHANGED
@@ -1,440 +1,455 @@
|
|
1 |
-
<?php
|
2 |
-
// Management Page
|
3 |
-
|
4 |
-
// Avoid direct access to this piece of code
|
5 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
-
header( 'Location: /' );
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
$options = array(
|
11 |
-
"manager_page_enabled" => "yesno",
|
12 |
-
"manager_page_title" => "text",
|
13 |
-
"manager_page" => "url",
|
14 |
-
"custom_header_meta" => "text-html",
|
15 |
-
"request_mgmt_link" => "text-html",
|
16 |
-
"request_mgmt_link_thankyou" => "text-html",
|
17 |
-
"subscribe_without_commenting" => "text-html",
|
18 |
-
"subscription_confirmed" => "text-html",
|
19 |
-
"subscription_confirmed_dci" => "text-html",
|
20 |
-
"author_text" => "text-html",
|
21 |
-
"user_text" => "text-html",
|
22 |
-
'allow_subscribe_without_comment' => 'yesno',
|
23 |
-
'allow_request_management_link' => 'yesno',
|
24 |
-
);
|
25 |
-
|
26 |
-
$options_readable = array(
|
27 |
-
"manager_page" => __("Management URL",'subscribe-to-comments-reloaded')
|
28 |
-
);
|
29 |
-
|
30 |
-
// Update options
|
31 |
-
if ( isset( $_POST['options'] ) ) {
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
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 |
-
<div class="
|
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 |
-
<div class="
|
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 |
-
<div class="
|
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 |
-
|
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 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
</
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
</
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
<div class="
|
414 |
-
<
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
// Management Page
|
3 |
+
|
4 |
+
// Avoid direct access to this piece of code
|
5 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
+
header( 'Location: /' );
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
$options = array(
|
11 |
+
"manager_page_enabled" => "yesno",
|
12 |
+
"manager_page_title" => "text",
|
13 |
+
"manager_page" => "url",
|
14 |
+
"custom_header_meta" => "text-html",
|
15 |
+
"request_mgmt_link" => "text-html",
|
16 |
+
"request_mgmt_link_thankyou" => "text-html",
|
17 |
+
"subscribe_without_commenting" => "text-html",
|
18 |
+
"subscription_confirmed" => "text-html",
|
19 |
+
"subscription_confirmed_dci" => "text-html",
|
20 |
+
"author_text" => "text-html",
|
21 |
+
"user_text" => "text-html",
|
22 |
+
'allow_subscribe_without_comment' => 'yesno',
|
23 |
+
'allow_request_management_link' => 'yesno',
|
24 |
+
);
|
25 |
+
|
26 |
+
$options_readable = array(
|
27 |
+
"manager_page" => __("Management URL",'subscribe-to-comments-reloaded')
|
28 |
+
);
|
29 |
+
|
30 |
+
// Update options
|
31 |
+
if ( isset( $_POST['options'] ) ) {
|
32 |
+
|
33 |
+
if ( empty( $_POST['stcr_save_management_page_nonce'] ) ) {
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_management_page_nonce'], 'stcr_save_management_page_nonce' ) ) {
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
|
41 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
|
45 |
+
$faulty_fields = array();
|
46 |
+
|
47 |
+
foreach ( $_POST['options'] as $option => $value )
|
48 |
+
{
|
49 |
+
if ( ! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
50 |
+
{
|
51 |
+
array_push( $faulty_fields, $option );
|
52 |
+
}
|
53 |
+
if( $option == "manager_page" && $value == "") //TODO: Add validation for all he require fields.
|
54 |
+
{
|
55 |
+
array_push( $faulty_fields, $option );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
// Display an alert in the admin interface if something went wrong
|
60 |
+
if ( sizeof( $faulty_fields ) == 0 ) {
|
61 |
+
echo '<div class="updated"><p>';
|
62 |
+
_e( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
63 |
+
echo "</p></div>";
|
64 |
+
} else {
|
65 |
+
echo '<div class="error"><p>';
|
66 |
+
_e( 'There was an error updating the following fields:', 'subscribe-to-comments-reloaded' );
|
67 |
+
echo "<ul style='font-size: 0.8em;'>";
|
68 |
+
foreach( $faulty_fields as $field )
|
69 |
+
{
|
70 |
+
echo ' <li>> ' . $options_readable[$field] . '</li>';
|
71 |
+
}
|
72 |
+
echo "</ul>";
|
73 |
+
echo "</p></div>";
|
74 |
+
}
|
75 |
+
}
|
76 |
+
wp_print_scripts( 'quicktags' );
|
77 |
+
|
78 |
+
?>
|
79 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
80 |
+
|
81 |
+
<div class="container-fluid">
|
82 |
+
<div class="mt-3"></div>
|
83 |
+
<div class="row">
|
84 |
+
<div class="col-sm-9">
|
85 |
+
<form class="management_page_form" action="" method="post">
|
86 |
+
|
87 |
+
<div class="form-group row">
|
88 |
+
<label for="manager_page_enabled" class="col-sm-3 col-form-label text-right"><?php _e( 'Virtual Management Page', 'subscribe-to-comments-reloaded' ) ?></label>
|
89 |
+
<div class="col-sm-7">
|
90 |
+
<div class="switch">
|
91 |
+
<input type="radio" class="switch-input" name="options[manager_page_enabled]"
|
92 |
+
value="yes" id="manager_page_enabled-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'manager_page_enabled' ) == 'yes' ) ? ' checked' : ''; ?> />
|
93 |
+
<label for="manager_page_enabled-yes" class="switch-label switch-label-off">
|
94 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
95 |
+
</label>
|
96 |
+
<input type="radio" class="switch-input" name="options[manager_page_enabled]" value="no" id="manager_page_enabled-no"
|
97 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'manager_page_enabled' ) == 'no' ) ? ' checked' : ''; ?> />
|
98 |
+
<label for="manager_page_enabled-no" class="switch-label switch-label-on">
|
99 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
100 |
+
</label>
|
101 |
+
<span class="switch-selection"></span>
|
102 |
+
</div>
|
103 |
+
<div class="helpDescription subsOptDescriptions"
|
104 |
+
data-content="<?php _e( "Disable the virtual management page if you need to create a <a href='https://github.com/stcr/subscribe-to-comments-reloaded/wiki/KB#create-a-real-management-page'>real page</a> to make your theme happy.", 'subscribe-to-comments-reloaded' ); ?>"
|
105 |
+
data-placement="right"
|
106 |
+
aria-label="<?php _e( "Disable the virtual management page if you need to create a <a href='https://github.com/stcr/subscribe-to-comments-reloaded/wiki/KB#create-a-real-management-page'>real page</a> to make your theme happy.", 'subscribe-to-comments-reloaded' ); ?>">
|
107 |
+
<i class="fas fa-question-circle"></i>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div class="form-group row">
|
113 |
+
<label for="manager_page_title" class="col-sm-3 col-form-label text-right">
|
114 |
+
<?php _e( 'Page title', 'subscribe-to-comments-reloaded' ) ?></label>
|
115 |
+
<div class="col-sm-7">
|
116 |
+
<input type="text" name="options[manager_page_title]" id="manager_page_title"
|
117 |
+
class="form-control form-control-input-8"
|
118 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'manager_page_title' ) ); ?>" size="20">
|
119 |
+
|
120 |
+
<div class="helpDescription subsOptDescriptions"
|
121 |
+
data-content="<?php _e( 'Title of the page your visitors will use to manage their subscriptions.', 'subscribe-to-comments-reloaded' ); ?>"
|
122 |
+
data-placement="right"
|
123 |
+
aria-label="<?php _e( 'Title of the page your visitors will use to manage their subscriptions.', 'subscribe-to-comments-reloaded' ); ?>">
|
124 |
+
<i class="fas fa-question-circle"></i>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
|
129 |
+
<div class="form-group row">
|
130 |
+
<label for="manager_page" class="col-sm-3 col-form-label text-right">
|
131 |
+
<?php _e( 'Management URL', 'subscribe-to-comments-reloaded' ) ?></label>
|
132 |
+
<div class="col-sm-7">
|
133 |
+
<code><?php echo get_bloginfo( 'url' ) ?></code>
|
134 |
+
<input type="text" name="options[manager_page]" id="manager_page"
|
135 |
+
class="form-control form-control-input-8"
|
136 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'manager_page' ) ); ?>" style=" width: 60% !important;">
|
137 |
+
|
138 |
+
<div class="helpDescription subsOptDescriptions"
|
139 |
+
data-content="<?php _e( "The permalink for your management page (something like <code>/manage-subscriptions</code> or <code>/?page_id=345</code>). This page <b>does not</b> actually exist in the system, but its link must follow your permalink structure.", 'subscribe-to-comments-reloaded' ); ?>"
|
140 |
+
data-placement="bottom"
|
141 |
+
aria-label="<?php _e( "The permalink for your management page (something like <code>/manage-subscriptions</code> or <code>/?page_id=345</code>). This page <b>does not</b> actually exist in the system, but its link must follow your permalink structure.", 'subscribe-to-comments-reloaded' ); ?>">
|
142 |
+
<i class="fas fa-question-circle"></i>
|
143 |
+
</div>
|
144 |
+
|
145 |
+
<?php
|
146 |
+
if ( ( get_option( 'permalink_structure' ) == '' ) && ( strpos( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'manager_page' ), '?page_id=' ) === false ) ) {
|
147 |
+
echo "<div class=\"alert alert-danger\" role=\"alert\">";
|
148 |
+
echo '<strong>' . __( "Warning: it looks like the value you are using may be incompatible with your permalink structure", 'subscribe-to-comments-reloaded' ) . '</strong>';
|
149 |
+
echo "</div>";
|
150 |
+
}
|
151 |
+
?>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
|
155 |
+
<div class="form-group row">
|
156 |
+
<label for="custom_header_meta" class="col-sm-3 col-form-label text-right">
|
157 |
+
<?php _e( 'Custom HEAD meta', 'subscribe-to-comments-reloaded' ) ?></label>
|
158 |
+
<div class="col-sm-7">
|
159 |
+
<input type="text" name="options[custom_header_meta]" id="custom_header_meta"
|
160 |
+
class="form-control form-control-input-8"
|
161 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'custom_header_meta' ) ); ?>" size="20">
|
162 |
+
|
163 |
+
<div class="helpDescription subsOptDescriptions"
|
164 |
+
data-content="<?php _e( 'Specify your custom HTML code to be added to the HEAD section of the page. Use <strong>single</strong> quotes for values.', 'subscribe-to-comments-reloaded' ); ?>"
|
165 |
+
data-placement="right"
|
166 |
+
aria-label="<?php _e( 'Specify your custom HTML code to be added to the HEAD section of the page. Use <strong>single</strong> quotes for values.', 'subscribe-to-comments-reloaded' ); ?>">
|
167 |
+
<i class="fas fa-question-circle"></i>
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
|
172 |
+
<div class="form-group row">
|
173 |
+
<label for="allow_subscribe_without_comment" class="col-sm-3 col-form-label text-right"><?php _e( 'Allow "Subscribe Without Comment"', 'subscribe-to-comments-reloaded' ) ?></label>
|
174 |
+
<div class="col-sm-7">
|
175 |
+
<div class="switch">
|
176 |
+
<input type="radio" class="switch-input" name="options[allow_subscribe_without_comment]"
|
177 |
+
value="yes" id="allow_subscribe_without_comment-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'allow_subscribe_without_comment', 'yes' ) == 'yes' ) ? ' checked' : ''; ?> />
|
178 |
+
<label for="allow_subscribe_without_comment-yes" class="switch-label switch-label-off">
|
179 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
180 |
+
</label>
|
181 |
+
<input type="radio" class="switch-input" name="options[allow_subscribe_without_comment]" value="no" id="allow_subscribe_without_comment-no"
|
182 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'allow_subscribe_without_comment', 'yes' ) == 'no' ) ? ' checked' : ''; ?> />
|
183 |
+
<label for="allow_subscribe_without_comment-no" class="switch-label switch-label-on">
|
184 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
185 |
+
</label>
|
186 |
+
<span class="switch-selection"></span>
|
187 |
+
</div>
|
188 |
+
<div class="helpDescription subsOptDescriptions"
|
189 |
+
data-content="<?php _e( "Enable or disable the form that allows visitors to subscribe to comments notifications without commenting.", 'subscribe-to-comments-reloaded' ); ?>"
|
190 |
+
data-placement="right"
|
191 |
+
aria-label="<?php _e( "Enable or disable the form that allows visitors to subscribe to comments notifications without commenting.", 'subscribe-to-comments-reloaded' ); ?>">
|
192 |
+
<i class="fas fa-question-circle"></i>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
|
197 |
+
<div class="form-group row">
|
198 |
+
<label for="allow_request_management_link" class="col-sm-3 col-form-label text-right"><?php _e( 'Allow "Request Management Link"', 'subscribe-to-comments-reloaded' ) ?></label>
|
199 |
+
<div class="col-sm-7">
|
200 |
+
<div class="switch">
|
201 |
+
<input type="radio" class="switch-input" name="options[allow_request_management_link]"
|
202 |
+
value="yes" id="allow_request_management_link-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'allow_request_management_link', 'yes' ) == 'yes' ) ? ' checked' : ''; ?> />
|
203 |
+
<label for="allow_request_management_link-yes" class="switch-label switch-label-off">
|
204 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
205 |
+
</label>
|
206 |
+
<input type="radio" class="switch-input" name="options[allow_request_management_link]" value="no" id="allow_request_management_link-no"
|
207 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'allow_request_management_link', 'yes' ) == 'no' ) ? ' checked' : ''; ?> />
|
208 |
+
<label for="allow_request_management_link-no" class="switch-label switch-label-on">
|
209 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
210 |
+
</label>
|
211 |
+
<span class="switch-selection"></span>
|
212 |
+
</div>
|
213 |
+
<div class="helpDescription subsOptDescriptions"
|
214 |
+
data-content="<?php _e( "Enable or disable the form that allows visitors to to request a subscription management link.", 'subscribe-to-comments-reloaded' ); ?>"
|
215 |
+
data-placement="right"
|
216 |
+
aria-label="<?php _e( "Enable or disable the form that allows visitors to to request a subscription management link.", 'subscribe-to-comments-reloaded' ); ?>">
|
217 |
+
<i class="fas fa-question-circle"></i>
|
218 |
+
</div>
|
219 |
+
</div>
|
220 |
+
</div>
|
221 |
+
|
222 |
+
<h3><?php _e( 'Messages', 'subscribe-to-comments-reloaded' ) ?></h3>
|
223 |
+
|
224 |
+
<div class="form-group row">
|
225 |
+
<label for="request_mgmt_link" class="col-sm-2 offset-sm-1 col-form-label" style="z-index: 9999;">
|
226 |
+
<?php _e( 'Request link', 'subscribe-to-comments-reloaded' ) ?>
|
227 |
+
|
228 |
+
<div class="helpDescription subsOptDescriptions"
|
229 |
+
data-content="<?php _e( 'Text shown to those who request to manage their subscriptions.', 'subscribe-to-comments-reloaded' ); ?>"
|
230 |
+
data-placement="right"
|
231 |
+
aria-label="<?php _e( 'Text shown to those who request to manage their subscriptions.', 'subscribe-to-comments-reloaded' ); ?>">
|
232 |
+
<i class="fas fa-question-circle"></i>
|
233 |
+
</div>
|
234 |
+
|
235 |
+
</label>
|
236 |
+
<div class="clearfix"></div>
|
237 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
238 |
+
<?php
|
239 |
+
$id_request_mgmt_link = "request_mgmt_link";
|
240 |
+
$args_notificationContent = array(
|
241 |
+
"media_buttons" => false,
|
242 |
+
"textarea_rows" => 3,
|
243 |
+
"teeny" => true,
|
244 |
+
"textarea_name" => "options[{$id_request_mgmt_link}]"
|
245 |
+
);
|
246 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_request_mgmt_link ), $id_request_mgmt_link, $args_notificationContent );
|
247 |
+
?>
|
248 |
+
</div>
|
249 |
+
</div>
|
250 |
+
|
251 |
+
<div class="form-group row" style="display: none;">
|
252 |
+
<label for="request_mgmt_link_thankyou" class="col-sm-3 offset-sm-1 col-form-label" style="z-index: 9999;">
|
253 |
+
<?php _e( 'Request submitted', 'subscribe-to-comments-reloaded' ) ?>
|
254 |
+
|
255 |
+
<div class="helpDescription subsOptDescriptions"
|
256 |
+
data-content="<?php _e( 'Thank you note shown after the request here above has been processed. Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>"
|
257 |
+
data-placement="right"
|
258 |
+
aria-label="<?php _e( 'Thank you note shown after the request here above has been processed. Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>">
|
259 |
+
<i class="fas fa-question-circle"></i>
|
260 |
+
</div>
|
261 |
+
|
262 |
+
</label>
|
263 |
+
<div class="clearfix"></div>
|
264 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
265 |
+
<?php
|
266 |
+
$id_request_mgmt_link_thankyou = "request_mgmt_link_thankyou";
|
267 |
+
$args_notificationContent = array(
|
268 |
+
"media_buttons" => false,
|
269 |
+
"textarea_rows" => 3,
|
270 |
+
"teeny" => true,
|
271 |
+
"textarea_name" => "options[{$id_request_mgmt_link_thankyou}]"
|
272 |
+
);
|
273 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_request_mgmt_link_thankyou ), $id_request_mgmt_link_thankyou, $args_notificationContent );
|
274 |
+
?>
|
275 |
+
</div>
|
276 |
+
</div>
|
277 |
+
|
278 |
+
<div class="form-group row">
|
279 |
+
<label for="subscribe_without_commenting" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
280 |
+
<?php _e( 'Subscribe without commenting', 'subscribe-to-comments-reloaded' ) ?>
|
281 |
+
|
282 |
+
<div class="helpDescription subsOptDescriptions"
|
283 |
+
data-content="<?php _e( 'Text shown to those who want to subscribe without commenting. Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>"
|
284 |
+
data-placement="right"
|
285 |
+
aria-label="<?php _e( 'Text shown to those who want to subscribe without commenting. Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>">
|
286 |
+
<i class="fas fa-question-circle"></i>
|
287 |
+
</div>
|
288 |
+
|
289 |
+
</label>
|
290 |
+
<div class="clearfix"></div>
|
291 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
292 |
+
<?php
|
293 |
+
$id_subscribe_without_commenting = "subscribe_without_commenting";
|
294 |
+
$args_notificationContent = array(
|
295 |
+
"media_buttons" => false,
|
296 |
+
"textarea_rows" => 3,
|
297 |
+
"teeny" => true,
|
298 |
+
"textarea_name" => "options[{$id_subscribe_without_commenting}]"
|
299 |
+
);
|
300 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_subscribe_without_commenting ), $id_subscribe_without_commenting, $args_notificationContent );
|
301 |
+
?>
|
302 |
+
</div>
|
303 |
+
</div>
|
304 |
+
|
305 |
+
<div class="form-group row">
|
306 |
+
<label for="subscription_confirmed" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
307 |
+
<?php _e( 'Subscription processed', 'subscribe-to-comments-reloaded' ) ?>
|
308 |
+
|
309 |
+
<div class="helpDescription subsOptDescriptions"
|
310 |
+
data-content="<?php _e( 'Thank you note shown after the subscription request has been processed (double check-in disabled). Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>"
|
311 |
+
data-placement="right"
|
312 |
+
aria-label="<?php _e( 'Thank you note shown after the subscription request has been processed (double check-in disabled). Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>">
|
313 |
+
<i class="fas fa-question-circle"></i>
|
314 |
+
</div>
|
315 |
+
|
316 |
+
</label>
|
317 |
+
<div class="clearfix"></div>
|
318 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
319 |
+
<?php
|
320 |
+
$id_subscription_confirmed = "subscription_confirmed";
|
321 |
+
$args_notificationContent = array(
|
322 |
+
"media_buttons" => false,
|
323 |
+
"textarea_rows" => 3,
|
324 |
+
"teeny" => true,
|
325 |
+
"textarea_name" => "options[{$id_subscription_confirmed}]"
|
326 |
+
);
|
327 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_subscription_confirmed ), $id_subscription_confirmed, $args_notificationContent );
|
328 |
+
?>
|
329 |
+
</div>
|
330 |
+
</div>
|
331 |
+
|
332 |
+
<div class="form-group row">
|
333 |
+
<label for="subscription_confirmed_dci" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
334 |
+
<?php _e( 'Subscription processed (DCI)', 'subscribe-to-comments-reloaded' ) ?>
|
335 |
+
|
336 |
+
<div class="helpDescription subsOptDescriptions"
|
337 |
+
data-content="<?php _e( 'Thank you note shown after the subscription request has been processed (double check-in enabled). Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>"
|
338 |
+
data-placement="right"
|
339 |
+
aria-label="<?php _e( 'Thank you note shown after the subscription request has been processed (double check-in enabled). Allowed tags: [post_title], [post_permalink]', 'subscribe-to-comments-reloaded' ); ?>">
|
340 |
+
<i class="fas fa-question-circle"></i>
|
341 |
+
</div>
|
342 |
+
|
343 |
+
</label>
|
344 |
+
<div class="clearfix"></div>
|
345 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
346 |
+
<?php
|
347 |
+
$id_subscription_confirmed_dci = "subscription_confirmed_dci";
|
348 |
+
$args_notificationContent = array(
|
349 |
+
"media_buttons" => false,
|
350 |
+
"textarea_rows" => 3,
|
351 |
+
"teeny" => true,
|
352 |
+
"textarea_name" => "options[{$id_subscription_confirmed_dci}]"
|
353 |
+
);
|
354 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_subscription_confirmed_dci ), $id_subscription_confirmed_dci, $args_notificationContent );
|
355 |
+
?>
|
356 |
+
</div>
|
357 |
+
</div>
|
358 |
+
|
359 |
+
<div class="form-group row">
|
360 |
+
<label for="author_text" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
361 |
+
<?php _e( 'Authors', 'subscribe-to-comments-reloaded' ) ?>
|
362 |
+
|
363 |
+
<div class="helpDescription subsOptDescriptions"
|
364 |
+
data-content="<?php _e( "Introductory text for the authors' management page.", 'subscribe-to-comments-reloaded' ); ?>"
|
365 |
+
data-placement="right"
|
366 |
+
aria-label="<?php _e( "Introductory text for the authors' management page.", 'subscribe-to-comments-reloaded' ); ?>">
|
367 |
+
<i class="fas fa-question-circle"></i>
|
368 |
+
</div>
|
369 |
+
|
370 |
+
</label>
|
371 |
+
<div class="clearfix"></div>
|
372 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
373 |
+
<?php
|
374 |
+
$id_author_text = "author_text";
|
375 |
+
$args_notificationContent = array(
|
376 |
+
"media_buttons" => false,
|
377 |
+
"textarea_rows" => 3,
|
378 |
+
"teeny" => true,
|
379 |
+
"textarea_name" => "options[{$id_author_text}]"
|
380 |
+
);
|
381 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_author_text ), $id_author_text, $args_notificationContent );
|
382 |
+
?>
|
383 |
+
</div>
|
384 |
+
</div>
|
385 |
+
|
386 |
+
<div class="form-group row">
|
387 |
+
<label for="user_text" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
388 |
+
<?php _e( 'Users', 'subscribe-to-comments-reloaded' ) ?>
|
389 |
+
|
390 |
+
<div class="helpDescription subsOptDescriptions"
|
391 |
+
data-content="<?php _e( "Introductory text for the users' management page.", 'subscribe-to-comments-reloaded' ); ?>"
|
392 |
+
data-placement="right"
|
393 |
+
aria-label="<?php _e( "Introductory text for the users' management page.", 'subscribe-to-comments-reloaded' ); ?>">
|
394 |
+
<i class="fas fa-question-circle"></i>
|
395 |
+
</div>
|
396 |
+
|
397 |
+
</label>
|
398 |
+
<div class="clearfix"></div>
|
399 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
400 |
+
<?php
|
401 |
+
$id_user_text = "user_text";
|
402 |
+
$args_notificationContent = array(
|
403 |
+
"media_buttons" => false,
|
404 |
+
"textarea_rows" => 3,
|
405 |
+
"teeny" => true,
|
406 |
+
"textarea_name" => "options[{$id_user_text}]"
|
407 |
+
);
|
408 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_user_text ), $id_user_text, $args_notificationContent );
|
409 |
+
?>
|
410 |
+
</div>
|
411 |
+
</div>
|
412 |
+
|
413 |
+
<div class="form-group row">
|
414 |
+
<div class="col-sm-9 offset-sm-1">
|
415 |
+
<button type="submit" class="btn btn-primary subscribe-form-button" name="Submit">
|
416 |
+
<?php _e( 'Save Changes', 'subscribe-to-comments-reloaded' ) ?>
|
417 |
+
</button>
|
418 |
+
</div>
|
419 |
+
</div>
|
420 |
+
|
421 |
+
<?php wp_nonce_field( 'stcr_save_management_page_nonce', 'stcr_save_management_page_nonce' ); ?>
|
422 |
+
|
423 |
+
</form>
|
424 |
+
</div>
|
425 |
+
|
426 |
+
<div class="col-md-3">
|
427 |
+
<div class="card card-font-size">
|
428 |
+
<div class="card-body">
|
429 |
+
<p>
|
430 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
431 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
432 |
+
</p>
|
433 |
+
<p>
|
434 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
435 |
+
</p>
|
436 |
+
</div>
|
437 |
+
</div>
|
438 |
+
</div>
|
439 |
+
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
|
443 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
444 |
+
<?php
|
445 |
+
global $wp_subscribe_reloaded;
|
446 |
+
// Tell WP that we are going to use a resource.
|
447 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-options", "subs_options.js", "includes/js/admin");
|
448 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-management-page", "management_page.js", "includes/js/admin");
|
449 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
450 |
+
//$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-subs-options", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
451 |
+
// Enqueue the JS File
|
452 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-options" );
|
453 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-management-page" );
|
454 |
+
|
455 |
+
?>
|
options/stcr_notifications.php
CHANGED
@@ -1,371 +1,385 @@
|
|
1 |
-
<?php
|
2 |
-
// Notifications
|
3 |
-
|
4 |
-
// Avoid direct access to this piece of code
|
5 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
-
header( 'Location: /' );
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
$options = array(
|
11 |
-
"from_name" => "text",
|
12 |
-
"from_email" => "email",
|
13 |
-
"reply_to" => "email",
|
14 |
-
"notification_subject" => "text",
|
15 |
-
"notification_content" => "text-html",
|
16 |
-
"double_check_subject" => "text",
|
17 |
-
"double_check_content" => "text-html",
|
18 |
-
"management_subject" => "text",
|
19 |
-
"management_content" => "text-html",
|
20 |
-
"management_email_content" => "text-html",
|
21 |
-
"oneclick_text" => "text-html"
|
22 |
-
);
|
23 |
-
|
24 |
-
// Update options
|
25 |
-
if ( isset( $_POST['options'] ) ) {
|
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 |
-
|
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 |
-
data-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
<
|
157 |
-
<?php
|
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 |
-
data-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
<
|
205 |
-
<?php
|
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 |
-
<?php
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
"
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
<
|
293 |
-
<?php
|
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 |
-
<?php
|
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 |
-
|
354 |
-
|
355 |
-
</
|
356 |
-
</div>
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
// Notifications
|
3 |
+
|
4 |
+
// Avoid direct access to this piece of code
|
5 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
+
header( 'Location: /' );
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
$options = array(
|
11 |
+
"from_name" => "text",
|
12 |
+
"from_email" => "email",
|
13 |
+
"reply_to" => "email",
|
14 |
+
"notification_subject" => "text",
|
15 |
+
"notification_content" => "text-html",
|
16 |
+
"double_check_subject" => "text",
|
17 |
+
"double_check_content" => "text-html",
|
18 |
+
"management_subject" => "text",
|
19 |
+
"management_content" => "text-html",
|
20 |
+
"management_email_content" => "text-html",
|
21 |
+
"oneclick_text" => "text-html"
|
22 |
+
);
|
23 |
+
|
24 |
+
// Update options
|
25 |
+
if ( isset( $_POST['options'] ) ) {
|
26 |
+
|
27 |
+
if ( empty( $_POST['stcr_save_notifications_nonce'] ) ) {
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_notifications_nonce'], 'stcr_save_notifications_nonce' ) ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
$faulty_fields = array();
|
40 |
+
|
41 |
+
foreach ( $_POST['options'] as $option => $value )
|
42 |
+
{
|
43 |
+
|
44 |
+
if ( $option === "notification_content" )
|
45 |
+
{
|
46 |
+
if ( trim( $value ) === "" &&
|
47 |
+
! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, "<h1>There is a new comment on [post_title].</h1><hr><p><strong>Comment link:</strong> <a href=\"[comment_permalink]\" data-mce-href=\"[comment_permalink]\">[comment_permalink]</a> <br><strong>Author:</strong> [comment_author]</p><p><strong>Comment:</strong><br>[comment_content]</p><div style=\"font-size: 0.8em\" data-mce-style=\"font-size: 0.8em;\"><strong>Permalink:</strong> <a href=\"[post_permalink]\" data-mce-href=\"[post_permalink]\">[post_permalink]</a><br><a href=\"[manager_link]\" data-mce-href=\"[manager_link]\">Manage your subscriptions</a> | <a href=\"[oneclick_link]\" data-mce-href=\"[oneclick_link]\">One click unsubscribe</a></div>", $options[$option] ) )
|
48 |
+
{
|
49 |
+
array_push( $faulty_fields, $option );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( trim( $value ) !== "" &&
|
53 |
+
! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
54 |
+
{
|
55 |
+
array_push( $faulty_fields, $option );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
elseif ( ! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
59 |
+
{
|
60 |
+
array_push( $faulty_fields, $option );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
// Display an alert in the admin interface if something went wrong
|
65 |
+
echo '<div class="updated"><p>';
|
66 |
+
if ( sizeof( $faulty_fields ) == 0 ) {
|
67 |
+
_e( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
68 |
+
} else {
|
69 |
+
_e( 'There was an error updating the options.', 'subscribe-to-comments-reloaded' );
|
70 |
+
// echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
|
71 |
+
}
|
72 |
+
echo "</p></div>";
|
73 |
+
}
|
74 |
+
wp_print_scripts( 'quicktags' );
|
75 |
+
|
76 |
+
?>
|
77 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
78 |
+
|
79 |
+
<div class="container-fluid">
|
80 |
+
<div class="mt-3"></div>
|
81 |
+
<div class="row">
|
82 |
+
<div class="col-sm-9">
|
83 |
+
<form action="" method="post">
|
84 |
+
|
85 |
+
<div class="form-group row">
|
86 |
+
<label for="from_name" class="col-sm-3 col-form-label text-right">
|
87 |
+
<?php _e( 'Sender email address', 'subscribe-to-comments-reloaded' ) ?></label>
|
88 |
+
<div class="col-sm-7">
|
89 |
+
<input type="text" name="options[from_name]" id="from_name"
|
90 |
+
class="form-control form-control-input-8"
|
91 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'from_name' ) ); ?>" size="20">
|
92 |
+
|
93 |
+
<div class="helpDescription subsOptDescriptions"
|
94 |
+
data-content="<?php esc_attr_e( "Name to use for the 'from' field when sending a new notification to the user.", 'subscribe-to-comments-reloaded' ); ?>"
|
95 |
+
data-placement="right"
|
96 |
+
aria-label="<?php esc_attr_e( "Name to use for the 'from' field when sending a new notification to the user.", 'subscribe-to-comments-reloaded' ); ?>">
|
97 |
+
<i class="fas fa-question-circle"></i>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
<div class="form-group row">
|
103 |
+
<label for="from_email" class="col-sm-3 col-form-label text-right">
|
104 |
+
<?php _e( 'Sender email address', 'subscribe-to-comments-reloaded' ) ?></label>
|
105 |
+
<div class="col-sm-7">
|
106 |
+
<input type="text" name="options[from_email]" id="from_email"
|
107 |
+
class="form-control form-control-input-8"
|
108 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'from_email' ) ); ?>" size="20">
|
109 |
+
|
110 |
+
<div class="helpDescription subsOptDescriptions"
|
111 |
+
data-content="<?php esc_attr_e( "Email address to use for the \"from\" field when sending a new notification to the user.", 'subscribe-to-comments-reloaded' ); ?>"
|
112 |
+
data-placement="right"
|
113 |
+
aria-label="<?php esc_attr_e( "Email address to use for the \"from\" field when sending a new notification to the user.", 'subscribe-to-comments-reloaded' ); ?>">
|
114 |
+
<i class="fas fa-question-circle"></i>
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<div class="form-group row">
|
120 |
+
<label for="reply_to" class="col-sm-3 col-form-label text-right">
|
121 |
+
<?php _e( 'Reply To', 'subscribe-to-comments-reloaded' ) ?></label>
|
122 |
+
<div class="col-sm-7">
|
123 |
+
<input type="text" name="options[reply_to]" id="reply_to"
|
124 |
+
class="form-control form-control-input-8"
|
125 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'reply_to' ) ); ?>" size="20">
|
126 |
+
|
127 |
+
<div class="helpDescription subsOptDescriptions"
|
128 |
+
data-content="<?php esc_attr_e( "This will be use when the user click reply on their email agent. If not set it will be the same as the Sender email address.", 'subscribe-to-comments-reloaded' ); ?>"
|
129 |
+
data-placement="right"
|
130 |
+
aria-label="<?php esc_attr_e( "This will be use when the user click reply on their email agent. If not set it will be the same as the Sender email address.", 'subscribe-to-comments-reloaded' ); ?>">
|
131 |
+
<i class="fas fa-question-circle"></i>
|
132 |
+
</div>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
|
136 |
+
<h3><?php _e( 'Messages', 'subscribe-to-comments-reloaded' ) ?></h3>
|
137 |
+
|
138 |
+
<div class="form-group row">
|
139 |
+
<label for="notification_subject" class="col-sm-3 col-form-label text-right">
|
140 |
+
<?php _e( 'Notification subject', 'subscribe-to-comments-reloaded' ) ?></label>
|
141 |
+
<div class="col-sm-7">
|
142 |
+
<input type="text" name="options[notification_subject]" id="notification_subject"
|
143 |
+
class="form-control form-control-input-8"
|
144 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'notification_subject' ) ); ?>" size="20">
|
145 |
+
|
146 |
+
<div class="helpDescription subsOptDescriptions"
|
147 |
+
data-content="<?php esc_attr_e( "Subject of the notification email. Allowed tag: [post_title]", 'subscribe-to-comments-reloaded' ); ?>"
|
148 |
+
data-placement="right"
|
149 |
+
aria-label="<?php esc_attr_e( "Subject of the notification email. Allowed tag: [post_title]", 'subscribe-to-comments-reloaded' ); ?>">
|
150 |
+
<i class="fas fa-question-circle"></i>
|
151 |
+
</div>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
|
155 |
+
<div class="form-group row">
|
156 |
+
<label for="notification_content" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
157 |
+
<?php _e( 'Notification message', 'subscribe-to-comments-reloaded' ) ?>
|
158 |
+
|
159 |
+
<div class="helpDescription subsOptDescriptions"
|
160 |
+
data-content="<?php esc_attr_e( "Content of the notification email. Allowed tags: [post_title], [comment_permalink], [comment_author], [comment_content], [post_permalink], [manager_link], [comment_gravatar]<p style='color: #156dc7;'><strong>Note: To get a default template clear all the content and save the options.</strong></p>", 'subscribe-to-comments-reloaded' ); ?>"
|
161 |
+
data-placement="right"
|
162 |
+
aria-label="<?php esc_attr_e( "Content of the notification email. Allowed tags: [post_title], [comment_permalink], [comment_author], [comment_content], [post_permalink], [manager_link], [comment_gravatar]<p style='color: #156dc7;'><strong>Note: To get a default template clear all the content and save the options.</strong></p>", 'subscribe-to-comments-reloaded' ); ?>">
|
163 |
+
<i class="fas fa-question-circle"></i>
|
164 |
+
</div>
|
165 |
+
|
166 |
+
</label>
|
167 |
+
<div class="clearfix"></div>
|
168 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
169 |
+
<?php
|
170 |
+
$id_notification_content = "notification_content";
|
171 |
+
$args_notificationContent = array(
|
172 |
+
"media_buttons" => false,
|
173 |
+
"textarea_rows" => 15,
|
174 |
+
"teeny" => true,
|
175 |
+
"textarea_name" => "options[$id_notification_content]"
|
176 |
+
// "tinymce" => array(
|
177 |
+
// "theme_advance_buttons1" => "bold, italic, ul, min_size, max_size"
|
178 |
+
// )
|
179 |
+
);
|
180 |
+
|
181 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_notification_content ), $id_notification_content, $args_notificationContent );
|
182 |
+
?>
|
183 |
+
</div>
|
184 |
+
</div>
|
185 |
+
|
186 |
+
<div class="form-group row">
|
187 |
+
<label for="double_check_subject" class="col-sm-3 col-form-label text-right">
|
188 |
+
<?php _e( 'Double check subject', 'subscribe-to-comments-reloaded' ) ?></label>
|
189 |
+
<div class="col-sm-7">
|
190 |
+
<input type="text" name="options[double_check_subject]" id="double_check_subject"
|
191 |
+
class="form-control form-control-input-8"
|
192 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'double_check_subject' ) ); ?>" size="20">
|
193 |
+
|
194 |
+
<div class="helpDescription subsOptDescriptions"
|
195 |
+
data-content="<?php esc_attr_e( "Subject of the confirmation email. Allowed tag: [post_title]", 'subscribe-to-comments-reloaded' ); ?>"
|
196 |
+
data-placement="right"
|
197 |
+
aria-label="<?php esc_attr_e( "Subject of the confirmation email. Allowed tag: [post_title]", 'subscribe-to-comments-reloaded' ); ?>">
|
198 |
+
<i class="fas fa-question-circle"></i>
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
|
203 |
+
<div class="form-group row">
|
204 |
+
<label for="double_check_content" class="col-sm-3 offset-sm-1 col-form-label" style="z-index: 9999;">
|
205 |
+
<?php _e( 'Double check message', 'subscribe-to-comments-reloaded' ) ?>
|
206 |
+
|
207 |
+
<div class="helpDescription subsOptDescriptions"
|
208 |
+
data-content="<?php esc_attr_e( "Content of the confirmation email. Allowed tags: [post_permalink], [confirm_link], [post_title], [manager_link]", 'subscribe-to-comments-reloaded' ); ?>"
|
209 |
+
data-placement="right"
|
210 |
+
aria-label="<?php esc_attr_e( "Content of the confirmation email. Allowed tags: [post_permalink], [confirm_link], [post_title], [manager_link]", 'subscribe-to-comments-reloaded' ); ?>">
|
211 |
+
<i class="fas fa-question-circle"></i>
|
212 |
+
</div>
|
213 |
+
|
214 |
+
</label>
|
215 |
+
<div class="clearfix"></div>
|
216 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
217 |
+
<?php
|
218 |
+
$id_double_check_content = "double_check_content";
|
219 |
+
$args_notificationContent = array(
|
220 |
+
"media_buttons" => false,
|
221 |
+
"textarea_rows" => 7,
|
222 |
+
"teeny" => true,
|
223 |
+
"textarea_name" => "options[{$id_double_check_content}]"
|
224 |
+
);
|
225 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_double_check_content ), $id_double_check_content, $args_notificationContent );
|
226 |
+
?>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
|
230 |
+
<div class="form-group row">
|
231 |
+
<label for="management_subject" class="col-sm-3 col-form-label text-right">
|
232 |
+
<?php _e( 'Management subject', 'subscribe-to-comments-reloaded' ) ?></label>
|
233 |
+
<div class="col-sm-7">
|
234 |
+
<input type="text" name="options[management_subject]" id="management_subject"
|
235 |
+
class="form-control form-control-input-8"
|
236 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'management_subject' ) ); ?>" size="20">
|
237 |
+
|
238 |
+
<div class="helpDescription subsOptDescriptions"
|
239 |
+
data-content="<?php esc_attr_e( "Subject of the mail sent to those who request to access their management page. Allowed tag: [blog_name]", 'subscribe-to-comments-reloaded' ); ?>"
|
240 |
+
data-placement="right"
|
241 |
+
aria-label="<?php esc_attr_e( "Subject of the mail sent to those who request to access their management page. Allowed tag: [blog_name]", 'subscribe-to-comments-reloaded' ); ?>">
|
242 |
+
<i class="fas fa-question-circle"></i>
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
+
</div>
|
246 |
+
|
247 |
+
<?php
|
248 |
+
$disallowed_tags = array();
|
249 |
+
$management_page_message = $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'management_content' );
|
250 |
+
if ( empty( $management_page_message ) ) { $management_page_message = ''; }
|
251 |
+
if ( strpos( $management_page_message, '[manager_link]' ) ) {
|
252 |
+
$disallowed_tags['manager_link'] = __( '[manager_link] tag only works for "Management Email message". It is a private link that takes to a management page and for security reasons has to be sent to the email address.', 'subscribe-to-comments-reloaded' );
|
253 |
+
}
|
254 |
+
?>
|
255 |
+
<div class="form-group row">
|
256 |
+
<label for="management_content" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
257 |
+
<?php _e( 'Management Page message', 'subscribe-to-comments-reloaded' ) ?>
|
258 |
+
|
259 |
+
<div class="helpDescription subsOptDescriptions"
|
260 |
+
data-content="<?php esc_attr_e( "Content of the management Page message. Allowed tags: [blog_name].", 'subscribe-to-comments-reloaded' ); ?>"
|
261 |
+
data-placement="right"
|
262 |
+
aria-label="<?php esc_attr_e( "Content of the management Page message. Allowed tags: [blog_name].", 'subscribe-to-comments-reloaded' ); ?>">
|
263 |
+
<i class="fas fa-question-circle"></i>
|
264 |
+
</div>
|
265 |
+
</label>
|
266 |
+
<div class="clearfix"></div>
|
267 |
+
<div class="col-sm-9 offset-sm-1" <?php if ( empty( $disallowed_tags ) ) { echo 'style="margin-top:-30px;"'; } ?>>
|
268 |
+
|
269 |
+
<?php if ( ! empty( $disallowed_tags ) ) : ?>
|
270 |
+
<p class="notice notice-error" style="margin: 0;padding:8px;">
|
271 |
+
<?php foreach ( $disallowed_tags as $disallowed_tag_id => $disallowed_tag_message ) : ?>
|
272 |
+
<?php echo $disallowed_tag_message; ?>
|
273 |
+
<?php endforeach; ?>
|
274 |
+
</ul>
|
275 |
+
</p>
|
276 |
+
<?php endif; ?>
|
277 |
+
|
278 |
+
<?php
|
279 |
+
$id_management_content = "management_content";
|
280 |
+
$args_notificationContent = array(
|
281 |
+
"media_buttons" => false,
|
282 |
+
"textarea_rows" => 5,
|
283 |
+
"teeny" => true,
|
284 |
+
"textarea_name" => "options[{$id_management_content}]"
|
285 |
+
);
|
286 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_management_content ), $id_management_content, $args_notificationContent );
|
287 |
+
?>
|
288 |
+
</div>
|
289 |
+
</div>
|
290 |
+
|
291 |
+
<div class="form-group row">
|
292 |
+
<label for="management_email_content" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
293 |
+
<?php _e( 'Management Email message', 'subscribe-to-comments-reloaded' ) ?>
|
294 |
+
|
295 |
+
<div class="helpDescription subsOptDescriptions"
|
296 |
+
data-content="<?php esc_attr_e( "Content of the management email message. Allowed tags: [blog_name], [manager_link].", 'subscribe-to-comments-reloaded' ); ?>"
|
297 |
+
data-placement="right"
|
298 |
+
aria-label="<?php esc_attr_e( "Content of the management email message. Allowed tags: [blog_name], [manager_link].", 'subscribe-to-comments-reloaded' ); ?>">
|
299 |
+
<i class="fas fa-question-circle"></i>
|
300 |
+
</div>
|
301 |
+
|
302 |
+
</label>
|
303 |
+
<div class="clearfix"></div>
|
304 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
305 |
+
<?php
|
306 |
+
$id_management_email_content = "management_email_content";
|
307 |
+
$args_notificationContent = array(
|
308 |
+
"media_buttons" => false,
|
309 |
+
"textarea_rows" => 5,
|
310 |
+
"teeny" => true,
|
311 |
+
"textarea_name" => "options[{$id_management_email_content}]"
|
312 |
+
);
|
313 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_management_email_content ), $id_management_email_content, $args_notificationContent );
|
314 |
+
?>
|
315 |
+
</div>
|
316 |
+
</div>
|
317 |
+
|
318 |
+
<div class="form-group row">
|
319 |
+
<label for="oneclick_text" class="col-sm-4 offset-sm-1 col-form-label" style="z-index: 9999;">
|
320 |
+
<?php _e( 'One Click Unsubscribe', 'subscribe-to-comments-reloaded' ) ?>
|
321 |
+
|
322 |
+
<div class="helpDescription subsOptDescriptions"
|
323 |
+
data-content="<?php esc_attr_e( "Content of the One Click confirmation. Allowed tags: [post_title], [blog_name].", 'subscribe-to-comments-reloaded' ); ?>"
|
324 |
+
data-placement="right"
|
325 |
+
aria-label="<?php esc_attr_e( "Content of the One Click confirmation. Allowed tags: [post_title], [blog_name].", 'subscribe-to-comments-reloaded' ); ?>">
|
326 |
+
<i class="fas fa-question-circle"></i>
|
327 |
+
</div>
|
328 |
+
|
329 |
+
</label>
|
330 |
+
<div class="clearfix"></div>
|
331 |
+
<div class="col-sm-9 offset-sm-1" style="margin-top: -30px;">
|
332 |
+
<?php
|
333 |
+
$id_oneclick_text = "oneclick_text";
|
334 |
+
$args_notificationContent = array(
|
335 |
+
"media_buttons" => false,
|
336 |
+
"textarea_rows" => 5,
|
337 |
+
"teeny" => true,
|
338 |
+
"textarea_name" => "options[{$id_oneclick_text}]"
|
339 |
+
);
|
340 |
+
wp_editor( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( $id_oneclick_text ), $id_oneclick_text, $args_notificationContent );
|
341 |
+
?>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
|
345 |
+
<div class="form-group row">
|
346 |
+
<div class="col-sm-9 offset-sm-1">
|
347 |
+
<button type="submit" class="btn btn-primary subscribe-form-button" name="Submit">
|
348 |
+
<?php _e( 'Save Changes', 'subscribe-to-comments-reloaded' ) ?>
|
349 |
+
</button>
|
350 |
+
</div>
|
351 |
+
</div>
|
352 |
+
|
353 |
+
<?php wp_nonce_field( 'stcr_save_notifications_nonce', 'stcr_save_notifications_nonce' ); ?>
|
354 |
+
|
355 |
+
</form>
|
356 |
+
</div>
|
357 |
+
|
358 |
+
<div class="col-md-3">
|
359 |
+
<div class="card card-font-size">
|
360 |
+
<div class="card-body">
|
361 |
+
<p>
|
362 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
363 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
364 |
+
</p>
|
365 |
+
<p>
|
366 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
367 |
+
</p>
|
368 |
+
</div>
|
369 |
+
</div>
|
370 |
+
</div>
|
371 |
+
|
372 |
+
</div>
|
373 |
+
</div>
|
374 |
+
|
375 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
376 |
+
<?php
|
377 |
+
//global $wp_subscribe_reloaded;
|
378 |
+
// Tell WP that we are going to use a resource.
|
379 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-options", "subs_options.js", "includes/js/admin");
|
380 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
381 |
+
//$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-subs-options", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
382 |
+
// Enqueue the JS File
|
383 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-options" );
|
384 |
+
|
385 |
+
?>
|
options/stcr_options.php
CHANGED
@@ -1,727 +1,827 @@
|
|
1 |
-
<?php
|
2 |
-
// Options
|
3 |
-
|
4 |
-
// Avoid direct access to this piece of code
|
5 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
-
header( 'Location: /' );
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
$options = array(
|
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 |
-
|
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 |
-
data-
|
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 |
-
data-
|
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 |
-
<div class="
|
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 |
-
<div class="
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
<
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
<div class="
|
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 |
-
<div class="
|
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 |
-
<div class="
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
<
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
<div class="
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
<
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
<div class="
|
392 |
-
|
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 |
-
<div class="
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
<
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
<div class="
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
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 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
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 |
-
data-
|
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 |
-
data-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
data-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
data-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
<div class="col-sm-7">
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
<
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
// Options
|
3 |
+
|
4 |
+
// Avoid direct access to this piece of code
|
5 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
+
header( 'Location: /' );
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
$options = array(
|
11 |
+
'show_subscription_box' => 'yesno',
|
12 |
+
'safely_uninstall' => 'yesno',
|
13 |
+
'purge_days' => 'integer',
|
14 |
+
'date_format' => 'text',
|
15 |
+
'stcr_position' => 'yesno',
|
16 |
+
'enable_double_check' => 'yesno',
|
17 |
+
'notify_authors' => 'yesno',
|
18 |
+
'enable_html_emails' => 'yesno',
|
19 |
+
'process_trackbacks' => 'yesno',
|
20 |
+
'enable_admin_messages' => 'yesno',
|
21 |
+
'admin_subscribe' => 'yesno',
|
22 |
+
'admin_bcc' => 'yesno',
|
23 |
+
'enable_font_awesome' => 'yesno',
|
24 |
+
'delete_options_subscriptions' => 'yesno',
|
25 |
+
'only_for_logged_in' => 'yesno',
|
26 |
+
'use_cookies' => 'yesno',
|
27 |
+
'use_challenge_question' => 'yesno',
|
28 |
+
'challenge_question' => 'text',
|
29 |
+
'challenge_answer' => 'text',
|
30 |
+
'use_captcha' => 'yesno',
|
31 |
+
'captcha_site_key' => 'text',
|
32 |
+
'captcha_secret_key' => 'text',
|
33 |
+
'unique_key' => '',
|
34 |
+
'recaptcha_version' => 'select',
|
35 |
+
'blacklisted_emails' => 'textarea',
|
36 |
+
'post_type_supports' => 'multicheck',
|
37 |
+
);
|
38 |
+
|
39 |
+
if ( array_key_exists( "generate_key", $_POST ) ) {
|
40 |
+
|
41 |
+
if ( empty( $_POST['stcr_save_options_nonce'] ) ) {
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_options_nonce'], 'stcr_save_options_nonce' ) ) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
$unique_key = $wp_subscribe_reloaded->stcr->utils->generate_key();
|
54 |
+
$wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( 'unique_key', $unique_key, 'text' );
|
55 |
+
|
56 |
+
echo '<div class="updated"><p>';
|
57 |
+
echo __( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
58 |
+
echo "</p></div>";
|
59 |
+
|
60 |
+
} elseif ( array_key_exists( "reset_all_options", $_POST ) ) {
|
61 |
+
|
62 |
+
if ( empty( $_POST['stcr_save_options_nonce'] ) ) {
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_options_nonce'], 'stcr_save_options_nonce' ) ) {
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
$delete_subscriptions_selection = $_POST['options']['delete_options_subscriptions'];
|
75 |
+
$deletion_result = $wp_subscribe_reloaded->stcr->utils->delete_all_settings( $delete_subscriptions_selection );
|
76 |
+
|
77 |
+
if( $deletion_result )
|
78 |
+
{
|
79 |
+
// Restore settings
|
80 |
+
$wp_subscribe_reloaded->stcr->utils->create_options();
|
81 |
+
}
|
82 |
+
} elseif( isset( $_POST['options'] ) ) { // Update options
|
83 |
+
|
84 |
+
if ( empty( $_POST['stcr_save_options_nonce'] ) ) {
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_options_nonce'], 'stcr_save_options_nonce' ) ) {
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
|
96 |
+
$faulty_fields = array();
|
97 |
+
|
98 |
+
foreach ( $_POST['options'] as $option => $value )
|
99 |
+
{
|
100 |
+
// echo $option . '<br>';
|
101 |
+
|
102 |
+
if ( ! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
103 |
+
{
|
104 |
+
array_push( $faulty_fields, $option );
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
// Display an alert in the admin interface if something went wrong
|
109 |
+
echo '<div class="updated"><p>';
|
110 |
+
if ( sizeof( $faulty_fields ) == 0 ) {
|
111 |
+
_e( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
112 |
+
} else {
|
113 |
+
_e( 'There was an error updating the options.', 'subscribe-to-comments-reloaded' );
|
114 |
+
// echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
|
115 |
+
}
|
116 |
+
echo "</p></div>";
|
117 |
+
}
|
118 |
+
wp_print_scripts( 'quicktags' );
|
119 |
+
|
120 |
+
?>
|
121 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
122 |
+
|
123 |
+
<div class="container-fluid">
|
124 |
+
<div class="mt-3"></div>
|
125 |
+
<div class="row">
|
126 |
+
<div class="col-sm-9">
|
127 |
+
<form action="" method="post">
|
128 |
+
|
129 |
+
<div class="form-group row" style="margin-bottom: 0;">
|
130 |
+
<label for="show_subscription_box" class="col-sm-3 col-form-label text-right"><?php _e( 'Show StCR checkbox / dropdown', 'subscribe-to-comments-reloaded' ) ?></label>
|
131 |
+
<div class="col-sm-7">
|
132 |
+
<div class="switch">
|
133 |
+
<input type="radio" class="switch-input" name="options[show_subscription_box]"
|
134 |
+
value="yes" id="show_subscription_box-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'show_subscription_box' ) == 'yes' ) ? ' checked' : ''; ?> />
|
135 |
+
<label for="show_subscription_box-yes" class="switch-label switch-label-off">
|
136 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
137 |
+
</label>
|
138 |
+
<input type="radio" class="switch-input" name="options[show_subscription_box]" value="no" id="show_subscription_box-no"
|
139 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'show_subscription_box' ) == 'no' ) ? ' checked' : ''; ?> />
|
140 |
+
<label for="show_subscription_box-no" class="switch-label switch-label-on">
|
141 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
142 |
+
</label>
|
143 |
+
<span class="switch-selection"></span>
|
144 |
+
</div>
|
145 |
+
<div class="helpDescription subsOptDescriptions"
|
146 |
+
data-content="<?php _e( "This option will disable the StCR checkbox or dropdown in your comment form. You should leave it to Yes always.", 'subscribe-to-comments-reloaded' ); ?>"
|
147 |
+
data-placement="right"
|
148 |
+
aria-label="<?php _e( "This option will disable the StCR checkbox or dropdown in your comment form. You should leave it to Yes always.", 'subscribe-to-comments-reloaded' ); ?>">
|
149 |
+
<i class="fas fa-question-circle"></i>
|
150 |
+
</div>
|
151 |
+
</div>
|
152 |
+
</div>
|
153 |
+
|
154 |
+
<div class="form-group row">
|
155 |
+
<label for="safely_uninstall" class="col-sm-3 col-form-label text-right"><?php _e( 'Safely Uninstall', 'subscribe-to-comments-reloaded' ) ?></label>
|
156 |
+
<div class="col-sm-7">
|
157 |
+
<div class="switch">
|
158 |
+
<input type="radio" class="switch-input" name="options[safely_uninstall]"
|
159 |
+
value="yes" id="safely_uninstall-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'safely_uninstall' ) == 'yes' ) ? ' checked' : ''; ?> />
|
160 |
+
<label for="safely_uninstall-yes" class="switch-label switch-label-off">
|
161 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
162 |
+
</label>
|
163 |
+
<input type="radio" class="switch-input" name="options[safely_uninstall]" value="no" id="safely_uninstall-no"
|
164 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'safely_uninstall' ) == 'no' ) ? ' checked' : ''; ?> />
|
165 |
+
<label for="safely_uninstall-no" class="switch-label switch-label-on">
|
166 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
167 |
+
</label>
|
168 |
+
<span class="switch-selection"></span>
|
169 |
+
</div>
|
170 |
+
<div class="helpDescription subsOptDescriptions"
|
171 |
+
data-content="<?php _e( "This option will allow you to delete the plugin with WordPress without loosing your subscribers. Any database table and plugin options are wipeout.", 'subscribe-to-comments-reloaded' ); ?>"
|
172 |
+
data-placement="right"
|
173 |
+
aria-label="<?php _e( "This option will allow you to delete the plugin with WordPress without loosing your subscribers. Any database table and plugin options are wipeout.", 'subscribe-to-comments-reloaded' ); ?>">
|
174 |
+
<i class="fas fa-question-circle"></i>
|
175 |
+
</div>
|
176 |
+
</div>
|
177 |
+
</div>
|
178 |
+
|
179 |
+
<div class="form-group row">
|
180 |
+
<label for="purge_days" class="col-sm-3 col-form-label text-right">
|
181 |
+
<?php _e( 'Autopurge requests', 'subscribe-to-comments-reloaded' ) ?></label>
|
182 |
+
<div class="col-sm-7">
|
183 |
+
<input type="number" name="options[purge_days]" id="purge_days"
|
184 |
+
class="form-control form-control-input-3"
|
185 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'purge_days' ) ); ?>" size="20">
|
186 |
+
|
187 |
+
<div class="helpDescription subsOptDescriptions"
|
188 |
+
data-content="<?php _e( "Delete pending subscriptions (not confirmed) after X days. Zero disables this feature.", 'subscribe-to-comments-reloaded' ); ?>"
|
189 |
+
data-placement="right"
|
190 |
+
aria-label="<?php _e( "Delete pending subscriptions (not confirmed) after X days. Zero disables this feature.", 'subscribe-to-comments-reloaded' ); ?>">
|
191 |
+
<i class="fas fa-question-circle"></i>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
|
196 |
+
<div class="form-group row">
|
197 |
+
<label for="date_format" class="col-sm-3 col-form-label text-right">
|
198 |
+
<?php _e( 'Date Format', 'subscribe-to-comments-reloaded' ) ?></label>
|
199 |
+
<div class="col-sm-7">
|
200 |
+
<input type="text" name="options[date_format]" id="date_format"
|
201 |
+
class="form-control form-control-input-3"
|
202 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'date_format' ) ); ?>" size="20">
|
203 |
+
|
204 |
+
<div class="helpDescription subsOptDescriptions"
|
205 |
+
data-content="<?php _e( "Date format that will be display on the management page. Use <a href='https://secure.php.net/manual/en/function.date.php#refsect1-function.date-parameters' target='_blank'>PHP Date Format</a>", 'subscribe-to-comments-reloaded' ); ?>"
|
206 |
+
data-placement="right"
|
207 |
+
aria-label="<?php _e( "Date format that will be display on the management page. Use <a href='https://secure.php.net/manual/en/function.date.php#refsect1-function.date-parameters' target='_blank'>PHP Date Format</a>", 'subscribe-to-comments-reloaded' ); ?>">
|
208 |
+
<i class="fas fa-question-circle"></i>
|
209 |
+
</div>
|
210 |
+
</div>
|
211 |
+
</div>
|
212 |
+
|
213 |
+
<div class="form-group row">
|
214 |
+
<label for="stcr_position" class="col-sm-3 col-form-label text-right"><?php _e( 'StCR Position', 'subscribe-to-comments-reloaded' ) ?></label>
|
215 |
+
<div class="col-sm-7">
|
216 |
+
<div class="switch">
|
217 |
+
<input type="radio" class="switch-input" name="options[stcr_position]"
|
218 |
+
value="yes" id="stcr_position-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'stcr_position' ) == 'yes' ) ? ' checked' : ''; ?> />
|
219 |
+
<label for="stcr_position-yes" class="switch-label switch-label-off">
|
220 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
221 |
+
</label>
|
222 |
+
<input type="radio" class="switch-input" name="options[stcr_position]" value="no" id="stcr_position-no"
|
223 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'stcr_position' ) == 'no' ) ? ' checked' : ''; ?> />
|
224 |
+
<label for="stcr_position-no" class="switch-label switch-label-on">
|
225 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
226 |
+
</label>
|
227 |
+
<span class="switch-selection"></span>
|
228 |
+
</div>
|
229 |
+
<div class="helpDescription subsOptDescriptions"
|
230 |
+
data-content="<?php _e( "If this option is enable the subscription box will be above the submit button in your comment form. Use this when your theme is outdated and using the incorrect WordPress Hooks and the checkbox is not displayed.", 'subscribe-to-comments-reloaded' ); ?>"
|
231 |
+
data-placement="right"
|
232 |
+
aria-label="<?php _e( "If this option is enable the subscription box will be above the submit button in your comment form. Use this when your theme is outdated and using the incorrect WordPress Hooks and the checkbox is not displayed.", 'subscribe-to-comments-reloaded' ); ?>">
|
233 |
+
<i class="fas fa-question-circle"></i>
|
234 |
+
</div>
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
|
238 |
+
<div class="form-group row">
|
239 |
+
<label for="enable_double_check" class="col-sm-3 col-form-label text-right">
|
240 |
+
<?php _e( 'Enable double check', 'subscribe-to-comments-reloaded' ) ?>
|
241 |
+
</label>
|
242 |
+
<div class="col-sm-7">
|
243 |
+
<div class="switch">
|
244 |
+
<input type="radio" class="switch-input" name="options[enable_double_check]"
|
245 |
+
value="yes" id="enable_double_check-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_double_check' ) == 'yes' ) ? ' checked' : ''; ?> />
|
246 |
+
<label for="enable_double_check-yes" class="switch-label switch-label-off">
|
247 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
248 |
+
</label>
|
249 |
+
<input type="radio" class="switch-input" name="options[enable_double_check]" value="no" id="enable_double_check-no"
|
250 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_double_check' ) == 'no' ) ? ' checked' : ''; ?> />
|
251 |
+
<label for="enable_double_check-no" class="switch-label switch-label-on">
|
252 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
253 |
+
</label>
|
254 |
+
<span class="switch-selection"></span>
|
255 |
+
</div>
|
256 |
+
<div class="helpDescription subsOptDescriptions"
|
257 |
+
data-content="<?php _e( "Send a notification email to confirm the subscription (to avoid addresses misuse).", 'subscribe-to-comments-reloaded' ); ?>"
|
258 |
+
data-placement="right"
|
259 |
+
aria-label="<?php _e( "Send a notification email to confirm the subscription (to avoid addresses misuse).", 'subscribe-to-comments-reloaded' ); ?>">
|
260 |
+
<i class="fas fa-question-circle"></i>
|
261 |
+
</div>
|
262 |
+
</div>
|
263 |
+
</div>
|
264 |
+
|
265 |
+
<div class="form-group row">
|
266 |
+
<label for="notify_authors" class="col-sm-3 col-form-label text-right">
|
267 |
+
<?php _e( 'Subscribe authors', 'subscribe-to-comments-reloaded' ) ?>
|
268 |
+
</label>
|
269 |
+
<div class="col-sm-7">
|
270 |
+
<div class="switch">
|
271 |
+
<input type="radio" class="switch-input" name="options[notify_authors]"
|
272 |
+
value="yes" id="notify_authors-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'notify_authors' ) == 'yes' ) ? ' checked' : ''; ?> />
|
273 |
+
<label for="notify_authors-yes" class="switch-label switch-label-off">
|
274 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
275 |
+
</label>
|
276 |
+
<input type="radio" class="switch-input" name="options[notify_authors]" value="no" id="notify_authors-no"
|
277 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'notify_authors' ) == 'no' ) ? ' checked' : ''; ?> />
|
278 |
+
<label for="notify_authors-no" class="switch-label switch-label-on">
|
279 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
280 |
+
</label>
|
281 |
+
<span class="switch-selection"></span>
|
282 |
+
</div>
|
283 |
+
<div class="helpDescription subsOptDescriptions"
|
284 |
+
data-content="<?php _e( "Automatically subscribe authors to their own articles (not retroactive).", 'subscribe-to-comments-reloaded' ); ?>"
|
285 |
+
data-placement="right"
|
286 |
+
aria-label="<?php _e( "Automatically subscribe authors to their own articles (not retroactive).", 'subscribe-to-comments-reloaded' ); ?>">
|
287 |
+
<i class="fas fa-question-circle"></i>
|
288 |
+
</div>
|
289 |
+
</div>
|
290 |
+
</div>
|
291 |
+
|
292 |
+
<div class="form-group row">
|
293 |
+
<label for="enable_html_emails" class="col-sm-3 col-form-label text-right">
|
294 |
+
<?php _e( 'Enable HTML emails', 'subscribe-to-comments-reloaded' ) ?>
|
295 |
+
</label>
|
296 |
+
<div class="col-sm-7">
|
297 |
+
<div class="switch">
|
298 |
+
<input type="radio" class="switch-input" name="options[enable_html_emails]"
|
299 |
+
value="yes" id="enable_html_emails-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_html_emails' ) == 'yes' ) ? ' checked' : ''; ?> />
|
300 |
+
<label for="enable_html_emails-yes" class="switch-label switch-label-off">
|
301 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
302 |
+
</label>
|
303 |
+
<input type="radio" class="switch-input" name="options[enable_html_emails]" value="no" id="enable_html_emails-no"
|
304 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_html_emails' ) == 'no' ) ? ' checked' : ''; ?> />
|
305 |
+
<label for="enable_html_emails-no" class="switch-label switch-label-on">
|
306 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
307 |
+
</label>
|
308 |
+
<span class="switch-selection"></span>
|
309 |
+
</div>
|
310 |
+
<div class="helpDescription subsOptDescriptions"
|
311 |
+
data-content="<?php _e( "If enabled, will send email messages with content-type = text/html instead of text/plain", 'subscribe-to-comments-reloaded' ); ?>"
|
312 |
+
data-placement="right"
|
313 |
+
aria-label="<?php _e( "If enabled, will send email messages with content-type = text/html instead of text/plain", 'subscribe-to-comments-reloaded' ); ?>">
|
314 |
+
<i class="fas fa-question-circle"></i>
|
315 |
+
</div>
|
316 |
+
</div>
|
317 |
+
</div>
|
318 |
+
|
319 |
+
<div class="form-group row">
|
320 |
+
<label for="process_trackbacks" class="col-sm-3 col-form-label text-right">
|
321 |
+
<?php _e( 'Process trackbacks', 'subscribe-to-comments-reloaded' ) ?>
|
322 |
+
</label>
|
323 |
+
<div class="col-sm-7">
|
324 |
+
<div class="switch">
|
325 |
+
<input type="radio" class="switch-input" name="options[process_trackbacks]"
|
326 |
+
value="yes" id="process_trackbacks-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'process_trackbacks' ) == 'yes' ) ? ' checked' : ''; ?> />
|
327 |
+
<label for="process_trackbacks-yes" class="switch-label switch-label-off">
|
328 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
329 |
+
</label>
|
330 |
+
<input type="radio" class="switch-input" name="options[process_trackbacks]" value="no" id="process_trackbacks-no"
|
331 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'process_trackbacks' ) == 'no' ) ? ' checked' : ''; ?> />
|
332 |
+
<label for="process_trackbacks-no" class="switch-label switch-label-on">
|
333 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
334 |
+
</label>
|
335 |
+
<span class="switch-selection"></span>
|
336 |
+
</div>
|
337 |
+
<div class="helpDescription subsOptDescriptions"
|
338 |
+
data-content="<?php _e( "Notify users when a new trackback or pingback is added to the discussion.", 'subscribe-to-comments-reloaded' ); ?>"
|
339 |
+
data-placement="right"
|
340 |
+
aria-label="<?php _e( "Notify users when a new trackback or pingback is added to the discussion.", 'subscribe-to-comments-reloaded' ); ?>">
|
341 |
+
<i class="fas fa-question-circle"></i>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
|
346 |
+
<div class="form-group row">
|
347 |
+
<label for="enable_admin_messages" class="col-sm-3 col-form-label text-right">
|
348 |
+
<?php _e( 'Track all subscriptions', 'subscribe-to-comments-reloaded' ) ?>
|
349 |
+
</label>
|
350 |
+
<div class="col-sm-7">
|
351 |
+
<div class="switch">
|
352 |
+
<input type="radio" class="switch-input" name="options[enable_admin_messages]"
|
353 |
+
value="yes" id="enable_admin_messages-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_admin_messages' ) == 'yes' ) ? ' checked' : ''; ?> />
|
354 |
+
<label for="enable_admin_messages-yes" class="switch-label switch-label-off">
|
355 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
356 |
+
</label>
|
357 |
+
<input type="radio" class="switch-input" name="options[enable_admin_messages]" value="no" id="enable_admin_messages-no"
|
358 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_admin_messages' ) == 'no' ) ? ' checked' : ''; ?> />
|
359 |
+
<label for="enable_admin_messages-no" class="switch-label switch-label-on">
|
360 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
361 |
+
</label>
|
362 |
+
<span class="switch-selection"></span>
|
363 |
+
</div>
|
364 |
+
<div class="helpDescription subsOptDescriptions"
|
365 |
+
data-content="<?php _e( "Notify the administrator when users subscribe without commenting.", 'subscribe-to-comments-reloaded' ); ?>"
|
366 |
+
data-placement="right"
|
367 |
+
aria-label="<?php _e( "Notify the administrator when users subscribe without commenting.", 'subscribe-to-comments-reloaded' ); ?>">
|
368 |
+
<i class="fas fa-question-circle"></i>
|
369 |
+
</div>
|
370 |
+
</div>
|
371 |
+
</div>
|
372 |
+
|
373 |
+
<div class="form-group row">
|
374 |
+
<label for="admin_subscribe" class="col-sm-3 col-form-label text-right">
|
375 |
+
<?php _e( 'Let Admin Subscribe', 'subscribe-to-comments-reloaded' ) ?>
|
376 |
+
</label>
|
377 |
+
<div class="col-sm-7">
|
378 |
+
<div class="switch">
|
379 |
+
<input type="radio" class="switch-input" name="options[admin_subscribe]"
|
380 |
+
value="yes" id="admin_subscribe-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'admin_subscribe' ) == 'yes' ) ? ' checked' : ''; ?> />
|
381 |
+
<label for="admin_subscribe-yes" class="switch-label switch-label-off">
|
382 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
383 |
+
</label>
|
384 |
+
<input type="radio" class="switch-input" name="options[admin_subscribe]" value="no" id="admin_subscribe-no"
|
385 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'admin_subscribe' ) == 'no' ) ? ' checked' : ''; ?> />
|
386 |
+
<label for="admin_subscribe-no" class="switch-label switch-label-on">
|
387 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
388 |
+
</label>
|
389 |
+
<span class="switch-selection"></span>
|
390 |
+
</div>
|
391 |
+
<div class="helpDescription subsOptDescriptions"
|
392 |
+
data-content="<?php _e( "Let the administrator subscribe to comments when logged in.", 'subscribe-to-comments-reloaded' ); ?>"
|
393 |
+
data-placement="right"
|
394 |
+
aria-label="<?php _e( "Let the administrator subscribe to comments when logged in.", 'subscribe-to-comments-reloaded' ); ?>">
|
395 |
+
<i class="fas fa-question-circle"></i>
|
396 |
+
</div>
|
397 |
+
</div>
|
398 |
+
</div>
|
399 |
+
|
400 |
+
<div class="form-group row" style="margin-bottom: 0;">
|
401 |
+
<label for="admin_bcc" class="col-sm-3 col-form-label text-right">
|
402 |
+
<?php _e( 'BCC admin on Notifications', 'subscribe-to-comments-reloaded' ) ?>
|
403 |
+
</label>
|
404 |
+
<div class="col-sm-7">
|
405 |
+
<div class="switch">
|
406 |
+
<input type="radio" class="switch-input" name="options[admin_bcc]"
|
407 |
+
value="yes" id="admin_bcc-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'admin_bcc' ) == 'yes' ) ? ' checked' : ''; ?> />
|
408 |
+
<label for="admin_bcc-yes" class="switch-label switch-label-off">
|
409 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
410 |
+
</label>
|
411 |
+
<input type="radio" class="switch-input" name="options[admin_bcc]" value="no" id="admin_bcc-no"
|
412 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'admin_bcc' ) == 'no' ) ? ' checked' : ''; ?> />
|
413 |
+
<label for="admin_bcc-no" class="switch-label switch-label-on">
|
414 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
415 |
+
</label>
|
416 |
+
<span class="switch-selection"></span>
|
417 |
+
</div>
|
418 |
+
<div class="helpDescription subsOptDescriptions"
|
419 |
+
data-content="<?php _e( "Send a copy of all Notifications to the administrator.", 'subscribe-to-comments-reloaded' ); ?>"
|
420 |
+
data-placement="right"
|
421 |
+
aria-label="<?php _e( "Send a copy of all Notifications to the administrator.", 'subscribe-to-comments-reloaded' ); ?>">
|
422 |
+
<i class="fas fa-question-circle"></i>
|
423 |
+
</div>
|
424 |
+
</div>
|
425 |
+
</div>
|
426 |
+
|
427 |
+
<div class="form-group row">
|
428 |
+
<label for="enable_font_awesome" class="col-sm-3 col-form-label text-right">
|
429 |
+
<?php _e( 'Enable Font Awesome', 'subscribe-to-comments-reloaded' ) ?>
|
430 |
+
</label>
|
431 |
+
<div class="col-sm-7">
|
432 |
+
<div class="switch">
|
433 |
+
<input type="radio" class="switch-input" name="options[enable_font_awesome]"
|
434 |
+
value="yes" id="enable_font_awesome-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_font_awesome' ) == 'yes' ) ? ' checked' : ''; ?> />
|
435 |
+
<label for="enable_font_awesome-yes" class="switch-label switch-label-off">
|
436 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
437 |
+
</label>
|
438 |
+
<input type="radio" class="switch-input" name="options[enable_font_awesome]" value="no" id="enable_font_awesome-no"
|
439 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_font_awesome' ) == 'no' ) ? ' checked' : ''; ?> />
|
440 |
+
<label for="enable_font_awesome-no" class="switch-label switch-label-on">
|
441 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
442 |
+
</label>
|
443 |
+
<span class="switch-selection"></span>
|
444 |
+
</div>
|
445 |
+
<div class="helpDescription subsOptDescriptions"
|
446 |
+
data-content="<?php _e( "Let you control the inclusion of the Font Awesome into your site. Disable if your theme already add this into your site.", 'subscribe-to-comments-reloaded' ); ?>"
|
447 |
+
data-placement="right"
|
448 |
+
aria-label="<?php _e( "Let you control the inclusion of the Font Awesome into your site. Disable if your theme already add this into your site.", 'subscribe-to-comments-reloaded' ); ?>">
|
449 |
+
<i class="fas fa-question-circle"></i>
|
450 |
+
</div>
|
451 |
+
</div>
|
452 |
+
</div>
|
453 |
+
|
454 |
+
<div class="form-group row">
|
455 |
+
<label for="post_type_supports" class="col-sm-3 col-form-label text-right">
|
456 |
+
<?php esc_html_e( 'Enable on post types', 'subscribe-to-comments-reloaded' ) ?>
|
457 |
+
</label>
|
458 |
+
<div class="col-sm-7">
|
459 |
+
<div class="multicheck">
|
460 |
+
<?php
|
461 |
+
$args = array(
|
462 |
+
'_builtin' => false,
|
463 |
+
'public' => true,
|
464 |
+
);
|
465 |
+
$post_types = get_post_types( $args );
|
466 |
+
$default_post_types = array(
|
467 |
+
'post',
|
468 |
+
'page',
|
469 |
+
);
|
470 |
+
$post_types = array_merge( $default_post_types, $post_types );
|
471 |
+
$post_types_enabled = $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'post_type_supports', '' );
|
472 |
+
|
473 |
+
foreach ( $post_types as $post_type ) {
|
474 |
+
$checked = '';
|
475 |
+
foreach ( (array) $post_types_enabled as $post_type_enabled ) {
|
476 |
+
if ( $post_type_enabled === $post_type ) {
|
477 |
+
$checked = checked( $post_type_enabled, $post_type, false );
|
478 |
+
}
|
479 |
+
}
|
480 |
+
?>
|
481 |
+
<div class="form-check pl-0">
|
482 |
+
<input type="checkbox" id="<?php echo esc_attr( $post_type ); ?>" name="options[post_type_supports][]" value="<?php echo esc_attr( $post_type ) ?>" <?php echo $checked; ?> />
|
483 |
+
|
484 |
+
<label for="<?php echo esc_attr( $post_type ); ?>">
|
485 |
+
<?php echo esc_html( get_post_type_object( $post_type )->label ); ?>
|
486 |
+
</label>
|
487 |
+
</div>
|
488 |
+
<?php } ?>
|
489 |
+
|
490 |
+
<input type="hidden" value="stcr_none" name="options[post_type_supports][]" />
|
491 |
+
</div>
|
492 |
+
|
493 |
+
<div class="helpDescription subsOptDescriptions ml-0"
|
494 |
+
data-content="<?php _e( "Enable for these specific post types only.", 'subscribe-to-comments-reloaded' ); ?>"
|
495 |
+
data-placement="right"
|
496 |
+
aria-label="<?php _e( "Enable for these specific post types only.", 'subscribe-to-comments-reloaded' ); ?>">
|
497 |
+
<i class="fas fa-question-circle"></i>
|
498 |
+
</div>
|
499 |
+
</div>
|
500 |
+
</div>
|
501 |
+
|
502 |
+
<div class="form-group row">
|
503 |
+
<label for="only_for_logged_in" class="col-sm-3 col-form-label text-right">
|
504 |
+
<?php _e( 'Enable only for logged in users', 'subscribe-to-comments-reloaded' ) ?>
|
505 |
+
</label>
|
506 |
+
<div class="col-sm-7">
|
507 |
+
<div class="switch">
|
508 |
+
<input type="radio" class="switch-input" name="options[only_for_logged_in]"
|
509 |
+
value="yes" id="only_for_logged_in-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'only_for_logged_in', 'no' ) == 'yes' ) ? ' checked' : ''; ?> />
|
510 |
+
<label for="only_for_logged_in-yes" class="switch-label switch-label-off">
|
511 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
512 |
+
</label>
|
513 |
+
<input type="radio" class="switch-input" name="options[only_for_logged_in]" value="no" id="only_for_logged_in-no"
|
514 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'only_for_logged_in', 'no' ) == 'no' ) ? ' checked' : ''; ?> />
|
515 |
+
<label for="only_for_logged_in-no" class="switch-label switch-label-on">
|
516 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
517 |
+
</label>
|
518 |
+
<span class="switch-selection"></span>
|
519 |
+
</div>
|
520 |
+
<div class="helpDescription subsOptDescriptions"
|
521 |
+
data-content="<?php _e( "Enable subscription only for logged in users.", 'subscribe-to-comments-reloaded' ); ?>"
|
522 |
+
data-placement="right"
|
523 |
+
aria-label="<?php _e( "Enable subscription only for logged in users.", 'subscribe-to-comments-reloaded' ); ?>">
|
524 |
+
<i class="fas fa-question-circle"></i>
|
525 |
+
</div>
|
526 |
+
</div>
|
527 |
+
</div>
|
528 |
+
|
529 |
+
<div class="form-group row">
|
530 |
+
<label for="use_cookies" class="col-sm-3 col-form-label text-right">
|
531 |
+
<?php _e( 'Enable cookies', 'subscribe-to-comments-reloaded' ) ?>
|
532 |
+
</label>
|
533 |
+
<div class="col-sm-7">
|
534 |
+
<div class="switch">
|
535 |
+
<input type="radio" class="switch-input" name="options[use_cookies]"
|
536 |
+
value="yes" id="use_cookies-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'use_cookies', 'yes' ) == 'yes' ) ? ' checked' : ''; ?> />
|
537 |
+
<label for="use_cookies-yes" class="switch-label switch-label-off">
|
538 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
539 |
+
</label>
|
540 |
+
<input type="radio" class="switch-input" name="options[use_cookies]" value="no" id="use_cookies-no"
|
541 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'use_cookies', 'no' ) == 'no' ) ? ' checked' : ''; ?> />
|
542 |
+
<label for="use_cookies-no" class="switch-label switch-label-on">
|
543 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
544 |
+
</label>
|
545 |
+
<span class="switch-selection"></span>
|
546 |
+
</div>
|
547 |
+
<div class="helpDescription subsOptDescriptions"
|
548 |
+
data-content="<?php _e( "Remembers the email address to prepopulate StCR forms.", 'subscribe-to-comments-reloaded' ); ?>"
|
549 |
+
data-placement="right"
|
550 |
+
aria-label="<?php _e( "Remembers the email address to prepopulate StCR forms.", 'subscribe-to-comments-reloaded' ); ?>">
|
551 |
+
<i class="fas fa-question-circle"></i>
|
552 |
+
</div>
|
553 |
+
</div>
|
554 |
+
</div>
|
555 |
+
|
556 |
+
<div class="form-group row">
|
557 |
+
<label for="use_challenge_question" class="col-sm-3 col-form-label text-right">
|
558 |
+
<?php _e( 'Enable challenge question', 'subscribe-to-comments-reloaded' ) ?>
|
559 |
+
</label>
|
560 |
+
<div class="col-sm-7">
|
561 |
+
<div class="switch">
|
562 |
+
<input type="radio" class="switch-input" name="options[use_challenge_question]"
|
563 |
+
value="yes" id="use_challenge_question-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'use_challenge_question', 'no' ) == 'yes' ) ? ' checked' : ''; ?> />
|
564 |
+
<label for="use_challenge_question-yes" class="switch-label switch-label-off">
|
565 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
566 |
+
</label>
|
567 |
+
<input type="radio" class="switch-input" name="options[use_challenge_question]" value="no" id="use_challenge_question-no"
|
568 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'use_challenge_question', 'no' ) == 'no' ) ? ' checked' : ''; ?> />
|
569 |
+
<label for="use_challenge_question-no" class="switch-label switch-label-on">
|
570 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
571 |
+
</label>
|
572 |
+
<span class="switch-selection"></span>
|
573 |
+
</div>
|
574 |
+
<div class="helpDescription subsOptDescriptions"
|
575 |
+
data-content="<?php _e( "Enables input for challenge question/answer on the subscription form.", 'subscribe-to-comments-reloaded' ); ?>"
|
576 |
+
data-placement="right"
|
577 |
+
aria-label="<?php _e( "Enables input for challenge question/answer on the subscription form.", 'subscribe-to-comments-reloaded' ); ?>">
|
578 |
+
<i class="fas fa-question-circle"></i>
|
579 |
+
</div>
|
580 |
+
</div>
|
581 |
+
</div>
|
582 |
+
|
583 |
+
<div class="form-group row">
|
584 |
+
<label for="challenge_question" class="col-sm-3 col-form-label text-right">
|
585 |
+
<?php _e( 'Challenge question', 'subscribe-to-comments-reloaded' ) ?></label>
|
586 |
+
<div class="col-sm-7">
|
587 |
+
<input type="text" name="options[challenge_question]" id="challenge_question"
|
588 |
+
class="form-control form-control-input-3"
|
589 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'challenge_question', 'What is 1 + 2?' ) ); ?>">
|
590 |
+
|
591 |
+
<div class="helpDescription subsOptDescriptions"
|
592 |
+
data-content="<?php _e( "The question shown to visitor when subscribing without commenting or when requesting a subscription management link.", 'subscribe-to-comments-reloaded' ); ?>"
|
593 |
+
data-placement="right"
|
594 |
+
aria-label="<?php _e( "The question shown to visitor when subscribing without commenting or when requesting a subscription management link", 'subscribe-to-comments-reloaded' ); ?>">
|
595 |
+
<i class="fas fa-question-circle"></i>
|
596 |
+
</div>
|
597 |
+
</div>
|
598 |
+
</div>
|
599 |
+
|
600 |
+
<div class="form-group row">
|
601 |
+
<label for="challenge_answer" class="col-sm-3 col-form-label text-right">
|
602 |
+
<?php _e( 'Challenge answer', 'subscribe-to-comments-reloaded' ) ?></label>
|
603 |
+
<div class="col-sm-7">
|
604 |
+
<input type="text" name="options[challenge_answer]" id="challenge_answer"
|
605 |
+
class="form-control form-control-input-3"
|
606 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'challenge_answer', 3 ) ); ?>">
|
607 |
+
|
608 |
+
<div class="helpDescription subsOptDescriptions"
|
609 |
+
data-content="<?php _e( "The visitor needs to provide this answer to proceed with subscription.", 'subscribe-to-comments-reloaded' ); ?>"
|
610 |
+
data-placement="right"
|
611 |
+
aria-label="<?php _e( "The visitor needs to provide this answer to proceed with subscription.", 'subscribe-to-comments-reloaded' ); ?>">
|
612 |
+
<i class="fas fa-question-circle"></i>
|
613 |
+
</div>
|
614 |
+
</div>
|
615 |
+
</div>
|
616 |
+
|
617 |
+
<?php /* captcha options start */ ?>
|
618 |
+
|
619 |
+
<div class="form-group row">
|
620 |
+
<label for="use_captcha" class="col-sm-3 col-form-label text-right">
|
621 |
+
<?php _e( 'Enable Google reCAPTCHA', 'subscribe-to-comments-reloaded' ) ?>
|
622 |
+
</label>
|
623 |
+
<div class="col-sm-7">
|
624 |
+
<div class="switch">
|
625 |
+
<input type="radio" class="switch-input" name="options[use_captcha]"
|
626 |
+
value="yes" id="use_captcha-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'use_captcha', 'no' ) == 'yes' ) ? ' checked' : ''; ?> />
|
627 |
+
<label for="use_captcha-yes" class="switch-label switch-label-off">
|
628 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
629 |
+
</label>
|
630 |
+
<input type="radio" class="switch-input" name="options[use_captcha]" value="no" id="use_captcha-no"
|
631 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'use_captcha', 'no' ) == 'no' ) ? ' checked' : ''; ?> />
|
632 |
+
<label for="use_captcha-no" class="switch-label switch-label-on">
|
633 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
634 |
+
</label>
|
635 |
+
<span class="switch-selection"></span>
|
636 |
+
</div>
|
637 |
+
<div class="helpDescription subsOptDescriptions"
|
638 |
+
data-content="<?php _e( "Shown to visitor when subscribing without commenting or when requesting a subscription management link.", 'subscribe-to-comments-reloaded' ); ?>"
|
639 |
+
data-placement="right"
|
640 |
+
aria-label="<?php _e( "Shown to visitor when subscribing without commenting or when requesting a subscription management link.", 'subscribe-to-comments-reloaded' ); ?>">
|
641 |
+
<i class="fas fa-question-circle"></i>
|
642 |
+
</div>
|
643 |
+
</div>
|
644 |
+
</div>
|
645 |
+
|
646 |
+
<div class="form-group row">
|
647 |
+
<label for="recaptcha_version" class="col-sm-3 col-form-label text-right">
|
648 |
+
<?php esc_html_e( 'reCAPTCHA Version', 'subscribe-to-comments-reloaded' ) ?>
|
649 |
+
</label>
|
650 |
+
<div class="col-sm-7">
|
651 |
+
<select class="form-control form-control-input-3" id="recaptcha_version" name="options[recaptcha_version]">
|
652 |
+
<option value="v2" <?php selected( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'recaptcha_version', 'v2' ), 'v2', true ) ?>><?php esc_html_e( 'V2', 'subscribe-to-comments-reloaded' ); ?></option>
|
653 |
+
<option value="v3" <?php selected( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'recaptcha_version', 'v2' ), 'v3', true ) ?>><?php esc_html_e( 'V3', 'subscribe-to-comments-reloaded' ); ?></option>
|
654 |
+
</select>
|
655 |
+
|
656 |
+
<div class="helpDescription subsOptDescriptions"
|
657 |
+
data-content="<?php esc_html_e( "reCAPTCHA version to be used.", 'subscribe-to-comments-reloaded' ); ?>"
|
658 |
+
data-placement="right"
|
659 |
+
aria-label="<?php esc_html_e( "reCAPTCHA version to be used.", 'subscribe-to-comments-reloaded' ); ?>">
|
660 |
+
<i class="fas fa-question-circle"></i>
|
661 |
+
</div>
|
662 |
+
</div>
|
663 |
+
</div>
|
664 |
+
|
665 |
+
<div class="form-group row">
|
666 |
+
<label for="captcha_site_key" class="col-sm-3 col-form-label text-right">
|
667 |
+
<?php _e( 'reCAPTCHA site key', 'subscribe-to-comments-reloaded' ) ?></label>
|
668 |
+
<div class="col-sm-7">
|
669 |
+
<input type="text" name="options[captcha_site_key]" id="captcha_site_key"
|
670 |
+
class="form-control form-control-input-3"
|
671 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'captcha_site_key', '' ) ); ?>">
|
672 |
+
|
673 |
+
<div class="helpDescription subsOptDescriptions"
|
674 |
+
data-content="<?php _e( "The site key for Google reCAPTCHA.", 'subscribe-to-comments-reloaded' ); ?>"
|
675 |
+
data-placement="right"
|
676 |
+
aria-label="<?php _e( "The site key for Google reCAPTCHA.", 'subscribe-to-comments-reloaded' ); ?>">
|
677 |
+
<i class="fas fa-question-circle"></i>
|
678 |
+
</div>
|
679 |
+
</div>
|
680 |
+
</div>
|
681 |
+
|
682 |
+
<div class="form-group row">
|
683 |
+
<label for="captcha_secret_key" class="col-sm-3 col-form-label text-right">
|
684 |
+
<?php _e( 'reCAPTCHA secret key', 'subscribe-to-comments-reloaded' ) ?></label>
|
685 |
+
<div class="col-sm-7">
|
686 |
+
<input type="text" name="options[captcha_secret_key]" id="captcha_secret_key"
|
687 |
+
class="form-control form-control-input-3"
|
688 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'captcha_secret_key', '' ) ); ?>">
|
689 |
+
|
690 |
+
<div class="helpDescription subsOptDescriptions"
|
691 |
+
data-content="<?php _e( "The secret key for Google reCAPTCHA.", 'subscribe-to-comments-reloaded' ); ?>"
|
692 |
+
data-placement="right"
|
693 |
+
aria-label="<?php _e( "The secret key for Google reCAPTCHA.", 'subscribe-to-comments-reloaded' ); ?>">
|
694 |
+
<i class="fas fa-question-circle"></i>
|
695 |
+
</div>
|
696 |
+
</div>
|
697 |
+
</div>
|
698 |
+
|
699 |
+
<div class="form-group row">
|
700 |
+
<label for="blacklisted_emails" class="col-sm-3 col-form-label text-right">
|
701 |
+
<?php _e( 'Blacklisted Emails', 'subscribe-to-comments-reloaded' ) ?></label>
|
702 |
+
<div class="col-sm-7">
|
703 |
+
<textarea name="options[blacklisted_emails]" id="blacklisted_emails"
|
704 |
+
class="form-control form-control-input-9" cols="10" rows="6"
|
705 |
+
><?php echo esc_textarea( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'blacklisted_emails', '' ) ); ?></textarea>
|
706 |
+
|
707 |
+
<div class="helpDescription subsOptDescriptions"
|
708 |
+
data-content="<?php esc_html_e( "Add a comma separated list of emails to blacklist them from subscribing to comments. Example: example@example.com, mail@mail.com", 'subscribe-to-comments-reloaded' ); ?>"
|
709 |
+
data-placement="right"
|
710 |
+
aria-label="<?php esc_html_e( "Add a comma separated list of emails to blacklist them from subscribing to comments. Example: example@example.com, mail@mail.com", 'subscribe-to-comments-reloaded' ); ?>">
|
711 |
+
<i class="fas fa-question-circle"></i>
|
712 |
+
</div>
|
713 |
+
</div>
|
714 |
+
</div>
|
715 |
+
|
716 |
+
<?php /* captcha options end */ ?>
|
717 |
+
|
718 |
+
<div class="form-group row">
|
719 |
+
<label for="unique_key" class="col-sm-3 col-form-label text-right">
|
720 |
+
<?php _e( 'StCR Unique Key', 'subscribe-to-comments-reloaded' ) ?></label>
|
721 |
+
<div class="col-sm-7">
|
722 |
+
|
723 |
+
<?php
|
724 |
+
if ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'unique_key' ) == "" ) {
|
725 |
+
|
726 |
+
echo "<div class=\"alert alert-danger\" role=\"alert\" style='font-size: 0.85rem;'>";
|
727 |
+
echo '<strong>' . __( "This Unique Key is not set, please click the following button to ", 'subscribe-to-comments-reloaded' ) . '</strong>';
|
728 |
+
echo "<input type='submit' value='" . __( 'Generate' ) ."' class='btn btn-secondary subscribe-form-button' name='generate_key' >";
|
729 |
+
echo "</div>";
|
730 |
+
}
|
731 |
+
else {
|
732 |
+
?>
|
733 |
+
<input type="text" name="options[unique_key]" id="unique_key"
|
734 |
+
class="form-control form-control-input-6"
|
735 |
+
value="<?php echo esc_attr( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'unique_key' ) ); ?>" size="20">
|
736 |
+
|
737 |
+
<input type="submit" value="<?php esc_attr_e( 'Generate New Key' ) ?>" class="btn btn-secondary subscribe-form-button" name="generate_key" >
|
738 |
+
<?php } ?>
|
739 |
+
|
740 |
+
|
741 |
+
<div class="helpDescription subsOptDescriptions"
|
742 |
+
data-content="<?php _e( "This Unique Key will be use to send the notification to your subscribers with more security.", 'subscribe-to-comments-reloaded' ); ?>"
|
743 |
+
data-placement="right"
|
744 |
+
aria-label="<?php _e( "This Unique Key will be use to send the notification to your subscribers with more security.", 'subscribe-to-comments-reloaded' ); ?>">
|
745 |
+
<i class="fas fa-question-circle"></i>
|
746 |
+
</div>
|
747 |
+
</div>
|
748 |
+
</div>
|
749 |
+
|
750 |
+
<div class="form-group row">
|
751 |
+
<label for="" class="col-sm-3 col-form-label text-right">
|
752 |
+
<?php _e( 'Reset All Options', 'subscribe-to-comments-reloaded' ) ?>
|
753 |
+
</label>
|
754 |
+
<div class="col-sm-7">
|
755 |
+
|
756 |
+
<div class="alert alert-danger" role="alert">
|
757 |
+
<strong>Danger!</strong>
|
758 |
+
<p>
|
759 |
+
<?php _e( 'This will reset all the options and messages of the plugin. Please proceed with caution.', 'subscribe-to-comments-reloaded' ); ?>
|
760 |
+
</p>
|
761 |
+
|
762 |
+
<p>
|
763 |
+
<?php _e( '<strong>Yes</strong> = Delete Options including subscriptions.', 'subscribe-to-comments-reloaded' ) ?><br/>
|
764 |
+
<?php _e( '<strong>No</strong> = Only delete the StCR Options.', 'subscribe-to-comments-reloaded' ) ?>
|
765 |
+
</p>
|
766 |
+
|
767 |
+
|
768 |
+
<div class="switch">
|
769 |
+
<input type="radio" class="switch-input" name="options[delete_options_subscriptions]"
|
770 |
+
value="yes" id="delete_options_subscriptions-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'delete_options_subscriptions' ) == 'yes' ) ? ' checked' : ''; ?> />
|
771 |
+
<label for="delete_options_subscriptions-yes" class="switch-label switch-label-off">
|
772 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
773 |
+
</label>
|
774 |
+
<input type="radio" class="switch-input" name="options[delete_options_subscriptions]" value="no" id="delete_options_subscriptions-no"
|
775 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'delete_options_subscriptions' ) == 'no' ) ? ' checked' : ''; ?> />
|
776 |
+
<label for="delete_options_subscriptions-no" class="switch-label switch-label-on">
|
777 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
778 |
+
</label>
|
779 |
+
<span class="switch-selection"></span>
|
780 |
+
</div>
|
781 |
+
|
782 |
+
<input type="submit" value="<?php esc_attr_e( 'Reset All Options' ) ?>" class="btn btn-danger subscribe-form-button reset_all_options" name="reset_all_options" >
|
783 |
+
|
784 |
+
</div>
|
785 |
+
</div>
|
786 |
+
</div>
|
787 |
+
|
788 |
+
<div class="form-group row">
|
789 |
+
<div class="col-sm-9 offset-sm-1">
|
790 |
+
<button type="submit" class="btn btn-primary subscribe-form-button" name="Submit">
|
791 |
+
<?php _e( 'Save Changes', 'subscribe-to-comments-reloaded' ) ?>
|
792 |
+
</button>
|
793 |
+
</div>
|
794 |
+
</div>
|
795 |
+
|
796 |
+
<?php wp_nonce_field( 'stcr_save_options_nonce', 'stcr_save_options_nonce' ); ?>
|
797 |
+
|
798 |
+
</form>
|
799 |
+
</div>
|
800 |
+
|
801 |
+
<div class="col-md-3">
|
802 |
+
<div class="card card-font-size">
|
803 |
+
<div class="card-body">
|
804 |
+
<p>
|
805 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
806 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
807 |
+
</p>
|
808 |
+
<p>
|
809 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
810 |
+
</p>
|
811 |
+
</div>
|
812 |
+
</div>
|
813 |
+
</div>
|
814 |
+
|
815 |
+
</div>
|
816 |
+
</div>
|
817 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
818 |
+
<?php
|
819 |
+
//global $wp_subscribe_reloaded;
|
820 |
+
// Tell WP that we are going to use a resource.
|
821 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-options", "subs_options.js", "includes/js/admin");
|
822 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
823 |
+
//$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-subs-options", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
824 |
+
// Enqueue the JS File
|
825 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-options" );
|
826 |
+
|
827 |
+
?>
|
options/stcr_support.php
CHANGED
@@ -1,57 +1,57 @@
|
|
1 |
-
<?php
|
2 |
-
// Options
|
3 |
-
|
4 |
-
// Avoid direct access to this piece of code
|
5 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
-
header( 'Location: /' );
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
|
11 |
-
?>
|
12 |
-
<div class="container-fluid">
|
13 |
-
<div class="mt-3"></div>
|
14 |
-
<div class="row">
|
15 |
-
<div class="col-sm-9">
|
16 |
-
<div class="card card-font-size card-no-max-width">
|
17 |
-
<div class="card-body">
|
18 |
-
<div class="card-text">
|
19 |
-
|
20 |
-
<h5><?php _e( "You can help", 'subscribe-to-comments-reloaded' ) ?></h5>
|
21 |
-
<p><?php _e( "Please consider blogging about my plugin with a link to the plugin's page. Please let your readers know what makes your blog better. You can also contribute donating your time: do not hesitate to send me bug reports, your localization files, ideas on how to improve <strong>Subscribe to Comments Reloaded</strong> and so on. Whatever you do, thanks for using my plugin!", 'subscribe-to-comments-reloaded' ) ?></p>
|
22 |
-
|
23 |
-
<h5><?php _e( "Subscribe to the Beta testers", 'subscribe-to-comments-reloaded' ) ?></h5>
|
24 |
-
<p><?php _e( "Before a new Update we release a Beta version so that our current users can give us feedback if they find a bug, If you want to join the tester list you can add your email <a href='http://eepurl.com/biCk1b' target='_blank'>here</a>", 'subscribe-to-comments-reloaded' ) ?></h5></p>
|
25 |
-
|
26 |
-
<h5><?php _e( "Vote and show your appreciation", 'subscribe-to-comments-reloaded' ) ?></h5>
|
27 |
-
<p><?php _e( 'Tell other people if <strong>Subscribe to Comments Reloaded</strong> works for you and how good it is. <a href="http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/">Rate it</a> on its Plugin Directory page.', 'subscribe-to-comments-reloaded' ) ?></p>
|
28 |
-
|
29 |
-
<h5><?php _e( "Did you find a Bug on the plugin?", 'subscribe-to-comments-reloaded' ) ?></h5>
|
30 |
-
<p><?php _e( 'Please report any bug on the <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/new?title=Bug%20Report:%20%3Cshort%20description%3E&labels=bug" target="_blank">GitHub</a> Page rather than on the WordPress Support page.', 'subscribe-to-comments-reloaded' ) ?>
|
31 |
-
</p>
|
32 |
-
<div class="alert alert-info" role="alert">
|
33 |
-
<strong>Heads up!</strong>
|
34 |
-
<p><?php printf( __( 'The options on the WordPress forum at very limited to share media information, so I urge you to use GitHub to report any issue, you will get a better and faster experience than in WordPress. And you can use <a href="%s" target="_blank" >Markdown syntax</a>.', 'subscribe-to-comments-reloaded' ), "https://guides.github.com/features/mastering-markdown/" ); ?></p>
|
35 |
-
</div>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
|
39 |
-
</div>
|
40 |
-
</div>
|
41 |
-
|
42 |
-
<div class="col-md-3">
|
43 |
-
<div class="card card-font-size">
|
44 |
-
<div class="card-body">
|
45 |
-
<p>
|
46 |
-
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
47 |
-
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo plugins_url(
|
48 |
-
</p>
|
49 |
-
<p>
|
50 |
-
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
51 |
-
</p>
|
52 |
-
</div>
|
53 |
-
</div>
|
54 |
-
</div>
|
55 |
-
|
56 |
-
</div>
|
57 |
-
</div>
|
1 |
+
<?php
|
2 |
+
// Options
|
3 |
+
|
4 |
+
// Avoid direct access to this piece of code
|
5 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
6 |
+
header( 'Location: /' );
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
|
11 |
+
?>
|
12 |
+
<div class="container-fluid">
|
13 |
+
<div class="mt-3"></div>
|
14 |
+
<div class="row">
|
15 |
+
<div class="col-sm-9">
|
16 |
+
<div class="card card-font-size card-no-max-width">
|
17 |
+
<div class="card-body">
|
18 |
+
<div class="card-text">
|
19 |
+
|
20 |
+
<h5><?php _e( "You can help", 'subscribe-to-comments-reloaded' ) ?></h5>
|
21 |
+
<p><?php _e( "Please consider blogging about my plugin with a link to the plugin's page. Please let your readers know what makes your blog better. You can also contribute donating your time: do not hesitate to send me bug reports, your localization files, ideas on how to improve <strong>Subscribe to Comments Reloaded</strong> and so on. Whatever you do, thanks for using my plugin!", 'subscribe-to-comments-reloaded' ) ?></p>
|
22 |
+
|
23 |
+
<h5><?php _e( "Subscribe to the Beta testers", 'subscribe-to-comments-reloaded' ) ?></h5>
|
24 |
+
<p><?php _e( "Before a new Update we release a Beta version so that our current users can give us feedback if they find a bug, If you want to join the tester list you can add your email <a href='http://eepurl.com/biCk1b' target='_blank'>here</a>", 'subscribe-to-comments-reloaded' ) ?></h5></p>
|
25 |
+
|
26 |
+
<h5><?php _e( "Vote and show your appreciation", 'subscribe-to-comments-reloaded' ) ?></h5>
|
27 |
+
<p><?php _e( 'Tell other people if <strong>Subscribe to Comments Reloaded</strong> works for you and how good it is. <a href="http://wordpress.org/extend/plugins/subscribe-to-comments-reloaded/">Rate it</a> on its Plugin Directory page.', 'subscribe-to-comments-reloaded' ) ?></p>
|
28 |
+
|
29 |
+
<h5><?php _e( "Did you find a Bug on the plugin?", 'subscribe-to-comments-reloaded' ) ?></h5>
|
30 |
+
<p><?php _e( 'Please report any bug on the <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/new?title=Bug%20Report:%20%3Cshort%20description%3E&labels=bug" target="_blank">GitHub</a> Page rather than on the WordPress Support page.', 'subscribe-to-comments-reloaded' ) ?>
|
31 |
+
</p>
|
32 |
+
<div class="alert alert-info" role="alert">
|
33 |
+
<strong>Heads up!</strong>
|
34 |
+
<p><?php printf( __( 'The options on the WordPress forum at very limited to share media information, so I urge you to use GitHub to report any issue, you will get a better and faster experience than in WordPress. And you can use <a href="%s" target="_blank" >Markdown syntax</a>.', 'subscribe-to-comments-reloaded' ), "https://guides.github.com/features/mastering-markdown/" ); ?></p>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<div class="col-md-3">
|
43 |
+
<div class="card card-font-size">
|
44 |
+
<div class="card-body">
|
45 |
+
<p>
|
46 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
47 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
48 |
+
</p>
|
49 |
+
<p>
|
50 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
51 |
+
</p>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
</div>
|
57 |
+
</div>
|
options/stcr_system.php
CHANGED
@@ -1,764 +1,790 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Displays WP-admin -> StCR -> StCR System
|
4 |
-
*/
|
5 |
-
|
6 |
-
// Avoid direct access to this piece of code
|
7 |
-
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
8 |
-
header( 'Location: /' );
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
global $wpdb;
|
13 |
-
|
14 |
-
$options = array(
|
15 |
-
"enable_log_data" => "yesno",
|
16 |
-
"auto_clean_log_data" => "yesno",
|
17 |
-
"auto_clean_log_frecuency" => "text"
|
18 |
-
);
|
19 |
-
|
20 |
-
$stcr_options = $wpdb->get_results('SELECT * FROM '. $wpdb->prefix . 'options WHERE option_name LIKE "subscribe_reloaded%"');
|
21 |
-
|
22 |
-
$stcr_options_str = "";
|
23 |
-
$stcr_options_array = array();
|
24 |
-
$stcr_system_information = array();
|
25 |
-
|
26 |
-
foreach ($stcr_options as $option) {
|
27 |
-
$stcr_options_str .= "{$option->option_name}: {$option->option_value}\n";
|
28 |
-
$stcr_options_array[$option->option_name] = $option->option_value;
|
29 |
-
}
|
30 |
-
|
31 |
-
$stcr_options_array["custom_post_types"] = implode( "| ", get_post_types( '', 'names' ) );
|
32 |
-
$stcr_options_array["permalink_structure"] = get_option('permalink_structure');
|
33 |
-
|
34 |
-
// Setup the auto purge for the download report.
|
35 |
-
// // Schedule the auto purge for the log file.
|
36 |
-
if ( ! wp_next_scheduled( '_cron_subscribe_reloaded_system_report_file_purge' ) ) {
|
37 |
-
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_system_report_file_purge' );
|
38 |
-
// Let us bind the schedule event with our desire action.
|
39 |
-
wp_schedule_event( time() + 15, "daily", '_cron_subscribe_reloaded_system_report_file_purge' );
|
40 |
-
}
|
41 |
-
|
42 |
-
// Updating options
|
43 |
-
if ( array_key_exists( "purge_log", $_POST ) ) {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
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 |
-
|
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 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
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 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
$
|
450 |
-
}
|
451 |
-
|
452 |
-
$stcr_system_information['Server Environment']["
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
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 |
-
|
487 |
-
$
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
$
|
502 |
-
|
503 |
-
|
504 |
-
//
|
505 |
-
$
|
506 |
-
if (
|
507 |
-
|
508 |
-
$
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
if (
|
518 |
-
{
|
519 |
-
$
|
520 |
-
$stcr_system_information['Server Environment']["
|
521 |
-
}
|
522 |
-
else
|
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 |
-
foreach ( $
|
623 |
-
{
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
//
|
648 |
-
if (
|
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 |
-
if (
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Displays WP-admin -> StCR -> StCR System
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Avoid direct access to this piece of code
|
7 |
+
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) {
|
8 |
+
header( 'Location: /' );
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
global $wpdb;
|
13 |
+
|
14 |
+
$options = array(
|
15 |
+
"enable_log_data" => "yesno",
|
16 |
+
"auto_clean_log_data" => "yesno",
|
17 |
+
"auto_clean_log_frecuency" => "text"
|
18 |
+
);
|
19 |
+
|
20 |
+
$stcr_options = $wpdb->get_results('SELECT * FROM '. $wpdb->prefix . 'options WHERE option_name LIKE "subscribe_reloaded%"');
|
21 |
+
|
22 |
+
$stcr_options_str = "";
|
23 |
+
$stcr_options_array = array();
|
24 |
+
$stcr_system_information = array();
|
25 |
+
|
26 |
+
foreach ($stcr_options as $option) {
|
27 |
+
$stcr_options_str .= "{$option->option_name}: {$option->option_value}\n";
|
28 |
+
$stcr_options_array[$option->option_name] = $option->option_value;
|
29 |
+
}
|
30 |
+
|
31 |
+
$stcr_options_array["custom_post_types"] = implode( "| ", get_post_types( '', 'names' ) );
|
32 |
+
$stcr_options_array["permalink_structure"] = get_option('permalink_structure');
|
33 |
+
|
34 |
+
// Setup the auto purge for the download report.
|
35 |
+
// // Schedule the auto purge for the log file.
|
36 |
+
if ( ! wp_next_scheduled( '_cron_subscribe_reloaded_system_report_file_purge' ) ) {
|
37 |
+
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_system_report_file_purge' );
|
38 |
+
// Let us bind the schedule event with our desire action.
|
39 |
+
wp_schedule_event( time() + 15, "daily", '_cron_subscribe_reloaded_system_report_file_purge' );
|
40 |
+
}
|
41 |
+
|
42 |
+
// Updating options
|
43 |
+
if ( array_key_exists( "purge_log", $_POST ) ) {
|
44 |
+
|
45 |
+
if ( empty( $_POST['stcr_purge_log_nonce'] ) ) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( ! wp_verify_nonce( $_POST['stcr_purge_log_nonce'], 'stcr_purge_log_nonce' ) ) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
// Check that the log file exits
|
58 |
+
$plugin_dir = plugin_dir_path( __DIR__ );
|
59 |
+
$file_name = "log.txt";
|
60 |
+
$message_type = "";
|
61 |
+
$message = "";
|
62 |
+
$file_path = $plugin_dir . "utils/" . $file_name;
|
63 |
+
|
64 |
+
if( file_exists( $file_path ) && is_writable( $plugin_dir ) )
|
65 |
+
{
|
66 |
+
// unlink the file
|
67 |
+
if( unlink($file_path) )
|
68 |
+
{
|
69 |
+
// show success message.
|
70 |
+
$message = __( 'The log file has been successfully deleted.', 'subscribe-to-comments-reloaded' );
|
71 |
+
$message_type = "notice-success";
|
72 |
+
}
|
73 |
+
else
|
74 |
+
{
|
75 |
+
$message = __( 'Can\'t delete the log file, check the file permissions.', 'subscribe-to-comments-reloaded' );
|
76 |
+
$message_type = "notice-warning";
|
77 |
+
}
|
78 |
+
}
|
79 |
+
else
|
80 |
+
{
|
81 |
+
$message = __( 'The log file does not exists.', 'subscribe-to-comments-reloaded' );
|
82 |
+
$message_type = "notice-warning";
|
83 |
+
}
|
84 |
+
echo "<div class='notice $message_type'><p>";
|
85 |
+
echo $message;
|
86 |
+
// echo "<br><pre>$file_path$file_name</pre>";
|
87 |
+
echo "</p></div>\n";
|
88 |
+
}
|
89 |
+
else {
|
90 |
+
|
91 |
+
if( isset( $_POST['options'] ) ) { // Update options
|
92 |
+
|
93 |
+
if ( empty( $_POST['stcr_save_system_nonce'] ) ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( ! wp_verify_nonce( $_POST['stcr_save_system_nonce'], 'stcr_save_system_nonce' ) ) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
|
105 |
+
$faulty_fields = array();
|
106 |
+
|
107 |
+
foreach ( $_POST['options'] as $option => $value )
|
108 |
+
{
|
109 |
+
// echo $option . '<br>';
|
110 |
+
|
111 |
+
if ( ! $wp_subscribe_reloaded->stcr->utils->stcr_update_menu_options( $option, $value, $options[$option] ) )
|
112 |
+
{
|
113 |
+
array_push( $faulty_fields, $option );
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( $option === "auto_clean_log_data" && $value === "yes" )
|
117 |
+
{
|
118 |
+
// // Schedule the auto purge for the log file.
|
119 |
+
if ( ! wp_next_scheduled( '_cron_log_file_purge' ) ) {
|
120 |
+
$log_purger_recurrence = get_option( "subscribe_reloaded_auto_clean_log_frecuency" );
|
121 |
+
wp_clear_scheduled_hook( '_cron_log_file_purge' );
|
122 |
+
// Let us bind the schedule event with our desire action.
|
123 |
+
wp_schedule_event( time() + 15, $log_purger_recurrence, '_cron_log_file_purge' );
|
124 |
+
}
|
125 |
+
}
|
126 |
+
elseif ( $option === "auto_clean_log_data" && $value === "no" )
|
127 |
+
{
|
128 |
+
// Delete a Schedule event
|
129 |
+
wp_clear_scheduled_hook( '_cron_log_file_purge' );
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
// Display an alert in the admin interface if something went wrong
|
134 |
+
echo '<div class="updated"><p>';
|
135 |
+
if ( sizeof( $faulty_fields ) == 0 ) {
|
136 |
+
_e( 'Your settings have been successfully updated.', 'subscribe-to-comments-reloaded' );
|
137 |
+
} else {
|
138 |
+
_e( 'There was an error updating the options.', 'subscribe-to-comments-reloaded' );
|
139 |
+
// echo ' <strong>' . substr( $faulty_fields, 0, - 2 ) . '</strong>';
|
140 |
+
}
|
141 |
+
echo "</p></div>";
|
142 |
+
}
|
143 |
+
}
|
144 |
+
?>
|
145 |
+
<link href="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.css', STCR_PLUGIN_FILE ) ); ?>" rel="stylesheet"/>
|
146 |
+
<style type="text/css">
|
147 |
+
.system-error {
|
148 |
+
color: #dc3545;
|
149 |
+
}
|
150 |
+
|
151 |
+
.system-success{
|
152 |
+
color: #7cc575;
|
153 |
+
}
|
154 |
+
</style>
|
155 |
+
|
156 |
+
|
157 |
+
<div class="container-fluid">
|
158 |
+
<div class="mt-3"></div>
|
159 |
+
<div class="row">
|
160 |
+
<div class="col-sm-9">
|
161 |
+
<form action="" method="post">
|
162 |
+
|
163 |
+
<div class="form-group row" style="margin-bottom: 0;">
|
164 |
+
<label for="enable_log_data" class="col-sm-3 col-form-label text-right"><?php _e( 'Enable Log Information', 'subscribe-to-comments-reloaded' ) ?></label>
|
165 |
+
<div class="col-sm-7">
|
166 |
+
<div class="switch">
|
167 |
+
<input type="radio" class="switch-input" name="options[enable_log_data]"
|
168 |
+
value="yes" id="enable_log_data-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_log_data' ) == 'yes' ) ? ' checked' : ''; ?> />
|
169 |
+
<label for="enable_log_data-yes" class="switch-label switch-label-off">
|
170 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
171 |
+
</label>
|
172 |
+
<input type="radio" class="switch-input" name="options[enable_log_data]" value="no" id="enable_log_data-no"
|
173 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'enable_log_data' ) == 'no' ) ? ' checked' : ''; ?> />
|
174 |
+
<label for="enable_log_data-no" class="switch-label switch-label-on">
|
175 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
176 |
+
</label>
|
177 |
+
<span class="switch-selection"></span>
|
178 |
+
</div>
|
179 |
+
|
180 |
+
<div class="helpDescription subsOptDescriptions"
|
181 |
+
data-content="<?php _e( "If enabled, will log information of the plugin. Helpful for debugging purposes.<p>The file is stored under the path <code>Plugins Dir>subscribe-to-comments-reloaded>utils>log.txt</code></code></p>", 'subscribe-to-comments-reloaded' ); ?>"
|
182 |
+
data-placement="right"
|
183 |
+
aria-label="<?php _e( "If enabled, will log information of the plugin. Helpful for debugging purposes.", 'subscribe-to-comments-reloaded' ); ?>">
|
184 |
+
<i class="fas fa-question-circle"></i>
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
</div>
|
188 |
+
|
189 |
+
<div class="form-group row" style="margin-bottom: 0;">
|
190 |
+
<label for="auto_clean_log_data" class="col-sm-3 col-form-label text-right"><?php _e( 'Enable Auto clean log data', 'subscribe-to-comments-reloaded' ) ?></label>
|
191 |
+
<div class="col-sm-7">
|
192 |
+
<div class="switch">
|
193 |
+
<input type="radio" class="switch-input" name="options[auto_clean_log_data]"
|
194 |
+
value="yes" id="auto_clean_log_data-yes" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'auto_clean_log_data' ) == 'yes' ) ? ' checked' : ''; ?> />
|
195 |
+
<label for="auto_clean_log_data-yes" class="switch-label switch-label-off">
|
196 |
+
<?php _e( 'Yes', 'subscribe-to-comments-reloaded' ) ?>
|
197 |
+
</label>
|
198 |
+
<input type="radio" class="switch-input" name="options[auto_clean_log_data]" value="no" id="auto_clean_log_data-no"
|
199 |
+
<?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'auto_clean_log_data' ) == 'no' ) ? ' checked' : ''; ?> />
|
200 |
+
<label for="auto_clean_log_data-no" class="switch-label switch-label-on">
|
201 |
+
<?php _e( 'No', 'subscribe-to-comments-reloaded' ) ?>
|
202 |
+
</label>
|
203 |
+
<span class="switch-selection"></span>
|
204 |
+
</div>
|
205 |
+
|
206 |
+
<select class="auto_clean_log_frecuency form-control form-control-select" name="options[auto_clean_log_frecuency]">
|
207 |
+
<option value="hourly" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'auto_clean_log_frecuency' ) === 'hourly' ) ? "selected='selected'" : ''; ?>><?php _e( 'Hourly', 'subscribe-to-comments-reloaded' ); ?></option>
|
208 |
+
<option value="twicedaily" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'auto_clean_log_frecuency' ) === 'twicedaily' ) ? "selected='selected'" : ''; ?>><?php _e( 'Twice Daily', 'subscribe-to-comments-reloaded' ); ?></option>
|
209 |
+
<option value="daily" <?php echo ( $wp_subscribe_reloaded->stcr->utils->stcr_get_menu_options( 'auto_clean_log_frecuency' ) === 'daily' ) ? "selected='selected'" : ''; ?>><?php _e( 'Daily', 'subscribe-to-comments-reloaded' ); ?></option>
|
210 |
+
</select>
|
211 |
+
|
212 |
+
<div class="helpDescription subsOptDescriptions"
|
213 |
+
data-content="<?php _e( "If enabled, StCR will auto clean your information according to the frequency that you defined on the dropdown.", 'subscribe-to-comments-reloaded' ); ?>"
|
214 |
+
data-placement="right"
|
215 |
+
aria-label="<?php _e( "If enabled, StCR will auto clean your information according to the frequency that you defined on the dropdown.", 'subscribe-to-comments-reloaded' ); ?>">
|
216 |
+
<i class="fas fa-question-circle"></i>
|
217 |
+
</div>
|
218 |
+
</div>
|
219 |
+
</div>
|
220 |
+
|
221 |
+
<div class="form-group row">
|
222 |
+
<label for="purge_log" class="col-sm-3 col-form-label text-right">
|
223 |
+
<?php _e( 'Clean Up Log Archive', 'subscribe-to-comments-reloaded' ) ?></label>
|
224 |
+
<div class="col-sm-7">
|
225 |
+
|
226 |
+
<span style="font-size: 0.9rem;"><?php _e(
|
227 |
+
"If you want to clean up the log archive please click the following button",
|
228 |
+
'subscribe-to-comments-reloaded'
|
229 |
+
); ?>
|
230 |
+
</span>
|
231 |
+
|
232 |
+
<?php wp_nonce_field( 'stcr_purge_log_nonce', 'stcr_purge_log_nonce' ); ?>
|
233 |
+
<input type='submit' id="purge_log" value='<?php esc_attr_e( 'Clean' ); ?>' class='btn btn-secondary subscribe-form-button' name='purge_log' >
|
234 |
+
</div>
|
235 |
+
</div>
|
236 |
+
|
237 |
+
<div class="form-group row">
|
238 |
+
<label for="generate_system_info" class="col-sm-3 col-form-label text-right">
|
239 |
+
<?php _e( 'Download System Info File', 'subscribe-to-comments-reloaded' ) ?></label>
|
240 |
+
<div class="col-sm-7">
|
241 |
+
<a class="download_report btn btn-download subscribe-form-button" href="#">
|
242 |
+
<?php _e( 'Download', 'subscribe-to-comments-reloaded' ); ?>
|
243 |
+
</a>
|
244 |
+
</div>
|
245 |
+
</div>
|
246 |
+
|
247 |
+
<div class="form-group row">
|
248 |
+
<div class="col-sm-9 offset-sm-3">
|
249 |
+
<button type="submit" class="btn btn-primary subscribe-form-button" name="Submit">
|
250 |
+
<?php _e( 'Save Changes', 'subscribe-to-comments-reloaded' ) ?>
|
251 |
+
</button>
|
252 |
+
</div>
|
253 |
+
</div>
|
254 |
+
|
255 |
+
<h4><?php _e( 'System Information', 'subscribe-to-comments-reloaded' ) ?></h4><br>
|
256 |
+
|
257 |
+
<!-- Plugin Info -->
|
258 |
+
<?php
|
259 |
+
// get the total number of subscribers and subscriptions
|
260 |
+
$total_subscribers = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}subscribe_reloaded_subscribers");
|
261 |
+
$total_subscriptions = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}postmeta where meta_key LIKE '_stcr@_%'");
|
262 |
+
?>
|
263 |
+
<table class="table table-sm table-hover table-striped system-info-table" style="font-size: 0.8em">
|
264 |
+
<thead style="background-color: #4688d2; color: #ffffff;">
|
265 |
+
<th style="textalilfe" class="text-left" colspan="2"><?php _e( 'Plugin Info', 'subscribe-to-comments-reloaded' ) ?></th>
|
266 |
+
</thead>
|
267 |
+
<tbody>
|
268 |
+
<tr>
|
269 |
+
<td class="text-left"><?php _e( 'Subscribers', 'subscribe-toc-omments-reloaded' ); ?></td>
|
270 |
+
<td class="text-left"><?php echo $total_subscribers; ?></td>
|
271 |
+
</tr>
|
272 |
+
<tr>
|
273 |
+
<td class="text-left"><?php _e( 'Subscriptions', 'subscribe-toc-omments-reloaded' ); ?></td>
|
274 |
+
<td class="text-left"><?php echo $total_subscriptions; ?></td>
|
275 |
+
</tr>
|
276 |
+
</tbody>
|
277 |
+
</table>
|
278 |
+
|
279 |
+
<table class="table table-sm table-hover table-striped system-info-table" style="font-size: 0.8em">
|
280 |
+
<thead style="background-color: #4688d2; color: #ffffff;">
|
281 |
+
<th style="textalilfe" class="text-left" colspan="2"><?php _e( 'WordPress Environment', 'subscribe-to-comments-reloaded' ) ?></th>
|
282 |
+
</thead>
|
283 |
+
<?php
|
284 |
+
|
285 |
+
$memory = $wp_subscribe_reloaded->stcr->utils->to_num_ini_notation( WP_MEMORY_LIMIT );
|
286 |
+
$memoryValue = '';
|
287 |
+
$wpDebug = 'No';
|
288 |
+
$wpCron = 'No';
|
289 |
+
$wpHome = get_option( 'home' );
|
290 |
+
$wpsiteurl = get_option( 'siteurl' );
|
291 |
+
$wpVersion = get_bloginfo( 'version' );
|
292 |
+
$wpMultisite = is_multisite();
|
293 |
+
$wpLanguage = get_locale();
|
294 |
+
$wpPermalink = esc_html( get_option( 'permalink_structure' ) );
|
295 |
+
$wpTablePrefix = esc_html( $wpdb->prefix );
|
296 |
+
$wpTablePrefixLength = strlen( $wpdb->prefix );
|
297 |
+
$wpTablePrefixStatus = $wpTablePrefixLength > 16 ? esc_html( 'Error: Too long', 'subscribe-to-comments-reloaded' ) : esc_html( 'Acceptable', 'subscribe-to-comments-reloaded' );
|
298 |
+
$wpRegisteredPostStatuses = esc_html( implode( ', ', get_post_stati() ) );
|
299 |
+
|
300 |
+
$stcr_system_information['Wordpress Environment']["Home URL"] = $wpHome;
|
301 |
+
$stcr_system_information['Wordpress Environment']["Site URL"] = $wpsiteurl;
|
302 |
+
$stcr_system_information['Wordpress Environment']["WordPress Version"] = $wpVersion;
|
303 |
+
$stcr_system_information['Wordpress Environment']["Multisite"] = $wpMultisite;
|
304 |
+
$stcr_system_information['Wordpress Environment']["Language"] = $wpLanguage;
|
305 |
+
$stcr_system_information['Wordpress Environment']["Permalink Structure"] = $wpPermalink;
|
306 |
+
$stcr_system_information['Wordpress Environment']["Table Prefix"] = $wpTablePrefix;
|
307 |
+
$stcr_system_information['Wordpress Environment']["Table Prefix Length"] = $wpTablePrefixLength;
|
308 |
+
$stcr_system_information['Wordpress Environment']["Table Prefix Status"] = $wpTablePrefixStatus;
|
309 |
+
$stcr_system_information['Wordpress Environment']["Registered Post Statuses"] = $wpRegisteredPostStatuses;
|
310 |
+
|
311 |
+
|
312 |
+
|
313 |
+
if ( function_exists( 'memory_get_usage' ) ) {
|
314 |
+
$system_memory = $wp_subscribe_reloaded->stcr->utils->to_num_ini_notation( @ini_get( 'memory_limit' ) );
|
315 |
+
$memory = max( $memory, $system_memory );
|
316 |
+
}
|
317 |
+
|
318 |
+
if ( $memory < 67108864 ) {
|
319 |
+
$memoryValue = '<div class="system-error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'subscribe-to-comments-reloaded' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'subscribe-to-comments-reloaded' ) . '</a>' ) . '</div>';
|
320 |
+
$stcr_system_information['Wordpress Environment']["Memory Limit"] = "Memory under 64MB";
|
321 |
+
}
|
322 |
+
else {
|
323 |
+
$memoryValue = '<div class="system-success">' . size_format( $memory ) . '</div>';
|
324 |
+
$stcr_system_information['Wordpress Environment']["Memory Limit"] = size_format( $memory );
|
325 |
+
}
|
326 |
+
// Check if Debug is Enable
|
327 |
+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
|
328 |
+
{
|
329 |
+
$wpDebug = '<div class="system-success"><span class="dashicons dashicons-yes"></span></div>';
|
330 |
+
$stcr_system_information['Wordpress Environment']["WP Debug Mode"] = true;
|
331 |
+
}
|
332 |
+
else
|
333 |
+
{
|
334 |
+
$wpDebug = '<div>'. $wpDebug .'</div>';
|
335 |
+
$stcr_system_information['Wordpress Environment']["WP Debug Mode"] = false;
|
336 |
+
}
|
337 |
+
// Check if WP Cron is Enable
|
338 |
+
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON )
|
339 |
+
{
|
340 |
+
$wpCron = '<div>'. $wpCron .'</div>';
|
341 |
+
$stcr_system_information['Wordpress Environment']["WP Cron"] = true;
|
342 |
+
}
|
343 |
+
else
|
344 |
+
{
|
345 |
+
$wpCron = '<div class="system-success"><span class="dashicons dashicons-yes"></span></div>';
|
346 |
+
$stcr_system_information['Wordpress Environment']["WP Cron"] = false;
|
347 |
+
}
|
348 |
+
|
349 |
+
$wordpressEnvironment = array(
|
350 |
+
1 => array(
|
351 |
+
__( "Home URL", 'subscribe-to-comments-reloaded' ),
|
352 |
+
$wpHome
|
353 |
+
),
|
354 |
+
2 => array(
|
355 |
+
__( "Site URL", 'subscribe-to-comments-reloaded' ),
|
356 |
+
$wpsiteurl
|
357 |
+
),
|
358 |
+
3 => array(
|
359 |
+
__( "WordPress Version", 'subscribe-to-comments-reloaded' ),
|
360 |
+
$wpVersion
|
361 |
+
),
|
362 |
+
4 => array(
|
363 |
+
"Multisite",
|
364 |
+
$wpMultisite ? '<span class="dashicons dashicons-yes"></span>' : 'No'
|
365 |
+
),
|
366 |
+
5 => array(
|
367 |
+
__( "Memory Limit", 'subscribe-to-comments-reloaded' ),
|
368 |
+
$memoryValue
|
369 |
+
),
|
370 |
+
6 => array(
|
371 |
+
__( "WP Debug Mode", 'subscribe-to-comments-reloaded' ),
|
372 |
+
$wpDebug
|
373 |
+
),
|
374 |
+
7 => array(
|
375 |
+
__( "WP Cron", 'subscribe-to-comments-reloaded' ),
|
376 |
+
$wpCron
|
377 |
+
),
|
378 |
+
8 => array(
|
379 |
+
__( "Language", 'subscribe-to-comments-reloaded' ),
|
380 |
+
$wpLanguage
|
381 |
+
),
|
382 |
+
9 => array(
|
383 |
+
__( "Permalink Structure", 'subscribe-to-comments-reloaded' ),
|
384 |
+
$wpPermalink
|
385 |
+
),
|
386 |
+
10 => array(
|
387 |
+
__( "Table Prefix", 'subscribe-to-comments-reloaded' ),
|
388 |
+
$wpTablePrefix
|
389 |
+
),
|
390 |
+
11 => array(
|
391 |
+
__( "Table Prefix Length", 'subscribe-to-comments-reloaded' ),
|
392 |
+
$wpTablePrefixLength
|
393 |
+
),
|
394 |
+
12 => array(
|
395 |
+
__( "Table Prefix Status", 'subscribe-to-comments-reloaded' ),
|
396 |
+
$wpTablePrefixStatus
|
397 |
+
),
|
398 |
+
13 => array(
|
399 |
+
__( "Registered Post Statuses", 'subscribe-to-comments-reloaded' ),
|
400 |
+
$wpRegisteredPostStatuses
|
401 |
+
)
|
402 |
+
);
|
403 |
+
?>
|
404 |
+
<tbody>
|
405 |
+
<?php
|
406 |
+
foreach ( $wordpressEnvironment as $key => $opt )
|
407 |
+
{
|
408 |
+
echo "<tr>";
|
409 |
+
echo "<td class='text-left' style='min-width: 50px;'>{$opt[0]}</td>";
|
410 |
+
echo "<td class='text-left'>{$opt[1]}</td>";
|
411 |
+
echo "</tr>";
|
412 |
+
}
|
413 |
+
?>
|
414 |
+
</tbody>
|
415 |
+
</table>
|
416 |
+
|
417 |
+
<!-- Server Environment -->
|
418 |
+
<table class="table table-sm table-hover table-striped system-info-table" style="font-size: 0.8em">
|
419 |
+
<thead style="background-color: #4688d2; color: #ffffff;">
|
420 |
+
<th style="textalilfe" class="text-left" colspan="2"><?php _e( 'Server Environment', 'subscribe-to-comments-reloaded' ) ?></th>
|
421 |
+
</thead>
|
422 |
+
<?php
|
423 |
+
|
424 |
+
$tlsCheck = false;
|
425 |
+
$tlsCheckValue = __( 'Cannot Evaluate', 'subscribe-to-comments-reloaded' );
|
426 |
+
$tlsRating = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
427 |
+
$phpVersion = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
428 |
+
$cURLVersion = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
429 |
+
$MySQLSVersion = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
430 |
+
$defaultTimezone = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
431 |
+
$serverInfo = esc_html( $_SERVER['SERVER_SOFTWARE'] );
|
432 |
+
$maxPostSize = size_format( $wp_subscribe_reloaded->stcr->utils->to_num_ini_notation( ini_get( 'post_max_size' ) ) );
|
433 |
+
|
434 |
+
// Get the SSL status.
|
435 |
+
if ( ini_get( 'allow_url_fopen' ) ) {
|
436 |
+
$tlsCheck = file_get_contents( 'https://www.howsmyssl.com/a/check' );
|
437 |
+
}
|
438 |
+
|
439 |
+
if ( false !== $tlsCheck )
|
440 |
+
{
|
441 |
+
$tlsCheck = json_decode( $tlsCheck );
|
442 |
+
/* translators: %s: SSL connection response */
|
443 |
+
$tlsCheckValue = sprintf( __( 'Connection uses %s', 'subscribe-to-comments-reloaded' ), esc_html( $tlsCheck->tls_version ) );
|
444 |
+
}
|
445 |
+
$stcr_system_information['Server Environment']["TLS Connection"] = $tlsCheckValue;
|
446 |
+
// Check TSL Rating
|
447 |
+
if ( false !== $tlsCheck )
|
448 |
+
{
|
449 |
+
$tlsRating = property_exists( $tlsCheck, 'rating' ) ? $tlsCheck->rating : $tlsCheck->tls_version;
|
450 |
+
}
|
451 |
+
$stcr_system_information['Server Environment']["TLS Rating"] = $tlsRating;
|
452 |
+
$stcr_system_information['Server Environment']["Server Info"] = $serverInfo;
|
453 |
+
// Check the PHP Version
|
454 |
+
if ( function_exists( 'phpversion' ) )
|
455 |
+
{
|
456 |
+
$phpVersion = phpversion();
|
457 |
+
|
458 |
+
if ( version_compare( $phpVersion, '5.6', '<' ) )
|
459 |
+
{
|
460 |
+
$phpVersion = '<div class="system-error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'subscribe-to-comments-reloaded' ), esc_html( $phpVersion ), '<a href="http://subscribe-reloaded.com/about/" target="_blank">' . __( 'PHP Requirements in StCR', 'subscribe-to-comments-reloaded' ) . '</a>' ) . '</div>';
|
461 |
+
$stcr_system_information['Server Environment']["PHP Version"] = sprintf( '%s - We recommend a minimum PHP version of 5.6. See: %s', esc_html( $phpVersion ), '<a href="http://subscribe-reloaded.com/about/" target="_blank">PHP Requirements in StCR</a>' );
|
462 |
+
}
|
463 |
+
else
|
464 |
+
{
|
465 |
+
$phpVersion = '<div class="system-success">' . esc_html( $phpVersion ) . '</div>';
|
466 |
+
$stcr_system_information['Server Environment']["PHP Version"] = phpversion();
|
467 |
+
}
|
468 |
+
}
|
469 |
+
else
|
470 |
+
{
|
471 |
+
$phpVersion = __( "Couldn't determine PHP version because the function phpversion() doesn't exist.", 'subscribe-to-comments-reloaded' );
|
472 |
+
$stcr_system_information['Server Environment']["PHP Version"] = "Couldn't determine PHP version because the function phpversion() doesn't exist.";
|
473 |
+
}
|
474 |
+
|
475 |
+
$stcr_system_information['Server Environment']["PHP Post Max Size"] = $maxPostSize;
|
476 |
+
$stcr_system_information['Server Environment']["PHP Max Execution Time"] = ini_get( 'max_execution_time' );
|
477 |
+
$stcr_system_information['Server Environment']["PHP Max Input Vars"] = ini_get( 'max_input_vars' );
|
478 |
+
$stcr_system_information['Server Environment']["PHP Max Upload Size"] = size_format( wp_max_upload_size() );
|
479 |
+
|
480 |
+
// Check the cURL Version
|
481 |
+
if ( function_exists( 'curl_version' ) )
|
482 |
+
{
|
483 |
+
$cURLVersion = curl_version();
|
484 |
+
$cURLVersionNumber = $cURLVersion['version'];
|
485 |
+
$cURLSSLVersion = $cURLVersion['ssl_version'];
|
486 |
+
|
487 |
+
if ( version_compare( $cURLVersionNumber, '7.40', '<' ) )
|
488 |
+
{
|
489 |
+
$cURLVersion = '<div class="system-error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'subscribe-to-comments-reloaded' ), esc_html( $cURLVersionNumber . ', ' . $cURLSSLVersion ) ) . '</div>';
|
490 |
+
$stcr_system_information['Server Environment']["cURL Version"] = sprintf('%s - We recommend a minimum cURL version of 7.40.', esc_html( $cURLVersionNumber . ', ' . $cURLSSLVersion ) );
|
491 |
+
}
|
492 |
+
else
|
493 |
+
{
|
494 |
+
$cURLVersion = '<div class="system-success">' . esc_html( $cURLVersionNumber ) . '</div>';
|
495 |
+
$stcr_system_information['Server Environment']["cURL Version"] = $cURLVersion;
|
496 |
+
}
|
497 |
+
}
|
498 |
+
else
|
499 |
+
{
|
500 |
+
$cURLVersion = '–';
|
501 |
+
$stcr_system_information['Server Environment']["cURL Version"] = 'cURL is not available';
|
502 |
+
}
|
503 |
+
|
504 |
+
// check MySQL version
|
505 |
+
global $wp_version, $required_mysql_version;
|
506 |
+
if ( version_compare( $wpdb->db_version(), $required_mysql_version, '<' ) ) {
|
507 |
+
$MySQLSVersion = '<div class="system-error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) . '</div>';
|
508 |
+
$stcr_system_information['Server Environment']["MySQL Version"] = $wpdb->db_version();
|
509 |
+
} else {
|
510 |
+
$MySQLSVersion = '<div class="system-success">' . $wpdb->db_version() . '</div>';
|
511 |
+
$stcr_system_information['Server Environment']["MySQL Version"] = $wpdb->db_version();
|
512 |
+
}
|
513 |
+
|
514 |
+
// Get the Timezone
|
515 |
+
$defaultTimezone = date_default_timezone_get();
|
516 |
+
|
517 |
+
if ( 'UTC' !== $defaultTimezone )
|
518 |
+
{
|
519 |
+
$defaultTimezone = '<div class="system-error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'subscribe-to-comments-reloaded' ), $defaultTimezone ) . '</div>';
|
520 |
+
$stcr_system_information['Server Environment']["Default Timezone is UTC"] = sprintf('Default timezone is %s - it should be UTC', $defaultTimezone );
|
521 |
+
}
|
522 |
+
else
|
523 |
+
{
|
524 |
+
$defaultTimezone = '<div class="system-success"><span class="dashicons dashicons-yes"></span></div>';
|
525 |
+
$stcr_system_information['Server Environment']["Default Timezone is UTC"] = "Yes";
|
526 |
+
}
|
527 |
+
// DOMDocument
|
528 |
+
$DOMDocument = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
529 |
+
if ( class_exists( 'DOMDocument' ) )
|
530 |
+
{
|
531 |
+
$DOMDocument = '<div class="system-success"><span class="dashicons dashicons-yes"></span></div>';
|
532 |
+
$stcr_system_information['Server Environment']["DOMDocument"] = "Yes";
|
533 |
+
}
|
534 |
+
else {
|
535 |
+
$DOMDocument = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'subscribe-to-comments-reloaded' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
|
536 |
+
$stcr_system_information['Server Environment']["DOMDocument"] = sprintf( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
|
537 |
+
}
|
538 |
+
// Check gzip
|
539 |
+
$gzip = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
540 |
+
if ( is_callable( 'gzopen' ) )
|
541 |
+
{
|
542 |
+
$gzip = '<div class="system-success"><span class="dashicons dashicons-yes"></span></div>';
|
543 |
+
$stcr_system_information['Server Environment']["gzip"] = "Yes";
|
544 |
+
}
|
545 |
+
else {
|
546 |
+
$gzip = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'subscribe-to-comments-reloaded' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' );
|
547 |
+
$stcr_system_information['Server Environment']["gzip"] = sprintf( 'Your server does not support the %s function - this is used for file compression and decompression.', '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' );
|
548 |
+
}// Check GD
|
549 |
+
$gd = __( 'Not Available', 'subscribe-to-comments-reloaded' );
|
550 |
+
if ( extension_loaded( 'gd' ) && function_exists( 'gd_info' ) )
|
551 |
+
{
|
552 |
+
$gd = '<div class="system-success"><span class="dashicons dashicons-yes"></span></div>';
|
553 |
+
$stcr_system_information['Server Environment']["GD Graphics Library"] = "Yes";
|
554 |
+
}
|
555 |
+
else {
|
556 |
+
$gd = '<div class="system-error"><span class="dashicons dashicons-no"></span></div>';
|
557 |
+
$stcr_system_information['Server Environment']["GD Graphics Library"] = "No";
|
558 |
+
}
|
559 |
+
|
560 |
+
// Define array of values
|
561 |
+
$serverEnvironment = array(
|
562 |
+
1 => array(
|
563 |
+
__( "TLS Connection", 'subscribe-to-comments-reloaded' ),
|
564 |
+
$tlsCheckValue
|
565 |
+
),
|
566 |
+
2 => array(
|
567 |
+
__( "TLS Rating", 'subscribe-to-comments-reloaded' ),
|
568 |
+
$tlsRating
|
569 |
+
),
|
570 |
+
3 => array(
|
571 |
+
__( "Server Info", 'subscribe-to-comments-reloaded' ),
|
572 |
+
$serverInfo
|
573 |
+
),
|
574 |
+
4 => array(
|
575 |
+
__( "PHP Version", 'subscribe-to-comments-reloaded' ),
|
576 |
+
$phpVersion
|
577 |
+
),
|
578 |
+
5 => array(
|
579 |
+
__( "PHP Post Max Size", 'subscribe-to-comments-reloaded' ),
|
580 |
+
$maxPostSize
|
581 |
+
),
|
582 |
+
6 => array(
|
583 |
+
__( "PHP Max Execution Time", 'subscribe-to-comments-reloaded' ),
|
584 |
+
ini_get( 'max_execution_time' )
|
585 |
+
),
|
586 |
+
7 => array(
|
587 |
+
__( "PHP Max Input Vars", 'subscribe-to-comments-reloaded' ),
|
588 |
+
ini_get( 'max_input_vars' )
|
589 |
+
),
|
590 |
+
8 => array(
|
591 |
+
__( "PHP Max Upload Size", 'subscribe-to-comments-reloaded' ),
|
592 |
+
size_format( wp_max_upload_size() )
|
593 |
+
),
|
594 |
+
9 => array(
|
595 |
+
__( "cURL Version", 'subscribe-to-comments-reloaded' ),
|
596 |
+
$cURLVersion
|
597 |
+
),
|
598 |
+
10 => array(
|
599 |
+
__( "MySQL Version", 'subscribe-to-comments-reloaded' ),
|
600 |
+
$MySQLSVersion
|
601 |
+
),
|
602 |
+
11 => array(
|
603 |
+
__( "Default Timezone is UTC", 'subscribe-to-comments-reloaded' ),
|
604 |
+
$defaultTimezone
|
605 |
+
),
|
606 |
+
12 => array(
|
607 |
+
__( "DOMDocument", 'subscribe-to-comments-reloaded' ),
|
608 |
+
$DOMDocument
|
609 |
+
),
|
610 |
+
13 => array(
|
611 |
+
__( "gzip", 'subscribe-to-comments-reloaded' ),
|
612 |
+
$gzip
|
613 |
+
),
|
614 |
+
14 => array(
|
615 |
+
__( "GD Graphics Library", 'subscribe-to-comments-reloaded' ),
|
616 |
+
$gd
|
617 |
+
)
|
618 |
+
);
|
619 |
+
?>
|
620 |
+
<tbody>
|
621 |
+
<?php
|
622 |
+
foreach ( $serverEnvironment as $key => $opt )
|
623 |
+
{
|
624 |
+
echo "<tr>";
|
625 |
+
echo "<td class='text-left' style='min-width: 50px;'>{$opt[0]}</td>";
|
626 |
+
echo "<td class='text-left'>{$opt[1]}</td>";
|
627 |
+
echo "</tr>";
|
628 |
+
}
|
629 |
+
?>
|
630 |
+
</tbody>
|
631 |
+
</table>
|
632 |
+
<?php
|
633 |
+
$plugins = $wp_subscribe_reloaded->stcr->utils->stcr_get_plugins();
|
634 |
+
$installed_plugins = array();
|
635 |
+
?>
|
636 |
+
<!-- Active Plugins -->
|
637 |
+
<table class="table table-sm table-hover table-striped system-info-table" style="font-size: 0.8em">
|
638 |
+
<thead style="background-color: #4688d2; color: #ffffff;">
|
639 |
+
<th style="textalilfe" class="text-left" colspan="2"><?php _e( 'Active Plugins', 'subscribe-to-comments-reloaded' ) ?></th>
|
640 |
+
</thead>
|
641 |
+
|
642 |
+
<tbody>
|
643 |
+
<?php
|
644 |
+
|
645 |
+
foreach ( $plugins as $plugin_data )
|
646 |
+
{
|
647 |
+
// Filter only the Active plugins
|
648 |
+
if ('active' !== $plugin_data['Status'] )
|
649 |
+
{
|
650 |
+
continue;
|
651 |
+
}
|
652 |
+
|
653 |
+
$plugin_name = $plugin_data['Name'];
|
654 |
+
$author_name = $plugin_data['Author'];
|
655 |
+
|
656 |
+
$installed_plugins[] = array(
|
657 |
+
"plugin-name" => $plugin_name,
|
658 |
+
"plugin-author" => $author_name
|
659 |
+
);
|
660 |
+
|
661 |
+
// Link the plugin name to the plugin URL if available.
|
662 |
+
if ( ! empty( $plugin_data['PluginURI'] ) ) {
|
663 |
+
$plugin_name = sprintf(
|
664 |
+
'<a href="%s" title="%s">%s</a>',
|
665 |
+
esc_url( $plugin_data['PluginURI'] ),
|
666 |
+
esc_attr__( 'Visit plugin homepage', 'subscribe-to-comments-reloaded' ),
|
667 |
+
$plugin_name
|
668 |
+
);
|
669 |
+
}
|
670 |
+
// Link the author name to the author URL if available.
|
671 |
+
if ( ! empty( $plugin_data['AuthorURI'] ) ) {
|
672 |
+
$author_name = sprintf(
|
673 |
+
'<a href="%s" title="%s">%s</a>',
|
674 |
+
esc_url( $plugin_data['AuthorURI'] ),
|
675 |
+
esc_attr__( 'Visit author homepage', 'subscribe-to-comments-reloaded' ),
|
676 |
+
$author_name
|
677 |
+
);
|
678 |
+
|
679 |
+
$author_name = sprintf( _x( 'by %s', 'by author', 'subscribe-to-comments-reloaded' ),
|
680 |
+
wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – '
|
681 |
+
. esc_html( $plugin_data['Version'] );
|
682 |
+
}
|
683 |
+
echo "<tr>";
|
684 |
+
echo "<td class='text-left' style='min-width: 50px;'>{$plugin_name}</td>";
|
685 |
+
echo "<td class='text-left'>{$author_name}</td>";
|
686 |
+
echo "</tr>";
|
687 |
+
$stcr_system_information['WordPress Active Plugins'][$plugin_data['Name']] = $plugin_data;
|
688 |
+
}
|
689 |
+
|
690 |
+
?>
|
691 |
+
</tbody>
|
692 |
+
</table>
|
693 |
+
<!-- Inactive Plugins -->
|
694 |
+
<table class="table table-sm table-hover table-striped system-info-table" style="font-size: 0.8em">
|
695 |
+
<thead style="background-color: #4688d2; color: #ffffff;">
|
696 |
+
<th style="textalilfe" class="text-left" colspan="2"><?php _e( 'Inactive Plugins', 'subscribe-to-comments-reloaded' ) ?></th>
|
697 |
+
</thead>
|
698 |
+
|
699 |
+
<tbody>
|
700 |
+
<?php
|
701 |
+
|
702 |
+
foreach ( $plugins as $plugin_data )
|
703 |
+
{
|
704 |
+
// Filter only the Inactive plugins
|
705 |
+
if ('inactive' !== $plugin_data['Status'] )
|
706 |
+
{
|
707 |
+
continue;
|
708 |
+
}
|
709 |
+
|
710 |
+
$plugin_name = $plugin_data['Name'];
|
711 |
+
$author_name = $plugin_data['Author'];
|
712 |
+
|
713 |
+
$installed_plugins[] = array(
|
714 |
+
"plugin-name" => $plugin_name,
|
715 |
+
"plugin-author" => $author_name
|
716 |
+
);
|
717 |
+
|
718 |
+
// Link the plugin name to the plugin URL if available.
|
719 |
+
if ( ! empty( $plugin_data['PluginURI'] ) ) {
|
720 |
+
$plugin_name = sprintf(
|
721 |
+
'<a href="%s" title="%s">%s</a>',
|
722 |
+
esc_url( $plugin_data['PluginURI'] ),
|
723 |
+
esc_attr__( 'Visit plugin homepage', 'subscribe-to-comments-reloaded' ),
|
724 |
+
$plugin_name
|
725 |
+
);
|
726 |
+
}
|
727 |
+
// Link the author name to the author URL if available.
|
728 |
+
if ( ! empty( $plugin_data['AuthorURI'] ) ) {
|
729 |
+
$author_name = sprintf(
|
730 |
+
'<a href="%s" title="%s">%s</a>',
|
731 |
+
esc_url( $plugin_data['AuthorURI'] ),
|
732 |
+
esc_attr__( 'Visit author homepage', 'subscribe-to-comments-reloaded' ),
|
733 |
+
$author_name
|
734 |
+
);
|
735 |
+
|
736 |
+
$author_name = sprintf( _x( 'by %s', 'by author', 'subscribe-to-comments-reloaded' ),
|
737 |
+
wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – '
|
738 |
+
. esc_html( $plugin_data['Version'] );
|
739 |
+
}
|
740 |
+
echo "<tr>";
|
741 |
+
echo "<td class='text-left' style='min-width: 50px;'>{$plugin_name}</td>";
|
742 |
+
echo "<td class='text-left'>{$author_name}</td>";
|
743 |
+
echo "</tr>";
|
744 |
+
$stcr_system_information['WordPress Inactive Plugins'][$plugin_data['Name']] = $plugin_data;
|
745 |
+
}
|
746 |
+
?>
|
747 |
+
</tbody>
|
748 |
+
</table>
|
749 |
+
|
750 |
+
<?php wp_nonce_field( 'stcr_save_system_nonce', 'stcr_save_system_nonce' ); ?>
|
751 |
+
|
752 |
+
</form>
|
753 |
+
|
754 |
+
<form name="stcr_sysinfo_form" class="stcr-hidden" action="<?php echo esc_url( admin_url( 'admin.php?page=stcr_system' ) ); ?>" method="post">
|
755 |
+
<input type="hidden" name="stcr_sysinfo_action" value="download_sysinfo" />
|
756 |
+
<textarea name="stcr_sysinfo" readonly><?php echo serialize( $stcr_system_information ); ?></textarea>
|
757 |
+
<?php wp_nonce_field( 'stcr_download_sysinfo_nonce', 'stcr_download_sysinfo_nonce' ); ?>
|
758 |
+
</form>
|
759 |
+
|
760 |
+
</div>
|
761 |
+
|
762 |
+
<div class="col-md-3">
|
763 |
+
<div class="card card-font-size">
|
764 |
+
<div class="card-body">
|
765 |
+
<p>
|
766 |
+
Thank you for using Subscribe to Comments Reloaded. You can Support the plugin by rating it
|
767 |
+
<a href="https://wordpress.org/support/plugin/subscribe-to-comments-reloaded/reviews/#new-post" target="_blank"><img src="<?php echo esc_url( plugins_url( '/images/rate.png', STCR_PLUGIN_FILE ) ); ?>" alt="Rate Subscribe to Comments Reloaded" style="vertical-align: sub;" /></a>
|
768 |
+
</p>
|
769 |
+
<p>
|
770 |
+
<i class="fas fa-bug"></i> Having issues? Please <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues/" target="_blank">create a ticket</a>
|
771 |
+
</p>
|
772 |
+
</div>
|
773 |
+
</div>
|
774 |
+
</div>
|
775 |
+
|
776 |
+
</div>
|
777 |
+
</div>
|
778 |
+
<script type="text/javascript" src="<?php echo esc_url( plugins_url( '/vendor/webui-popover/dist/jquery.webui-popover.min.js', STCR_PLUGIN_FILE ) ); ?>"></script>
|
779 |
+
<?php
|
780 |
+
//global $wp_subscribe_reloaded;
|
781 |
+
// Tell WP that we are going to use a resource.
|
782 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-system-info", "stcr_system.js", "includes/js/admin");
|
783 |
+
$wp_subscribe_reloaded->stcr->utils->register_script_to_wp( "stcr-subs-options", "subs_options.js", "includes/js/admin");
|
784 |
+
// Includes the Panel JS resource file as well as the JS text domain translations.
|
785 |
+
//$wp_subscribe_reloaded->stcr->stcr_i18n->stcr_localize_script( "stcr-system-info", "stcr_i18n", $wp_subscribe_reloaded->stcr->stcr_i18n->get_js_subs_translation() );
|
786 |
+
// Enqueue the JS File
|
787 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-system-info" );
|
788 |
+
$wp_subscribe_reloaded->stcr->utils->enqueue_script_to_wp( "stcr-subs-options" );
|
789 |
+
|
790 |
+
?>
|
readme.txt
CHANGED
@@ -6,8 +6,8 @@ Plugin URI: http://subscribe-reloaded.com/
|
|
6 |
Â
Requires at least: 4.0
|
7 |
Â
Requires PHP: 5.6
|
8 |
Â
Requires MySQL: 5.6
|
9 |
-
Tested up to: 5.
|
10 |
-
Stable tag:
|
11 |
Â
License: GPLv2 or later
|
12 |
Â
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
Â
|
@@ -95,6 +95,14 @@ Just go to the Options Panel and click the generate button. By generating a new
|
|
95 |
Â
7. Manage the subscriptions on the Frontend Side.
|
96 |
Â
|
97 |
Â
== Changelog ==
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
98 |
Â
= v211130 =
|
99 |
Â
* **Fix** Removed custom error handler (thanks to JakeQZ for bringing the issue to our attention)
|
100 |
Â
* **Fix** Processing form submission in subscribe.php is now stopped in case "subscribe without commenting" is enabled
|
6 |
Â
Requires at least: 4.0
|
7 |
Â
Requires PHP: 5.6
|
8 |
Â
Requires MySQL: 5.6
|
9 |
+
Tested up to: 5.9
|
10 |
+
Stable tag: 220502
|
11 |
Â
License: GPLv2 or later
|
12 |
Â
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
Â
|
95 |
Â
7. Manage the subscriptions on the Frontend Side.
|
96 |
Â
|
97 |
Â
== Changelog ==
|
98 |
+
= v220502 =
|
99 |
+
* **Important** Security fixes
|
100 |
+
* **New** Option to set for which post types the subscription will be available
|
101 |
+
* **New** Option to define blacklisted emails (that won't be allowed to subscribe). Option located in WP Admin > StCR > Options.
|
102 |
+
* **Improvement** reCaptcha v3 now available
|
103 |
+
* **Fix** General code improvements
|
104 |
+
* **Fix** Issue with "comment-subscriptions" page showing a 404 error
|
105 |
+
|
106 |
Â
= v211130 =
|
107 |
Â
* **Fix** Removed custom error handler (thanks to JakeQZ for bringing the issue to our attention)
|
108 |
Â
* **Fix** Processing form submission in subscribe.php is now stopped in case "subscribe without commenting" is enabled
|
subscribe-to-comments-reloaded.php
CHANGED
@@ -1,82 +1,87 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Subscribe to Comments Reloaded
|
4 |
-
* Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
|
5 |
-
* Version:
|
6 |
-
* Author: WPKube
|
7 |
-
* Author URI: http://wpkube.com/
|
8 |
-
* License: GPL-2.0+
|
9 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
10 |
-
* Text Domain: subscribe-to-comments-reloaded
|
11 |
-
* Domain Path: /langs
|
12 |
-
*/
|
13 |
-
|
14 |
-
namespace stcr;
|
15 |
-
|
16 |
-
//
|
17 |
-
if ( ! function_exists( 'add_action' ) ) {
|
18 |
-
header( 'Location: /' );
|
19 |
-
exit;
|
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 |
-
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Subscribe to Comments Reloaded
|
4 |
+
* Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
|
5 |
+
* Version: 220502
|
6 |
+
* Author: WPKube
|
7 |
+
* Author URI: http://wpkube.com/
|
8 |
+
* License: GPL-2.0+
|
9 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
10 |
+
* Text Domain: subscribe-to-comments-reloaded
|
11 |
+
* Domain Path: /langs
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace stcr;
|
15 |
+
|
16 |
+
// Avoid direct access to this piece of code.
|
17 |
+
if ( ! function_exists( 'add_action' ) ) {
|
18 |
+
header( 'Location: /' );
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
|
22 |
+
// Define the main plugin constant file.
|
23 |
+
if ( ! defined( 'STCR_PLUGIN_FILE' ) ) {
|
24 |
+
define( 'STCR_PLUGIN_FILE', __FILE__ );
|
25 |
+
}
|
26 |
+
|
27 |
+
require_once dirname( STCR_PLUGIN_FILE ) . '/wp_subscribe_reloaded.php';
|
28 |
+
|
29 |
+
if( ! class_exists( '\\'.__NAMESPACE__.'\\stcr_subscribe_reloaded' ) ) {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Main plugin class
|
33 |
+
*
|
34 |
+
* @since 150720
|
35 |
+
*/
|
36 |
+
class stcr_subscribe_reloaded {
|
37 |
+
|
38 |
+
const CLASSNAME = __CLASS__; // http://www.garfieldtech.com/blog/class-constants-php54
|
39 |
+
|
40 |
+
public $stcr = null;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructor
|
44 |
+
*
|
45 |
+
* @since 150720
|
46 |
+
*/
|
47 |
+
function __construct() {
|
48 |
+
$this->stcr = new wp_subscribe_reloaded();
|
49 |
+
$this->stcr->set_user_cookie();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* This will trigger the activate function located on utils/stcr_manage.php
|
54 |
+
*
|
55 |
+
* @since 150720
|
56 |
+
*/
|
57 |
+
static function activate() {
|
58 |
+
require_once dirname( STCR_PLUGIN_FILE ) . '/utils/stcr_manage.php';
|
59 |
+
$_stcra = new stcr_manage();
|
60 |
+
$_stcra->activate();
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* This will trigger the deactivate function located on utils/stcr_manage.php
|
65 |
+
*
|
66 |
+
* @since 150720
|
67 |
+
*/
|
68 |
+
static function deactivate() {
|
69 |
+
require_once dirname( STCR_PLUGIN_FILE ) . '/utils/stcr_manage.php';
|
70 |
+
$_stcrd = new stcr_manage();
|
71 |
+
$_stcrd->deactivate();
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
// plugin activation
|
77 |
+
register_activation_hook( STCR_PLUGIN_FILE, array( \stcr\stcr_subscribe_reloaded::CLASSNAME , 'activate' ) );
|
78 |
+
|
79 |
+
// plugin deactivation
|
80 |
+
register_deactivation_hook( STCR_PLUGIN_FILE, array( \stcr\stcr_subscribe_reloaded::CLASSNAME , 'deactivate' ) );
|
81 |
+
|
82 |
+
// instantiate stcr_subscribe_reloaded class
|
83 |
+
if ( ! isset( $GLOBALS['wp_subscribe_reloaded'] ) ) {
|
84 |
+
$GLOBALS['wp_subscribe_reloaded'] = new stcr_subscribe_reloaded();
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
templates/key_expired.php
CHANGED
@@ -1,86 +1,92 @@
|
|
1 |
-
<?php
|
2 |
-
// Avoid direct access to this piece of code
|
3 |
-
if ( ! function_exists( 'add_action' ) ) {
|
4 |
-
header( 'Location: /' );
|
5 |
-
exit;
|
6 |
-
}
|
7 |
-
|
8 |
-
$error_message = __( "Woohaa the link to manage your subscriptions has expired, don't worry, just enter your email below and a new link will be send.", 'subscribe-to-comments-reloaded');
|
9 |
-
|
10 |
-
global $wp_subscribe_reloaded;
|
11 |
-
ob_start();
|
12 |
-
|
13 |
-
if ( isset( $_POST[ 'sre' ] ) && trim( $_POST[ 'sre' ] ) !== "" ) {
|
14 |
-
$email = esc_attr( $_POST[ 'sre' ] );
|
15 |
-
$subject = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_subject', 'Manage your subscriptions on [blog_name]' ) ), ENT_QUOTES, 'UTF-8' );
|
16 |
-
$page_message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
17 |
-
$email_message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_email_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
18 |
-
$manager_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
19 |
-
$one_click_unsubscribe_link = $manager_link;
|
20 |
-
|
21 |
-
if ( function_exists( 'qtrans_convertURL' ) ) {
|
22 |
-
$manager_link = qtrans_convertURL( $manager_link );
|
23 |
-
}
|
24 |
-
|
25 |
-
$clean_email = $wp_subscribe_reloaded->stcr->utils->clean_email( $email );
|
26 |
-
$subscriber_salt = $wp_subscribe_reloaded->stcr->utils->generate_temp_key( $clean_email );
|
27 |
-
|
28 |
-
$manager_link .= ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?';
|
29 |
-
$manager_link .= "srek=" . $wp_subscribe_reloaded->stcr->utils->get_subscriber_key($clean_email) . "&srk=$subscriber_salt&srsrc=e";
|
30 |
-
$one_click_unsubscribe_link .= ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?';
|
31 |
-
$one_click_unsubscribe_link .= ( ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?' ) . "srek=" . $this->utils->get_subscriber_key( $clean_email ) . "&srk=$subscriber_salt" . "&sra=u" . "&srp=";
|
32 |
-
|
33 |
-
// Replace tags with their actual values
|
34 |
-
$subject = str_replace( '[blog_name]', get_bloginfo( 'name' ), $subject );
|
35 |
-
// Setup the fronted page message
|
36 |
-
$page_message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $page_message );
|
37 |
-
// Setup the email message
|
38 |
-
$email_message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $email_message );
|
39 |
-
$email_message = str_replace( '[manager_link]', $manager_link, $email_message );
|
40 |
-
$email_message = str_replace( '[oneclick_link]', $one_click_unsubscribe_link, $email_message );
|
41 |
-
|
42 |
-
if ( get_option( 'subscribe_reloaded_enable_html_emails', 'yes' ) == 'yes' ) {
|
43 |
-
$email_message = wpautop( $email_message );
|
44 |
-
}
|
45 |
-
|
46 |
-
// QTranslate support
|
47 |
-
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
48 |
-
$subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $subject );
|
49 |
-
$page_message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $page_message );
|
50 |
-
$email_message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $email_message );
|
51 |
-
}
|
52 |
-
// Prepare email settings
|
53 |
-
$email_settings = array(
|
54 |
-
'subject' => $subject,
|
55 |
-
'message' => $email_message,
|
56 |
-
'toEmail' => $clean_email
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
// Avoid direct access to this piece of code
|
3 |
+
if ( ! function_exists( 'add_action' ) ) {
|
4 |
+
header( 'Location: /' );
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
$error_message = __( "Woohaa the link to manage your subscriptions has expired, don't worry, just enter your email below and a new link will be send.", 'subscribe-to-comments-reloaded');
|
9 |
+
|
10 |
+
global $wp_subscribe_reloaded;
|
11 |
+
ob_start();
|
12 |
+
|
13 |
+
if ( isset( $_POST[ 'sre' ] ) && trim( $_POST[ 'sre' ] ) !== "" ) {
|
14 |
+
$email = esc_attr( $_POST[ 'sre' ] );
|
15 |
+
$subject = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_subject', 'Manage your subscriptions on [blog_name]' ) ), ENT_QUOTES, 'UTF-8' );
|
16 |
+
$page_message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
17 |
+
$email_message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_email_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
18 |
+
$manager_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
19 |
+
$one_click_unsubscribe_link = $manager_link;
|
20 |
+
|
21 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
22 |
+
$manager_link = qtrans_convertURL( $manager_link );
|
23 |
+
}
|
24 |
+
|
25 |
+
$clean_email = $wp_subscribe_reloaded->stcr->utils->clean_email( $email );
|
26 |
+
$subscriber_salt = $wp_subscribe_reloaded->stcr->utils->generate_temp_key( $clean_email );
|
27 |
+
|
28 |
+
$manager_link .= ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?';
|
29 |
+
$manager_link .= "srek=" . $wp_subscribe_reloaded->stcr->utils->get_subscriber_key($clean_email) . "&srk=$subscriber_salt&srsrc=e";
|
30 |
+
$one_click_unsubscribe_link .= ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?';
|
31 |
+
$one_click_unsubscribe_link .= ( ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?' ) . "srek=" . $this->utils->get_subscriber_key( $clean_email ) . "&srk=$subscriber_salt" . "&sra=u" . "&srp=";
|
32 |
+
|
33 |
+
// Replace tags with their actual values
|
34 |
+
$subject = str_replace( '[blog_name]', get_bloginfo( 'name' ), $subject );
|
35 |
+
// Setup the fronted page message
|
36 |
+
$page_message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $page_message );
|
37 |
+
// Setup the email message
|
38 |
+
$email_message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $email_message );
|
39 |
+
$email_message = str_replace( '[manager_link]', $manager_link, $email_message );
|
40 |
+
$email_message = str_replace( '[oneclick_link]', $one_click_unsubscribe_link, $email_message );
|
41 |
+
|
42 |
+
if ( get_option( 'subscribe_reloaded_enable_html_emails', 'yes' ) == 'yes' ) {
|
43 |
+
$email_message = wpautop( $email_message );
|
44 |
+
}
|
45 |
+
|
46 |
+
// QTranslate support
|
47 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
48 |
+
$subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $subject );
|
49 |
+
$page_message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $page_message );
|
50 |
+
$email_message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $email_message );
|
51 |
+
}
|
52 |
+
// Prepare email settings
|
53 |
+
$email_settings = array(
|
54 |
+
'subject' => $subject,
|
55 |
+
'message' => $email_message,
|
56 |
+
'toEmail' => $clean_email
|
57 |
+
);
|
58 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $clean_email );
|
59 |
+
// Send the confirmation email only if the email
|
60 |
+
// address is not in blacklist email list.
|
61 |
+
if ( $has_blacklist_email ) {
|
62 |
+
$wp_subscribe_reloaded->stcr->utils->send_email( $email_settings );
|
63 |
+
}
|
64 |
+
|
65 |
+
echo wpautop( $page_message );
|
66 |
+
}
|
67 |
+
else
|
68 |
+
{
|
69 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_request_mgmt_link' ) ), ENT_QUOTES, 'UTF-8' );
|
70 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
71 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
72 |
+
}
|
73 |
+
?>
|
74 |
+
<p><?php echo wpautop( $error_message ); ?></p>
|
75 |
+
<form action="<?php
|
76 |
+
$url = $_SERVER[ 'REQUEST_URI' ];
|
77 |
+
$url = preg_replace('/sre=\w+&|&key\_expired=\d+/', '', $url );
|
78 |
+
echo esc_url( $url . "&key_expired=1" );
|
79 |
+
?>" name="sub-form" method="post">
|
80 |
+
<fieldset style="border:0">
|
81 |
+
<p><label for="subscribe_reloaded_email"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
82 |
+
<input id='subscribe_reloaded_email' type="text" class="subscribe-form-field" name="sre" value="<?php echo isset( $_COOKIE['comment_author_email_' . COOKIEHASH] ) ? esc_attr( $_COOKIE['comment_author_email_' . COOKIEHASH] ) : ''; ?>" size="22" onfocus="if(this.value==this.defaultValue)this.value=''" onblur="if(this.value=='')this.value=this.defaultValue" />
|
83 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php esc_attr_e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
84 |
+
</p>
|
85 |
+
</fieldset>
|
86 |
+
</form>
|
87 |
+
<?php
|
88 |
+
}
|
89 |
+
$output = ob_get_contents();
|
90 |
+
ob_end_clean();
|
91 |
+
return $output;
|
92 |
+
?>
|
templates/request-management-link.php
CHANGED
@@ -1,275 +1,331 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Avoid direct access to this piece of code
|
4 |
-
if ( ! function_exists( 'add_action' ) ) {
|
5 |
-
header( 'Location: /' );
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
|
9 |
-
global $wp_subscribe_reloaded;
|
10 |
-
|
11 |
-
// The the page where the user is coming from
|
12 |
-
$post_permalink = null;
|
13 |
-
$current_user_email = null; // Comes from wp_subscribe-to-comments-reloaded\subscribe_reloaded_manage()
|
14 |
-
$ID = $target_post;
|
15 |
-
$valid_all = true;
|
16 |
-
$valid_email = true;
|
17 |
-
$valid_challenge = true;
|
18 |
-
|
19 |
-
// google recaptcha
|
20 |
-
$valid_captcha = true;
|
21 |
-
$captcha_output = '';
|
22 |
-
$use_captcha = get_option( 'subscribe_reloaded_use_captcha', 'no' );
|
23 |
-
$captcha_site_key = get_option( 'subscribe_reloaded_captcha_site_key', '' );
|
24 |
-
$captcha_secret_key = get_option( 'subscribe_reloaded_captcha_secret_key', '' );
|
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 |
-
|
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 |
-
|
274 |
-
|
275 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Avoid direct access to this piece of code
|
4 |
+
if ( ! function_exists( 'add_action' ) ) {
|
5 |
+
header( 'Location: /' );
|
6 |
+
exit;
|
7 |
+
}
|
8 |
+
|
9 |
+
global $wp_subscribe_reloaded;
|
10 |
+
|
11 |
+
// The the page where the user is coming from
|
12 |
+
$post_permalink = null;
|
13 |
+
$current_user_email = null; // Comes from wp_subscribe-to-comments-reloaded\subscribe_reloaded_manage()
|
14 |
+
$ID = $target_post;
|
15 |
+
$valid_all = true;
|
16 |
+
$valid_email = true;
|
17 |
+
$valid_challenge = true;
|
18 |
+
|
19 |
+
// google recaptcha
|
20 |
+
$valid_captcha = true;
|
21 |
+
$captcha_output = '';
|
22 |
+
$use_captcha = get_option( 'subscribe_reloaded_use_captcha', 'no' );
|
23 |
+
$captcha_site_key = get_option( 'subscribe_reloaded_captcha_site_key', '' );
|
24 |
+
$captcha_secret_key = get_option( 'subscribe_reloaded_captcha_secret_key', '' );
|
25 |
+
$recaptcha_version = get_option( 'subscribe_reloaded_recaptcha_version', 'v2' );
|
26 |
+
|
27 |
+
// google recaptcha confirm
|
28 |
+
if ( $use_captcha == 'yes' ) {
|
29 |
+
$captcha_output .= '<div class="g-recaptcha" data-sitekey="' . $captcha_site_key . '"></div>';
|
30 |
+
if ( 'v2' == $recaptcha_version ) {
|
31 |
+
if ( isset( $_POST['g-recaptcha-response'] ) ) {
|
32 |
+
$captcha = $_POST['g-recaptcha-response'];
|
33 |
+
$captcha_result = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
|
34 |
+
'method' => 'POST',
|
35 |
+
'body' => array(
|
36 |
+
'secret' => $captcha_secret_key,
|
37 |
+
'response' => $captcha,
|
38 |
+
)
|
39 |
+
));
|
40 |
+
if ( is_wp_error( $captcha_result ) ) {
|
41 |
+
$valid_captcha = false;
|
42 |
+
} else {
|
43 |
+
$captcha_response = json_decode( $captcha_result['body'], true );
|
44 |
+
if ( ! $captcha_response['success'] ) {
|
45 |
+
$valid_captcha = false;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
} elseif ( 'v3' == $recaptcha_version ) {
|
50 |
+
if ( isset( $_POST['token'] ) ) {
|
51 |
+
$captcha = $_POST['token'];
|
52 |
+
$action = $_POST['action'];
|
53 |
+
|
54 |
+
$captcha_result = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
|
55 |
+
'method' => 'POST',
|
56 |
+
'body' => array(
|
57 |
+
'secret' => $recaptcha_secret_key,
|
58 |
+
'response' => $captcha,
|
59 |
+
)
|
60 |
+
));
|
61 |
+
if ( is_wp_error( $captcha_result ) ) {
|
62 |
+
$valid_captcha = false;
|
63 |
+
} else {
|
64 |
+
$captcha_response = json_decode( $captcha_result['body'], true );
|
65 |
+
if ( ! $captcha_response['success'] || ! $captcha_response['action'] == $action || $captcha_response['score'] < 0.5 ) {
|
66 |
+
$valid_captcha = false;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
} else {
|
71 |
+
$valid_captcha = false;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
// get email if user known
|
76 |
+
if ( isset( $current_user ) && $current_user->ID > 0 ) {
|
77 |
+
$current_user_email = $current_user->data->user_email;
|
78 |
+
}
|
79 |
+
|
80 |
+
// post permalink supplied with $_GET
|
81 |
+
if ( array_key_exists('post_permalink', $_GET ) ) {
|
82 |
+
if ( ! empty( $_GET['post_permalink'] ) ) {
|
83 |
+
$post_permalink = $_GET['post_permalink'];
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
// challenge question
|
88 |
+
$challenge_question_state = get_option( 'subscribe_reloaded_use_challenge_question', 'no' );
|
89 |
+
$challenge_question = get_option( 'subscribe_reloaded_challenge_question', 'What is 1 + 2?' );
|
90 |
+
$challenge_answer = get_option( 'subscribe_reloaded_challenge_answer', '3' );
|
91 |
+
|
92 |
+
// start output buffering
|
93 |
+
ob_start();
|
94 |
+
|
95 |
+
// email address supplied
|
96 |
+
if ( ! empty( $email ) ) {
|
97 |
+
|
98 |
+
// check email validity
|
99 |
+
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $email );
|
100 |
+
|
101 |
+
// check challenge question validity
|
102 |
+
if ( $challenge_question_state == 'yes' ) {
|
103 |
+
$challenge_user_answer = sanitize_text_field( $_POST['subscribe_reloaded_challenge'] );
|
104 |
+
if ( $challenge_answer != $challenge_user_answer ) {
|
105 |
+
$valid_challenge = false;
|
106 |
+
$valid_all = false;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
// email is invalid
|
111 |
+
if ( $stcr_post_email === false ) {
|
112 |
+
$valid_email = false;
|
113 |
+
$valid_all = false;
|
114 |
+
}
|
115 |
+
|
116 |
+
// email is not subscribed
|
117 |
+
if ( ! $wp_subscribe_reloaded->stcr->utils->get_subscriber_key( $stcr_post_email ) ) {
|
118 |
+
$valid_email = false;
|
119 |
+
$valid_all = false;
|
120 |
+
}
|
121 |
+
|
122 |
+
// captcha is not valid
|
123 |
+
if ( ! $valid_captcha ) {
|
124 |
+
$valid_all = false;
|
125 |
+
}
|
126 |
+
|
127 |
+
if ( $valid_all ) {
|
128 |
+
|
129 |
+
// Send management link
|
130 |
+
$subject = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_subject', 'Manage your subscriptions on [blog_name]' ) ), ENT_QUOTES, 'UTF-8' );
|
131 |
+
$page_message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
132 |
+
$email_message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_management_email_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
133 |
+
$manager_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
134 |
+
$one_click_unsubscribe_link = $manager_link;
|
135 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
136 |
+
$manager_link = qtrans_convertURL( $manager_link );
|
137 |
+
}
|
138 |
+
|
139 |
+
$clean_email = $wp_subscribe_reloaded->stcr->utils->clean_email( $email );
|
140 |
+
$subscriber_salt = $wp_subscribe_reloaded->stcr->utils->generate_temp_key( $clean_email );
|
141 |
+
|
142 |
+
$manager_link .= ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?';
|
143 |
+
$manager_link .= "srek=" . $wp_subscribe_reloaded->stcr->utils->get_subscriber_key($clean_email) . "&srk=$subscriber_salt&srsrc=e&post_permalink=" . esc_url( $post_permalink );
|
144 |
+
$one_click_unsubscribe_link .= ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?';
|
145 |
+
$one_click_unsubscribe_link .= ( ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?' )
|
146 |
+
. "srek=" . esc_attr( $this->utils->get_subscriber_key( $clean_email ) )
|
147 |
+
. "&srk=$subscriber_salt" . "&sra=u;srsrc=e" . "&srp=";
|
148 |
+
|
149 |
+
// Replace tags with their actual values
|
150 |
+
$subject = str_replace( '[blog_name]', get_bloginfo( 'name' ), $subject );
|
151 |
+
$page_message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $page_message );
|
152 |
+
$email_message = str_replace( '[blog_name]', get_bloginfo( 'name' ), $email_message );
|
153 |
+
$email_message = str_replace( '[manager_link]', $manager_link, $email_message );
|
154 |
+
$email_message = str_replace( '[oneclick_link]', $one_click_unsubscribe_link, $email_message );
|
155 |
+
|
156 |
+
if ( get_option( 'subscribe_reloaded_enable_html_emails', 'yes' ) == 'yes' ) {
|
157 |
+
$email_message = wpautop( $email_message );
|
158 |
+
}
|
159 |
+
|
160 |
+
// QTranslate support
|
161 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
162 |
+
$subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $subject );
|
163 |
+
$page_message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $page_message );
|
164 |
+
$email_message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $email_message );
|
165 |
+
}
|
166 |
+
|
167 |
+
// Prepare email settings
|
168 |
+
$email_settings = array(
|
169 |
+
'subject' => $subject,
|
170 |
+
'message' => $email_message,
|
171 |
+
'toEmail' => $clean_email
|
172 |
+
);
|
173 |
+
|
174 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $clean_email );
|
175 |
+
// Send the confirmation email only if the email
|
176 |
+
// address is not in blacklist email list.
|
177 |
+
if ( $has_blacklist_email ) {
|
178 |
+
$wp_subscribe_reloaded->stcr->utils->send_email( $email_settings );
|
179 |
+
}
|
180 |
+
|
181 |
+
echo wpautop( $page_message );
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
// email address not supplied
|
186 |
+
} else {
|
187 |
+
|
188 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_request_mgmt_link' ) ), ENT_QUOTES, 'UTF-8' );
|
189 |
+
|
190 |
+
// get email address
|
191 |
+
$email = '';
|
192 |
+
if ( isset($current_user_email) ) {
|
193 |
+
$email = $current_user_email;
|
194 |
+
} else if ( isset( $_COOKIE['comment_author_email_' . COOKIEHASH] )) {
|
195 |
+
$email = sanitize_email( $_COOKIE['comment_author_email_' . COOKIEHASH] );
|
196 |
+
} else {
|
197 |
+
$email = '';
|
198 |
+
}
|
199 |
+
|
200 |
+
// qTrans compatibility
|
201 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
202 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
203 |
+
}
|
204 |
+
|
205 |
+
?>
|
206 |
+
<p><?php echo wpautop( $message ); ?></p>
|
207 |
+
<form action="<?php echo esc_url( $_SERVER[ 'REQUEST_URI' ]);?>" method="post" name="sub-form">
|
208 |
+
<fieldset style="border:0">
|
209 |
+
<?php if ( $challenge_question_state == 'yes' ) : ?>
|
210 |
+
<p>
|
211 |
+
<label for="subscribe_reloaded_email"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
212 |
+
<input id='subscribe_reloaded_email' type="email" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
213 |
+
</p>
|
214 |
+
<p>
|
215 |
+
<label for="subscribe-reloaded-challenge"><?php echo $challenge_question; ?></label>
|
216 |
+
<input id="subscribe-reloaded-challenge" type="text" class="subscribe-form-field" name="subscribe_reloaded_challenge" />
|
217 |
+
</p>
|
218 |
+
<p>
|
219 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php _e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
220 |
+
</p>
|
221 |
+
<?php echo $captcha_output; ?>
|
222 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold; display: none;'></p>
|
223 |
+
<?php else : ?>
|
224 |
+
<p>
|
225 |
+
<label for="subscribe_reloaded_email"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
226 |
+
<input id='subscribe_reloaded_email' type="email" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
227 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php _e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
228 |
+
</p>
|
229 |
+
<?php echo $captcha_output; ?>
|
230 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold; display: none;'></p>
|
231 |
+
<?php endif; ?>
|
232 |
+
|
233 |
+
</fieldset>
|
234 |
+
</form>
|
235 |
+
<?php
|
236 |
+
|
237 |
+
if ( isset( $post_permalink ) ) {
|
238 |
+
echo '<p id="subscribe-reloaded-update-p">
|
239 |
+
<a style="margin-right: 10px; text-decoration: none; box-shadow: unset;" href="'. esc_url( $post_permalink ) .'"><i class="fa fa-arrow-circle-left fa-2x" aria-hidden="true" style="vertical-align: middle;"></i> '. __('Return to Post','subscribe-to-comments-reloaded').'</a>
|
240 |
+
</p>';
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
if ( $use_captcha == 'yes' && $valid_captcha && 'v3' == $recaptcha_version ) {
|
246 |
+
?>
|
247 |
+
<div class="stcr-recaptcha">
|
248 |
+
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo esc_attr( $captcha_site_key ); ?>"></script>
|
249 |
+
<script>
|
250 |
+
jQuery(document).ready(function(){
|
251 |
+
jQuery('form.sub-form').on( 'submit', function(event) {
|
252 |
+
|
253 |
+
event.preventDefault();
|
254 |
+
var stcrForm = jQuery(this);
|
255 |
+
var stcrEmail = jQuery(this).find('#subscribe_reloaded_email').val();
|
256 |
+
|
257 |
+
grecaptcha.ready(function() {
|
258 |
+
grecaptcha.execute('<?php echo esc_attr( $captcha_site_key ); ?>', {action: 'management_link'}).then(function(token) {
|
259 |
+
stcrForm.prepend('<input type="hidden" name="token" value="' + token + '">');
|
260 |
+
stcrForm.prepend('<input type="hidden" name="action" value="management_link">');
|
261 |
+
stcrForm.unbind('submit').submit();
|
262 |
+
});
|
263 |
+
});
|
264 |
+
|
265 |
+
});
|
266 |
+
});
|
267 |
+
</script>
|
268 |
+
</div>
|
269 |
+
<?php
|
270 |
+
}
|
271 |
+
|
272 |
+
// email invalid
|
273 |
+
if( ! $valid_all ) {
|
274 |
+
|
275 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_request_mgmt_link' ) ), ENT_QUOTES, 'UTF-8' );
|
276 |
+
|
277 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
278 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
279 |
+
}
|
280 |
+
|
281 |
+
?>
|
282 |
+
<p><?php echo wpautop( $message ); ?></p>
|
283 |
+
<form action="<?php echo esc_url( $_SERVER[ 'REQUEST_URI' ]);?>" method="post" name="sub-form">
|
284 |
+
<fieldset style="border:0">
|
285 |
+
|
286 |
+
<?php if ( $challenge_question_state == 'yes' ) : ?>
|
287 |
+
<p>
|
288 |
+
<label for="subscribe_reloaded_email"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
289 |
+
<input id='subscribe_reloaded_email' type="email" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
290 |
+
</p>
|
291 |
+
<p>
|
292 |
+
<label for="subscribe-reloaded-challenge"><?php echo $challenge_question; ?></label>
|
293 |
+
<input id="subscribe-reloaded-challenge" type="text" class="subscribe-form-field" name="subscribe_reloaded_challenge" />
|
294 |
+
</p>
|
295 |
+
<p>
|
296 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php _e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
297 |
+
</p>
|
298 |
+
<?php echo $captcha_output; ?>
|
299 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold;'></p>
|
300 |
+
<?php else : ?>
|
301 |
+
<p>
|
302 |
+
<label for="subscribe_reloaded_email"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
303 |
+
<input id='subscribe_reloaded_email' type="email" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
304 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php _e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
305 |
+
</p>
|
306 |
+
<?php echo $captcha_output; ?>
|
307 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold;'></p>
|
308 |
+
<?php endif; ?>
|
309 |
+
|
310 |
+
<?php if ( ! $valid_email ) : ?>
|
311 |
+
<p style='color: #f55252;font-weight:bold;'><i class="fa fa-exclamation-triangle"></i> <?php _e("Email address is not valid", 'subscribe-to-comments-reloaded') ?></p>
|
312 |
+
<?php endif; ?>
|
313 |
+
|
314 |
+
<?php if ( ! $valid_challenge ) : ?>
|
315 |
+
<p style='color: #f55252;font-weight:bold;'><i class="fa fa-exclamation-triangle"></i> <?php _e("Challenge answer is not correct", 'subscribe-to-comments-reloaded') ?></p>
|
316 |
+
<?php endif; ?>
|
317 |
+
|
318 |
+
<?php if ( ! $valid_captcha ) : ?>
|
319 |
+
<p style='color: #f55252;font-weight:bold;'><i class="fa fa-exclamation-triangle"></i> <?php _e("Challenge answer is not correct", 'subscribe-to-comments-reloaded') ?></p>
|
320 |
+
<?php endif; ?>
|
321 |
+
|
322 |
+
</fieldset>
|
323 |
+
</form>
|
324 |
+
<?php
|
325 |
+
}
|
326 |
+
|
327 |
+
// stop output buffer and pass it back
|
328 |
+
$output = ob_get_contents();
|
329 |
+
ob_end_clean();
|
330 |
+
return $output;
|
331 |
+
?>
|
templates/subscribe.php
CHANGED
@@ -1,287 +1,343 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Avoid direct access to this piece of code
|
4 |
-
if ( ! function_exists( 'add_action' ) ) {
|
5 |
-
header( 'Location: /' );
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
|
9 |
-
global $wp_subscribe_reloaded;
|
10 |
-
|
11 |
-
$current_user_email = null; // Comes from wp_subscribe-to-comments-reloaded\subscribe_reloaded_manage()
|
12 |
-
$valid_all = true;
|
13 |
-
$valid_email = true;
|
14 |
-
$valid_challenge = true;
|
15 |
-
|
16 |
-
// google recaptcha
|
17 |
-
$valid_captcha = true;
|
18 |
-
$captcha_output = '';
|
19 |
-
$use_captcha = get_option( 'subscribe_reloaded_use_captcha', 'no' );
|
20 |
-
$captcha_site_key = get_option( 'subscribe_reloaded_captcha_site_key', '' );
|
21 |
-
$captcha_secret_key = get_option( 'subscribe_reloaded_captcha_secret_key', '' );
|
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 |
-
|
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 |
-
<?php
|
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 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
</
|
278 |
-
</
|
279 |
-
<?php
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Avoid direct access to this piece of code
|
4 |
+
if ( ! function_exists( 'add_action' ) ) {
|
5 |
+
header( 'Location: /' );
|
6 |
+
exit;
|
7 |
+
}
|
8 |
+
|
9 |
+
global $wp_subscribe_reloaded;
|
10 |
+
|
11 |
+
$current_user_email = null; // Comes from wp_subscribe-to-comments-reloaded\subscribe_reloaded_manage()
|
12 |
+
$valid_all = true;
|
13 |
+
$valid_email = true;
|
14 |
+
$valid_challenge = true;
|
15 |
+
|
16 |
+
// google recaptcha
|
17 |
+
$valid_captcha = true;
|
18 |
+
$captcha_output = '';
|
19 |
+
$use_captcha = get_option( 'subscribe_reloaded_use_captcha', 'no' );
|
20 |
+
$captcha_site_key = get_option( 'subscribe_reloaded_captcha_site_key', '' );
|
21 |
+
$captcha_secret_key = get_option( 'subscribe_reloaded_captcha_secret_key', '' );
|
22 |
+
$recaptcha_version = get_option( 'subscribe_reloaded_recaptcha_version', 'v2' );
|
23 |
+
|
24 |
+
if ( get_option( 'subscribe_reloaded_allow_subscribe_without_comment', 'yes' ) != 'yes' ) {
|
25 |
+
exit;
|
26 |
+
}
|
27 |
+
|
28 |
+
// google recaptcha confirm
|
29 |
+
if ( $use_captcha == 'yes' ) {
|
30 |
+
$captcha_output .= '<div class="g-recaptcha" data-sitekey="' . $captcha_site_key . '"></div>';
|
31 |
+
if ( 'v2' == $recaptcha_version ) {
|
32 |
+
if ( isset( $_POST['g-recaptcha-response'] ) ) {
|
33 |
+
$captcha = $_POST['g-recaptcha-response'];
|
34 |
+
$captcha_result = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
|
35 |
+
'method' => 'POST',
|
36 |
+
'body' => array(
|
37 |
+
'secret' => $captcha_secret_key,
|
38 |
+
'response' => $captcha,
|
39 |
+
)
|
40 |
+
));
|
41 |
+
if ( is_wp_error( $captcha_result ) ) {
|
42 |
+
$valid_captcha = false;
|
43 |
+
} else {
|
44 |
+
$captcha_response = json_decode( $captcha_result['body'], true );
|
45 |
+
if ( ! $captcha_response['success'] ) {
|
46 |
+
$valid_captcha = false;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
} elseif ( 'v3' == $recaptcha_version ) {
|
51 |
+
if ( isset( $_POST['token'] ) ) {
|
52 |
+
$captcha = $_POST['token'];
|
53 |
+
$action = $_POST['action'];
|
54 |
+
|
55 |
+
$captcha_result = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
|
56 |
+
'method' => 'POST',
|
57 |
+
'body' => array(
|
58 |
+
'secret' => $recaptcha_secret_key,
|
59 |
+
'response' => $captcha,
|
60 |
+
)
|
61 |
+
));
|
62 |
+
if ( is_wp_error( $captcha_result ) ) {
|
63 |
+
$valid_captcha = false;
|
64 |
+
} else {
|
65 |
+
$captcha_response = json_decode( $captcha_result['body'], true );
|
66 |
+
if ( ! $captcha_response['success'] || ! $captcha_response['action'] == $action || $captcha_response['score'] < 0.5 ) {
|
67 |
+
$valid_captcha = false;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
$valid_captcha = false;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
// get user email
|
77 |
+
if ( isset($current_user) && $current_user->ID > 0 ) {
|
78 |
+
$current_user_email = $current_user->data->user_email;
|
79 |
+
}
|
80 |
+
|
81 |
+
// get post permalink
|
82 |
+
$post_permalink = get_permalink( $post_ID );
|
83 |
+
|
84 |
+
// challenge question
|
85 |
+
$challenge_question_state = get_option( 'subscribe_reloaded_use_challenge_question', 'no' );
|
86 |
+
$challenge_question = get_option( 'subscribe_reloaded_challenge_question', 'What is 1 + 2?' );
|
87 |
+
$challenge_answer = get_option( 'subscribe_reloaded_challenge_answer', '3' );
|
88 |
+
|
89 |
+
// start output buffer
|
90 |
+
ob_start();
|
91 |
+
|
92 |
+
// email address supplied
|
93 |
+
if ( ! empty( $email ) ) {
|
94 |
+
|
95 |
+
// check email validity
|
96 |
+
$stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $email );
|
97 |
+
|
98 |
+
// check challenge question validity
|
99 |
+
if ( $challenge_question_state == 'yes' ) {
|
100 |
+
$challenge_user_answer = sanitize_text_field( $_POST['subscribe_reloaded_challenge'] );
|
101 |
+
if ( $challenge_answer != $challenge_user_answer ) {
|
102 |
+
$valid_challenge = false;
|
103 |
+
$valid_all = false;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// email is invalid
|
108 |
+
if ( $stcr_post_email === false ) {
|
109 |
+
$valid_email = false;
|
110 |
+
$valid_all = false;
|
111 |
+
}
|
112 |
+
|
113 |
+
// captcha is not valid
|
114 |
+
if ( ! $valid_captcha ) {
|
115 |
+
$valid_all = false;
|
116 |
+
}
|
117 |
+
|
118 |
+
// email is valid
|
119 |
+
if ( $valid_all ) {
|
120 |
+
|
121 |
+
// Use Akismet, if available, to check this user is legit
|
122 |
+
if ( function_exists( 'akismet_http_post' ) ) {
|
123 |
+
|
124 |
+
global $akismet_api_host, $akismet_api_port;
|
125 |
+
|
126 |
+
$akismet_query_string = "user_ip={$_SERVER['REMOTE_ADDR']}";
|
127 |
+
$akismet_query_string .= "&user_agent=" . esc_url( stripslashes( $_SERVER['HTTP_USER_AGENT'] ) );
|
128 |
+
$akismet_query_string .= "&blog=" . esc_url( get_option( 'home' ) );
|
129 |
+
$akismet_query_string .= "&blog_lang=" . get_locale();
|
130 |
+
$akismet_query_string .= "&blog_charset=" . get_option( 'blog_charset' );
|
131 |
+
$akismet_query_string .= "&permalink=".esc_url( $post_permalink );
|
132 |
+
$akismet_query_string .= "&comment_author_email=" . esc_url( sanitize_email( $email ) );
|
133 |
+
|
134 |
+
$akismet_response = akismet_http_post( $akismet_query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port );
|
135 |
+
|
136 |
+
// If this is considered SPAM, we stop here
|
137 |
+
if ( $akismet_response[1] == 'true' ) {
|
138 |
+
ob_end_clean();
|
139 |
+
return '';
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
// sanitize email address
|
145 |
+
$clean_email = $wp_subscribe_reloaded->stcr->utils->clean_email( $email );
|
146 |
+
|
147 |
+
// notify the administrator about the new subscription
|
148 |
+
if ( get_option( 'subscribe_reloaded_enable_admin_messages' ) == 'yes' ) {
|
149 |
+
|
150 |
+
$from_name = stripslashes( get_option( 'subscribe_reloaded_from_name', 'admin' ) );
|
151 |
+
$from_email = get_option( 'subscribe_reloaded_from_email', get_bloginfo( 'admin_email' ) );
|
152 |
+
|
153 |
+
$subject = __( 'New subscription to', 'subscribe-to-comments-reloaded' ) . " $target_post->post_title";
|
154 |
+
$message = __( 'New subscription to', 'subscribe-to-comments-reloaded' ) . " $target_post->post_title\n" . __( 'User:', 'subscribe-to-comments-reloaded' ) . " $clean_email";
|
155 |
+
|
156 |
+
$email_settings = array(
|
157 |
+
'subject' => $subject,
|
158 |
+
'message' => $message,
|
159 |
+
'toEmail' => get_bloginfo( 'admin_email' )
|
160 |
+
);
|
161 |
+
|
162 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $clean_email );
|
163 |
+
// Send the confirmation email only if the email
|
164 |
+
// address is not in blacklist email list.
|
165 |
+
if ( $has_blacklist_email ) {
|
166 |
+
$wp_subscribe_reloaded->stcr->utils->send_email( $email_settings );
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
// double check, send confirmation email
|
172 |
+
if ( get_option( 'subscribe_reloaded_enable_double_check' ) == 'yes' && ! $wp_subscribe_reloaded->stcr->is_user_subscribed( $post_ID, $clean_email, 'C' ) ) {
|
173 |
+
$wp_subscribe_reloaded->stcr->add_subscription( $post_ID, $clean_email, 'YC' );
|
174 |
+
$wp_subscribe_reloaded->stcr->confirmation_email( $post_ID, $clean_email );
|
175 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_subscription_confirmed_dci' ) ), ENT_QUOTES, 'UTF-8' );
|
176 |
+
|
177 |
+
// not double check, add subscription
|
178 |
+
} else {
|
179 |
+
$this->add_subscription( $post_ID, $clean_email, 'Y' );
|
180 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_subscription_confirmed' ) ), ENT_QUOTES, 'UTF-8' );
|
181 |
+
}
|
182 |
+
|
183 |
+
// new subscription message
|
184 |
+
$message = str_replace( '[post_permalink]', $post_permalink, $message );
|
185 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
186 |
+
$message = str_replace( '[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $target_post->post_title ), $message );
|
187 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
188 |
+
} else {
|
189 |
+
$message = str_replace( '[post_title]', $target_post->post_title, $message );
|
190 |
+
}
|
191 |
+
|
192 |
+
echo wpautop( $message );
|
193 |
+
|
194 |
+
}
|
195 |
+
|
196 |
+
// no email address supplied
|
197 |
+
} else {
|
198 |
+
|
199 |
+
// email value for input field
|
200 |
+
if ( isset( $current_user_email ) ) {
|
201 |
+
$email = $current_user_email;
|
202 |
+
} else if ( isset( $_COOKIE['comment_author_email_' . COOKIEHASH] )) {
|
203 |
+
$email = sanitize_email( $_COOKIE['comment_author_email_' . COOKIEHASH] );
|
204 |
+
} else {
|
205 |
+
$email = '';
|
206 |
+
}
|
207 |
+
|
208 |
+
// output message for subscribing without commenting
|
209 |
+
$message = str_replace( '[post_permalink]', $post_permalink, html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_subscribe_without_commenting' ) ), ENT_QUOTES, 'UTF-8' ) );
|
210 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
211 |
+
$message = str_replace( '[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $target_post->post_title ), $message );
|
212 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
213 |
+
} else {
|
214 |
+
$message = str_replace( '[post_title]', $target_post->post_title, $message );
|
215 |
+
}
|
216 |
+
echo '<p>' . $message . '</p>';
|
217 |
+
|
218 |
+
// output the form
|
219 |
+
|
220 |
+
|
221 |
+
?>
|
222 |
+
<form action="<?php echo esc_url( $_SERVER[ 'REQUEST_URI' ]); ?>" method="post" name="sub-form">
|
223 |
+
<fieldset style="border:0">
|
224 |
+
<div>
|
225 |
+
<?php if ( $challenge_question_state == 'yes' ) : ?>
|
226 |
+
<p>
|
227 |
+
<label for="sre"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
228 |
+
<input id='sre' type="text" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
229 |
+
</p>
|
230 |
+
<p>
|
231 |
+
<label for="subscribe-reloaded-challenge"><?php echo $challenge_question; ?></label>
|
232 |
+
<input id="subscribe-reloaded-challenge" type="text" class="subscribe-form-field" name="subscribe_reloaded_challenge" />
|
233 |
+
</p>
|
234 |
+
<p>
|
235 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php esc_attr_e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
236 |
+
</p>
|
237 |
+
<?php echo $captcha_output; ?>
|
238 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold; display: none;'></p>
|
239 |
+
<?php else : ?>
|
240 |
+
<p>
|
241 |
+
<label for="sre"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
242 |
+
<input id='sre' type="text" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
243 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php esc_attr_e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
244 |
+
</p>
|
245 |
+
<?php echo $captcha_output; ?>
|
246 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold; display: none;'></p>
|
247 |
+
<?php endif; ?>
|
248 |
+
</div>
|
249 |
+
</fieldset>
|
250 |
+
</form>
|
251 |
+
<?php
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
if ( $use_captcha == 'yes' && $valid_captcha && 'v3' == $recaptcha_version ) {
|
256 |
+
?>
|
257 |
+
<div class="stcr-recaptcha">
|
258 |
+
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo esc_attr( $captcha_site_key ); ?>"></script>
|
259 |
+
<script>
|
260 |
+
jQuery(document).ready(function(){
|
261 |
+
jQuery('form.sub-form').on( 'submit', function(event) {
|
262 |
+
|
263 |
+
event.preventDefault();
|
264 |
+
var stcrForm = jQuery(this);
|
265 |
+
var stcrEmail = jQuery(this).find('#sre').val();
|
266 |
+
|
267 |
+
grecaptcha.ready(function() {
|
268 |
+
grecaptcha.execute('<?php echo esc_attr( $captcha_site_key ); ?>', {action: 'subscribe'}).then(function(token) {
|
269 |
+
stcrForm.prepend('<input type="hidden" name="token" value="' + token + '">');
|
270 |
+
stcrForm.prepend('<input type="hidden" name="action" value="subscribe">');
|
271 |
+
stcrForm.unbind('submit').submit();
|
272 |
+
});
|
273 |
+
});
|
274 |
+
|
275 |
+
});
|
276 |
+
});
|
277 |
+
</script>
|
278 |
+
</div>
|
279 |
+
<?php
|
280 |
+
}
|
281 |
+
|
282 |
+
// invalid email
|
283 |
+
if ( ! $valid_all ) {
|
284 |
+
|
285 |
+
// message for subscribing without commenting
|
286 |
+
$message = str_replace( '[post_permalink]', $post_permalink, html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_subscribe_without_commenting' ) ), ENT_QUOTES, 'UTF-8' ) );
|
287 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
288 |
+
$message = str_replace( '[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $target_post->post_title ), $message );
|
289 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
290 |
+
} else {
|
291 |
+
$message = str_replace( '[post_title]', esc_html( $target_post->post_title ), $message );
|
292 |
+
}
|
293 |
+
echo '<p>' . $message . '</p>';
|
294 |
+
|
295 |
+
?>
|
296 |
+
<form action="<?php echo esc_url( $_SERVER[ 'REQUEST_URI' ]);?>" method="post" name="sub-form">
|
297 |
+
<fieldset style="border:0">
|
298 |
+
|
299 |
+
<?php if ( $challenge_question_state == 'yes' ) : ?>
|
300 |
+
<p>
|
301 |
+
<label for="sre"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
302 |
+
<input id='sre' type="text" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
303 |
+
</p>
|
304 |
+
<p>
|
305 |
+
<label for="subscribe-reloaded-challenge"><?php echo $challenge_question; ?></label>
|
306 |
+
<input id="subscribe-reloaded-challenge" type="text" class="subscribe-form-field" name="subscribe_reloaded_challenge" />
|
307 |
+
</p>
|
308 |
+
<p>
|
309 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php esc_attr_e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
310 |
+
</p>
|
311 |
+
<?php echo $captcha_output; ?>
|
312 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold; display: none;'></p>
|
313 |
+
<?php else : ?>
|
314 |
+
<label for="sre"><?php _e( 'Email', 'subscribe-to-comments-reloaded' ) ?></label>
|
315 |
+
<input id='sre' type="text" class="subscribe-form-field" name="sre" value="<?php echo esc_attr( $email ); ?>" size="22" required />
|
316 |
+
<input name="submit" type="submit" class="subscribe-form-button" value="<?php esc_attr_e( 'Send', 'subscribe-to-comments-reloaded' ) ?>" />
|
317 |
+
<?php echo $captcha_output; ?>
|
318 |
+
<p class="notice-email-error" style='color: #f55252;font-weight:bold; display: none;'></p>
|
319 |
+
<?php endif; ?>
|
320 |
+
|
321 |
+
<?php if ( ! $valid_email ) : ?>
|
322 |
+
<p style='color: #f55252;font-weight:bold;'><i class="fa fa-exclamation-triangle"></i> <?php _e("Email address is not valid", 'subscribe-to-comments-reloaded') ?></p>
|
323 |
+
<?php endif; ?>
|
324 |
+
|
325 |
+
<?php if ( ! $valid_challenge ) : ?>
|
326 |
+
<p style='color: #f55252;font-weight:bold;'><i class="fa fa-exclamation-triangle"></i> <?php _e("Challenge answer is not correct", 'subscribe-to-comments-reloaded') ?></p>
|
327 |
+
<?php endif; ?>
|
328 |
+
|
329 |
+
<?php if ( ! $valid_captcha ) : ?>
|
330 |
+
<p style='color: #f55252;font-weight:bold;'><i class="fa fa-exclamation-triangle"></i> <?php _e("Challenge answer is not correct", 'subscribe-to-comments-reloaded') ?></p>
|
331 |
+
<?php endif; ?>
|
332 |
+
|
333 |
+
</fieldset>
|
334 |
+
</form>
|
335 |
+
<?php
|
336 |
+
|
337 |
+
}
|
338 |
+
|
339 |
+
// stop output buffer and pass it back
|
340 |
+
$output = ob_get_contents();
|
341 |
+
ob_end_clean();
|
342 |
+
return $output;
|
343 |
+
?>
|
utils/stcr_manage.php
CHANGED
@@ -1,754 +1,773 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class with management functions for Subscribe to Comments Reloaded
|
4 |
-
* @author reedyseth
|
5 |
-
* @since 16-Jul-2015
|
6 |
-
* @version 160831
|
7 |
-
*/
|
8 |
-
namespace stcr;
|
9 |
-
// Avoid direct access to this piece of code
|
10 |
-
if ( ! function_exists( 'add_action' ) ) {
|
11 |
-
header( 'Location: /' );
|
12 |
-
exit;
|
13 |
-
}
|
14 |
-
|
15 |
-
require_once dirname(__FILE__).'/stcr_utils.php';
|
16 |
-
require_once dirname(__FILE__).'/stcr_upgrade.php';
|
17 |
-
|
18 |
-
if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_manage') )
|
19 |
-
{
|
20 |
-
class stcr_manage {
|
21 |
-
|
22 |
-
public $current_version = VERSION;
|
23 |
-
public $utils = null;
|
24 |
-
public $upgrade = null;
|
25 |
-
public $db_version = null;
|
26 |
-
public $fresh_install = false;
|
27 |
-
|
28 |
-
public function __construct() {
|
29 |
-
$this->upgrade = new stcr_upgrade();
|
30 |
-
$this->utils = new stcr_utils();
|
31 |
-
$this->db_version = get_option( 'subscribe_reloaded_version' );
|
32 |
-
if ( ! get_option( 'subscribe_reloaded_fresh_install' )
|
33 |
-
|| get_option( 'subscribe_reloaded_fresh_install' ) == 'yes')
|
34 |
-
{
|
35 |
-
$this->fresh_install = true;
|
36 |
-
}
|
37 |
-
else
|
38 |
-
{
|
39 |
-
$this->fresh_install = false;
|
40 |
-
update_option('subscribe_reloaded_fresh_install', 'no');
|
41 |
-
}
|
42 |
-
// Schedule the autopurge hook
|
43 |
-
if ( ! wp_next_scheduled( '_cron_subscribe_reloaded_purge' ) ) {
|
44 |
-
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_purge' );
|
45 |
-
// Let us bind the schedule event with our desire action.
|
46 |
-
wp_schedule_event( time() + 15, 'daily', '_cron_subscribe_reloaded_purge' );
|
47 |
-
}
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Search for a new version of code for a possible update
|
53 |
-
*/
|
54 |
-
public function stcr_admin_init() {
|
55 |
-
|
56 |
-
// Add Authors to custom posts types
|
57 |
-
if ( get_option( 'subscribe_reloaded_notify_authors' ) === 'yes' ) {
|
58 |
-
// Retrieve custom post types
|
59 |
-
$gpt_args = array('_builtin' => false);
|
60 |
-
$post_types = get_post_types( $gpt_args );
|
61 |
-
foreach ($post_types as $post_type_name) {
|
62 |
-
// Add author subscription in every post type
|
63 |
-
add_action( 'publish_' . $post_type_name , array( $this, 'subscribe_post_author' ) );
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
public function admin_notices() {
|
69 |
-
$notices = get_option( 'subscribe_reloaded_deferred_admin_notices' );
|
70 |
-
$nonce = null;
|
71 |
-
|
72 |
-
if ( $notices ) {
|
73 |
-
// Add JS script
|
74 |
-
wp_enqueue_script( 'stcr-admin-js' );
|
75 |
-
wp_enqueue_style( 'stcr-admin-style' );
|
76 |
-
|
77 |
-
foreach ( $notices as $name => $noticeData ) {
|
78 |
-
if( $noticeData['status'] == 'unread' ) {
|
79 |
-
$nonce = wp_create_nonce( $name );
|
80 |
-
// Set the a fresh nonce
|
81 |
-
$this->utils->stcr_update_admin_notice_status( $name, 'unread', $nonce );
|
82 |
-
echo "<div class='notice is-dismissible stcr-dismiss-notice {$noticeData['type']}' data-nonce='{$nonce}|{$name}'>";
|
83 |
-
echo $noticeData['message'];
|
84 |
-
echo "</div>";
|
85 |
-
}
|
86 |
-
}
|
87 |
-
update_option( 'subscribe_reloaded_deferred_admin_notices', $notices );
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Support for WP MU network activations (experimental)
|
93 |
-
*/
|
94 |
-
public function new_blog( $_blog_id ) {
|
95 |
-
switch_to_blog( $_blog_id );
|
96 |
-
$this->_activate();
|
97 |
-
restore_current_blog();
|
98 |
-
}
|
99 |
-
// end new_blog
|
100 |
-
|
101 |
-
public function sendConfirmationEMail( $info ) {
|
102 |
-
// Retrieve the information about the new comment
|
103 |
-
$this->confirmation_email( $info->comment_post_ID, $info->comment_author_email );
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Sends a message to confirm a subscription
|
108 |
-
*/
|
109 |
-
public function confirmation_email( $_post_ID = 0, $_email = '' ) {
|
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 |
-
$this->upgrade->
|
268 |
-
|
269 |
-
//
|
270 |
-
|
271 |
-
$this->upgrade->
|
272 |
-
|
273 |
-
//
|
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 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
__( '
|
371 |
-
|
372 |
-
|
373 |
-
"
|
374 |
-
|
375 |
-
|
376 |
-
__( '
|
377 |
-
|
378 |
-
|
379 |
-
"
|
380 |
-
|
381 |
-
|
382 |
-
__( '
|
383 |
-
|
384 |
-
|
385 |
-
"
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
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 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
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 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
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 |
-
|
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 |
-
public function
|
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 |
-
public function
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class with management functions for Subscribe to Comments Reloaded
|
4 |
+
* @author reedyseth
|
5 |
+
* @since 16-Jul-2015
|
6 |
+
* @version 160831
|
7 |
+
*/
|
8 |
+
namespace stcr;
|
9 |
+
// Avoid direct access to this piece of code
|
10 |
+
if ( ! function_exists( 'add_action' ) ) {
|
11 |
+
header( 'Location: /' );
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
require_once dirname(__FILE__).'/stcr_utils.php';
|
16 |
+
require_once dirname(__FILE__).'/stcr_upgrade.php';
|
17 |
+
|
18 |
+
if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_manage') )
|
19 |
+
{
|
20 |
+
class stcr_manage {
|
21 |
+
|
22 |
+
public $current_version = VERSION;
|
23 |
+
public $utils = null;
|
24 |
+
public $upgrade = null;
|
25 |
+
public $db_version = null;
|
26 |
+
public $fresh_install = false;
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
$this->upgrade = new stcr_upgrade();
|
30 |
+
$this->utils = new stcr_utils();
|
31 |
+
$this->db_version = get_option( 'subscribe_reloaded_version' );
|
32 |
+
if ( ! get_option( 'subscribe_reloaded_fresh_install' )
|
33 |
+
|| get_option( 'subscribe_reloaded_fresh_install' ) == 'yes')
|
34 |
+
{
|
35 |
+
$this->fresh_install = true;
|
36 |
+
}
|
37 |
+
else
|
38 |
+
{
|
39 |
+
$this->fresh_install = false;
|
40 |
+
update_option('subscribe_reloaded_fresh_install', 'no');
|
41 |
+
}
|
42 |
+
// Schedule the autopurge hook
|
43 |
+
if ( ! wp_next_scheduled( '_cron_subscribe_reloaded_purge' ) ) {
|
44 |
+
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_purge' );
|
45 |
+
// Let us bind the schedule event with our desire action.
|
46 |
+
wp_schedule_event( time() + 15, 'daily', '_cron_subscribe_reloaded_purge' );
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Search for a new version of code for a possible update
|
53 |
+
*/
|
54 |
+
public function stcr_admin_init() {
|
55 |
+
|
56 |
+
// Add Authors to custom posts types
|
57 |
+
if ( get_option( 'subscribe_reloaded_notify_authors' ) === 'yes' ) {
|
58 |
+
// Retrieve custom post types
|
59 |
+
$gpt_args = array('_builtin' => false);
|
60 |
+
$post_types = get_post_types( $gpt_args );
|
61 |
+
foreach ($post_types as $post_type_name) {
|
62 |
+
// Add author subscription in every post type
|
63 |
+
add_action( 'publish_' . $post_type_name , array( $this, 'subscribe_post_author' ) );
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
public function admin_notices() {
|
69 |
+
$notices = get_option( 'subscribe_reloaded_deferred_admin_notices' );
|
70 |
+
$nonce = null;
|
71 |
+
|
72 |
+
if ( $notices ) {
|
73 |
+
// Add JS script
|
74 |
+
wp_enqueue_script( 'stcr-admin-js' );
|
75 |
+
wp_enqueue_style( 'stcr-admin-style' );
|
76 |
+
|
77 |
+
foreach ( $notices as $name => $noticeData ) {
|
78 |
+
if( $noticeData['status'] == 'unread' ) {
|
79 |
+
$nonce = wp_create_nonce( $name );
|
80 |
+
// Set the a fresh nonce
|
81 |
+
$this->utils->stcr_update_admin_notice_status( $name, 'unread', $nonce );
|
82 |
+
echo "<div class='notice is-dismissible stcr-dismiss-notice {$noticeData['type']}' data-nonce='{$nonce}|{$name}'>";
|
83 |
+
echo $noticeData['message'];
|
84 |
+
echo "</div>";
|
85 |
+
}
|
86 |
+
}
|
87 |
+
update_option( 'subscribe_reloaded_deferred_admin_notices', $notices );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Support for WP MU network activations (experimental)
|
93 |
+
*/
|
94 |
+
public function new_blog( $_blog_id ) {
|
95 |
+
switch_to_blog( $_blog_id );
|
96 |
+
$this->_activate();
|
97 |
+
restore_current_blog();
|
98 |
+
}
|
99 |
+
// end new_blog
|
100 |
+
|
101 |
+
public function sendConfirmationEMail( $info ) {
|
102 |
+
// Retrieve the information about the new comment.
|
103 |
+
$this->confirmation_email( $info->comment_post_ID, $info->comment_author_email );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Sends a message to confirm a subscription
|
108 |
+
*/
|
109 |
+
public function confirmation_email( $_post_ID = 0, $_email = '' ) {
|
110 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $_email );
|
111 |
+
// Do not proceed on sending the confirmation email if the email
|
112 |
+
// address is in blacklist email list.
|
113 |
+
if ( false === $has_blacklist_email ) {
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
+
// Retrieve the options from the database
|
118 |
+
$from_name = stripslashes( get_option( 'subscribe_reloaded_from_name', 'admin' ) );
|
119 |
+
$from_email = get_option( 'subscribe_reloaded_from_email', get_bloginfo( 'admin_email' ) );
|
120 |
+
$subject = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_double_check_subject', 'Please confirm your subscribtion to [post_title]' ) ), ENT_COMPAT, 'UTF-8' );
|
121 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_double_check_content', '' ) ), ENT_COMPAT, 'UTF-8' );
|
122 |
+
$manager_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
123 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
124 |
+
$manager_link = qtrans_convertURL( $manager_link );
|
125 |
+
}
|
126 |
+
|
127 |
+
$clean_email = $this->utils->clean_email( $_email );
|
128 |
+
$subscriber_salt = $this->utils->generate_temp_key( $clean_email );
|
129 |
+
|
130 |
+
$this->utils->add_user_subscriber_table( $clean_email );
|
131 |
+
|
132 |
+
$post = get_post( $_post_ID );
|
133 |
+
$post_permalink = get_permalink( $_post_ID );
|
134 |
+
|
135 |
+
$manager_link .= ( ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?' ) . "srek=" . $this->utils->get_subscriber_key( $clean_email ) . "&srk=" . $subscriber_salt;
|
136 |
+
$confirm_link = "$manager_link&srp=$_post_ID&sra=c&srsrc=e&confirmation_email=y&post_permalink=" . esc_url( $post_permalink );
|
137 |
+
|
138 |
+
|
139 |
+
// Replace tags with their actual values
|
140 |
+
$subject = str_replace( '[post_title]', $post->post_title, $subject );
|
141 |
+
|
142 |
+
$message = str_replace( '[post_permalink]', $post_permalink, $message );
|
143 |
+
$message = str_replace( '[confirm_link]', $confirm_link, $message );
|
144 |
+
$message = str_replace( '[manager_link]', $manager_link, $message );
|
145 |
+
|
146 |
+
// QTranslate support
|
147 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
148 |
+
$subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $subject );
|
149 |
+
$message = str_replace( '[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $post->post_title ), $message );
|
150 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
151 |
+
} else {
|
152 |
+
$message = str_replace( '[post_title]', $post->post_title, $message );
|
153 |
+
}
|
154 |
+
$message = apply_filters( 'stcr_confirmation_email_message', $message, $_post_ID, $clean_email );
|
155 |
+
|
156 |
+
// Prepare email settings
|
157 |
+
$email_settings = array(
|
158 |
+
'subject' => $subject,
|
159 |
+
'message' => $message,
|
160 |
+
'toEmail' => $clean_email,
|
161 |
+
'XPostId' => $_post_ID
|
162 |
+
);
|
163 |
+
$this->utils->send_email( $email_settings );
|
164 |
+
}
|
165 |
+
// end confirmation_email
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Support for WP MU network activations (experimental)
|
169 |
+
*/
|
170 |
+
public function activate() {
|
171 |
+
global $wpdb;
|
172 |
+
|
173 |
+
if ( function_exists( 'is_multisite' ) && is_multisite() && isset( $_GET['networkwide'] ) && ( $_GET['networkwide'] == 1 ) ) {
|
174 |
+
$blogids = $wpdb->get_col(
|
175 |
+
$wpdb->prepare(
|
176 |
+
"
|
177 |
+
SELECT blog_id
|
178 |
+
FROM $wpdb->blogs
|
179 |
+
WHERE site_id = %d
|
180 |
+
AND deleted = 0
|
181 |
+
AND spam = 0", $wpdb->siteid
|
182 |
+
)
|
183 |
+
);
|
184 |
+
|
185 |
+
foreach ( $blogids as $blog_id ) {
|
186 |
+
switch_to_blog( $blog_id );
|
187 |
+
$this->_activate();
|
188 |
+
}
|
189 |
+
restore_current_blog();
|
190 |
+
} else {
|
191 |
+
$this->_activate();
|
192 |
+
}
|
193 |
+
}
|
194 |
+
// end activate
|
195 |
+
/**
|
196 |
+
* Adds the options to the database and imports the data from other plugins
|
197 |
+
*/
|
198 |
+
public function _activate() {
|
199 |
+
// Load localization files
|
200 |
+
// load_plugin_textdomain( 'subscribe-to-comments-reloaded', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
|
201 |
+
// Upgrade rountine
|
202 |
+
$this->upgrade();
|
203 |
+
|
204 |
+
delete_option('subscribe_reloaded_unique_key');
|
205 |
+
|
206 |
+
$this->utils->create_options();
|
207 |
+
}
|
208 |
+
/**
|
209 |
+
* Performs some clean-up maintenance (disable cron job).
|
210 |
+
*/
|
211 |
+
public function deactivate() {
|
212 |
+
global $wpdb;
|
213 |
+
if ( function_exists( 'is_multisite' ) && is_multisite() && isset( $_GET['networkwide'] ) && ( $_GET['networkwide'] == 1 ) ) {
|
214 |
+
$blogids = $wpdb->get_col(
|
215 |
+
$wpdb->prepare(
|
216 |
+
"
|
217 |
+
SELECT blog_id
|
218 |
+
FROM $wpdb->blogs
|
219 |
+
WHERE site_id = %d
|
220 |
+
AND deleted = 0
|
221 |
+
AND spam = 0", $wpdb->siteid
|
222 |
+
)
|
223 |
+
);
|
224 |
+
|
225 |
+
foreach ( $blogids as $blog_id ) {
|
226 |
+
switch_to_blog( $blog_id );
|
227 |
+
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_purge' );
|
228 |
+
wp_clear_scheduled_hook( '_cron_log_file_purge' );
|
229 |
+
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_system_report_file_purge' );
|
230 |
+
|
231 |
+
}
|
232 |
+
restore_current_blog();
|
233 |
+
} else {
|
234 |
+
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_purge' );
|
235 |
+
wp_clear_scheduled_hook( '_cron_log_file_purge' );
|
236 |
+
wp_clear_scheduled_hook( '_cron_subscribe_reloaded_system_report_file_purge' );
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
// end deactivate
|
241 |
+
|
242 |
+
public function maybe_update()
|
243 |
+
{
|
244 |
+
$int_db_version = str_replace('.','', $this->db_version) ;
|
245 |
+
$int_curr_version = str_replace('.','', $this->current_version) ;
|
246 |
+
|
247 |
+
if ( empty ( $int_db_version ) || (int) $int_db_version < (int) $int_curr_version ) {
|
248 |
+
// // Do whatever upgrades needed here.
|
249 |
+
// $this->_activate();
|
250 |
+
// Send the current version to display the appropiate message
|
251 |
+
// The notification will only be visible once there is an update not a activation.
|
252 |
+
$this->upgrade->upgrade_notification( $this->current_version, $this->db_version, $this->fresh_install );
|
253 |
+
$this->upgrade();
|
254 |
+
update_option( 'subscribe_reloaded_version', $this->current_version );
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
private function upgrade()
|
259 |
+
{
|
260 |
+
// Import data from the WP Comment Subscriptions plugin, if needed
|
261 |
+
$this->upgrade->_import_wpcs_data();
|
262 |
+
|
263 |
+
// Import data from Subscribe to Comments & Co., if needed
|
264 |
+
$this->upgrade->_import_stc_data();
|
265 |
+
|
266 |
+
// Import data from Subscribe to Comments by Mark Jaquith
|
267 |
+
$this->upgrade->_import_stc_mj_data();
|
268 |
+
|
269 |
+
// Import data from Comment Reply Notification, if needed
|
270 |
+
// Function deprecated and not in use anymore.
|
271 |
+
// $this->upgrade->_import_crn_data();
|
272 |
+
|
273 |
+
// Starting from version 2.0 StCR uses Wordpress' tables to store the information about subscriptions
|
274 |
+
$this->upgrade->_update_db();
|
275 |
+
|
276 |
+
// Since there are some users with the database corrupted due to encoding stuff we need to sanitize
|
277 |
+
// their information
|
278 |
+
$this->upgrade->_sanitize_db_information( $this->fresh_install );
|
279 |
+
// Create a new table if not exists to manage the subscribers safer
|
280 |
+
// First Check if the subscribers table is created.
|
281 |
+
if ( ! get_option( 'subscribe_reloaded_subscriber_table' ) || get_option( 'subscribe_reloaded_subscriber_table' ) == 'no') {
|
282 |
+
$this->upgrade->_create_subscriber_table( $this->fresh_install );
|
283 |
+
}
|
284 |
+
// Apply Patches
|
285 |
+
$this->upgrade->apply_patches();
|
286 |
+
|
287 |
+
// Migrate/Add new plugin options on version upgrade.
|
288 |
+
$this->upgrade->email_blacklist_post_types_recaptcha();
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Remove the log file created by StCR
|
293 |
+
* @since 05-Apr-2017
|
294 |
+
*/
|
295 |
+
public function log_file_purge()
|
296 |
+
{
|
297 |
+
$plugin_dir = plugin_dir_path( __DIR__ );
|
298 |
+
$file_name = "log.txt";
|
299 |
+
$file_path = $plugin_dir . "utils/" . $file_name;
|
300 |
+
|
301 |
+
if( file_exists( $file_path ) && is_writable( $plugin_dir ) )
|
302 |
+
{
|
303 |
+
// unlink the file
|
304 |
+
unlink($file_path);
|
305 |
+
}
|
306 |
+
}
|
307 |
+
/**
|
308 |
+
* Removes old entries from the database
|
309 |
+
*/
|
310 |
+
public function subscribe_reloaded_purge() {
|
311 |
+
global $wpdb;
|
312 |
+
|
313 |
+
if ( ( $autopurge_interval = intval( get_option( 'subscribe_reloaded_purge_days', 0 ) ) ) <= 0 ) {
|
314 |
+
return true;
|
315 |
+
}
|
316 |
+
|
317 |
+
// First retrieve the emails to be deleted
|
318 |
+
$emailsToPurge = "SELECT DISTINCT REPLACE(meta_key, '_stcr@_', '') AS email FROM $wpdb->postmeta
|
319 |
+
WHERE meta_key LIKE '\_stcr@\_%'
|
320 |
+
AND STR_TO_DATE(meta_value, '%Y-%m-%d %H:%i:%s') <= DATE_SUB(NOW(),
|
321 |
+
INTERVAL $autopurge_interval DAY) AND meta_value LIKE '%C'";
|
322 |
+
|
323 |
+
$emails = $wpdb->get_results( $emailsToPurge, OBJECT );
|
324 |
+
// Now if there are emails go ahead and delete them
|
325 |
+
if ( ! empty( $emails ) && is_array( $emails ) ) {
|
326 |
+
foreach( $emails as $row ) {
|
327 |
+
$this->utils->remove_user_subscriber_table($row->email);
|
328 |
+
}
|
329 |
+
}
|
330 |
+
// Delete old entries on the post_meta table
|
331 |
+
$wpdb->query(
|
332 |
+
"
|
333 |
+
DELETE FROM $wpdb->postmeta
|
334 |
+
WHERE meta_key LIKE '\_stcr@\_%'
|
335 |
+
AND STR_TO_DATE(meta_value, '%Y-%m-%d %H:%i:%s') <= DATE_SUB(NOW(), INTERVAL $autopurge_interval DAY) AND meta_value LIKE '%C'"
|
336 |
+
);
|
337 |
+
}
|
338 |
+
// end subscribe_reloaded_purge
|
339 |
+
/**
|
340 |
+
* Finds all links in text and wraps them with an HTML anchor tag
|
341 |
+
*
|
342 |
+
* @param unknown $text
|
343 |
+
*
|
344 |
+
* @return string Text with all links wrapped in HTML anchor tags
|
345 |
+
*
|
346 |
+
*/
|
347 |
+
public function htmlify_message_links( $text ) {
|
348 |
+
return preg_replace( '!(((f|ht)tp(s)?://)[-a-zA-Z?-??-?()0-9@:%_+.~#?&;//=]+)!i', '<a href="$1">$1</a>', $text );
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Adds a new entry in the admin menu, to manage this plugin's options
|
353 |
+
*/
|
354 |
+
public function add_config_menu( $_s ) {
|
355 |
+
|
356 |
+
if ( current_user_can( 'manage_options' ) ) {
|
357 |
+
|
358 |
+
$page_title = "Subscribe to Comments Reloaded";
|
359 |
+
$menu_title = "StCR";
|
360 |
+
$capability = "manage_options";
|
361 |
+
$moderate_capability = 'manage_options';
|
362 |
+
$function = "";
|
363 |
+
$icon_url = "dashicons-email";
|
364 |
+
$position = 26;
|
365 |
+
$parent_slug= "stcr_manage_subscriptions";
|
366 |
+
add_menu_page( $page_title, $menu_title, $moderate_capability, $parent_slug, $function, $icon_url, $position );
|
367 |
+
|
368 |
+
add_submenu_page( $parent_slug ,
|
369 |
+
__( 'Manage subscriptions', 'subscribe-to-comments-reloaded' ),
|
370 |
+
__( 'Manage subscriptions', 'subscribe-to-comments-reloaded' ),
|
371 |
+
$moderate_capability,
|
372 |
+
"stcr_manage_subscriptions",
|
373 |
+
array( $this, "stcr_option_manage_subscriptions") );
|
374 |
+
add_submenu_page( $parent_slug ,
|
375 |
+
__( 'Comment Form', 'subscribe-to-comments-reloaded' ),
|
376 |
+
__( 'Comment Form', 'subscribe-to-comments-reloaded' ),
|
377 |
+
$capability,
|
378 |
+
"stcr_comment_form",
|
379 |
+
array( $this, "stcr_option_comment_form" ) );
|
380 |
+
add_submenu_page( $parent_slug ,
|
381 |
+
__( 'Management Page', 'subscribe-to-comments-reloaded' ),
|
382 |
+
__( 'Management Page', 'subscribe-to-comments-reloaded' ),
|
383 |
+
$capability,
|
384 |
+
"stcr_management_page",
|
385 |
+
array( $this, "stcr_option_management_page" ) );
|
386 |
+
add_submenu_page( $parent_slug ,
|
387 |
+
__( 'Notifications', 'subscribe-to-comments-reloaded' ),
|
388 |
+
__( 'Notifications', 'subscribe-to-comments-reloaded' ),
|
389 |
+
$capability,
|
390 |
+
"stcr_notifications",
|
391 |
+
array( $this, "stcr_option_notifications" ) );
|
392 |
+
add_submenu_page( $parent_slug ,
|
393 |
+
__( 'Options', 'subscribe-to-comments-reloaded' ),
|
394 |
+
__( 'Options', 'subscribe-to-comments-reloaded' ),
|
395 |
+
$capability,
|
396 |
+
"stcr_options",
|
397 |
+
array( $this, "stcr_option_options" ) );
|
398 |
+
// @since 160316
|
399 |
+
// Using this page requires to list a cool table, on this case will be the WP_List_Table,
|
400 |
+
// since this requires much effort this is pointe to go to the pro version. NO ETA avaiable.
|
401 |
+
//
|
402 |
+
// add_submenu_page( $parent_slug ,
|
403 |
+
// __( 'Subscribers Emails', 'subscribe-to-comments-reloaded' ),
|
404 |
+
// __( 'Subscribers Emails', 'subscribe-to-comments-reloaded' ),
|
405 |
+
// $capability,
|
406 |
+
// "stcr_subscribers_emails",
|
407 |
+
// array( $this, "stcr_option_subscribers_emails" ) );
|
408 |
+
|
409 |
+
add_submenu_page( $parent_slug ,
|
410 |
+
__( 'Support', 'subscribe-to-comments-reloaded' ),
|
411 |
+
__( 'Support', 'subscribe-to-comments-reloaded' ),
|
412 |
+
$capability,
|
413 |
+
"stcr_support",
|
414 |
+
array( $this, "stcr_option_support" ) );
|
415 |
+
// add_submenu_page( $parent_slug ,
|
416 |
+
// __( 'Donate', 'subscribe-to-comments-reloaded' ),
|
417 |
+
// __( 'Donate', 'subscribe-to-comments-reloaded' ),
|
418 |
+
// $capability,
|
419 |
+
// "stcr_donate",
|
420 |
+
// array( $this, "stcr_option_donate" ) );
|
421 |
+
add_submenu_page( $parent_slug ,
|
422 |
+
__( 'StCR System', 'subscribe-to-comments-reloaded' ),
|
423 |
+
__( 'StCR System', 'subscribe-to-comments-reloaded' ),
|
424 |
+
$capability,
|
425 |
+
"stcr_system",
|
426 |
+
array( $this, "stcr_option_system" ) );
|
427 |
+
}
|
428 |
+
|
429 |
+
return $_s;
|
430 |
+
}
|
431 |
+
// end add_config_menu
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Dispaly the stcr_option_manage_subscriptions template
|
435 |
+
* @since 160316
|
436 |
+
* @author reedyseth
|
437 |
+
*/
|
438 |
+
public function stcr_option_manage_subscriptions()
|
439 |
+
{
|
440 |
+
//must check that the user has the required capability
|
441 |
+
if (!current_user_can('manage_options'))
|
442 |
+
{
|
443 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
444 |
+
}
|
445 |
+
|
446 |
+
$this->add_options_stylesheet();
|
447 |
+
global $wp_subscribe_reloaded;
|
448 |
+
|
449 |
+
// echo 'New Page Settings';
|
450 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
451 |
+
{
|
452 |
+
// What panel to display
|
453 |
+
$current_panel = 2;
|
454 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
455 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_manage_subscriptions.php' ) )
|
456 |
+
{
|
457 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_manage_subscriptions.php';
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
/**
|
462 |
+
* Dispaly the stcr_option_comment_form template
|
463 |
+
* @since 160316
|
464 |
+
* @author reedyseth
|
465 |
+
*/
|
466 |
+
public function stcr_option_comment_form()
|
467 |
+
{
|
468 |
+
//must check that the user has the required capability
|
469 |
+
if (!current_user_can('manage_options'))
|
470 |
+
{
|
471 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
472 |
+
}
|
473 |
+
|
474 |
+
$this->add_options_stylesheet();
|
475 |
+
|
476 |
+
// echo 'New Page Settings';
|
477 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
478 |
+
{
|
479 |
+
// What panel to display
|
480 |
+
$current_panel = 2;
|
481 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
482 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_comment_form.php' ) )
|
483 |
+
{
|
484 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_comment_form.php';
|
485 |
+
}
|
486 |
+
}
|
487 |
+
}
|
488 |
+
/**
|
489 |
+
* Dispaly the stcr_option_management_page template
|
490 |
+
* @since 160316
|
491 |
+
* @author reedyseth
|
492 |
+
*/
|
493 |
+
public function stcr_option_management_page()
|
494 |
+
{
|
495 |
+
//must check that the user has the required capability
|
496 |
+
if (!current_user_can('manage_options'))
|
497 |
+
{
|
498 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
499 |
+
}
|
500 |
+
|
501 |
+
$this->add_options_stylesheet();
|
502 |
+
|
503 |
+
// echo 'New Page Settings';
|
504 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
505 |
+
{
|
506 |
+
// What panel to display
|
507 |
+
$current_panel = 2;
|
508 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
509 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_management_page.php' ) )
|
510 |
+
{
|
511 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_management_page.php';
|
512 |
+
}
|
513 |
+
}
|
514 |
+
}
|
515 |
+
/**
|
516 |
+
* Dispaly the stcr_option_notifications template
|
517 |
+
* @since 160316
|
518 |
+
* @author reedyseth
|
519 |
+
*/
|
520 |
+
public function stcr_option_notifications()
|
521 |
+
{
|
522 |
+
//must check that the user has the required capability
|
523 |
+
if (!current_user_can('manage_options'))
|
524 |
+
{
|
525 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
526 |
+
}
|
527 |
+
|
528 |
+
$this->add_options_stylesheet();
|
529 |
+
|
530 |
+
// echo 'New Page Settings';
|
531 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
532 |
+
{
|
533 |
+
// What panel to display
|
534 |
+
$current_panel = 2;
|
535 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
536 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_notifications.php' ) )
|
537 |
+
{
|
538 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_notifications.php';
|
539 |
+
}
|
540 |
+
}
|
541 |
+
}
|
542 |
+
/**
|
543 |
+
* Dispaly the stcr_option_options template
|
544 |
+
* @since 160316
|
545 |
+
* @author reedyseth
|
546 |
+
*/
|
547 |
+
public function stcr_option_options()
|
548 |
+
{
|
549 |
+
//must check that the user has the required capability
|
550 |
+
if (!current_user_can('manage_options'))
|
551 |
+
{
|
552 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
553 |
+
}
|
554 |
+
|
555 |
+
$this->add_options_stylesheet();
|
556 |
+
|
557 |
+
// echo 'New Page Settings';
|
558 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
559 |
+
{
|
560 |
+
// What panel to display
|
561 |
+
$current_panel = 2;
|
562 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
563 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_options.php' ) )
|
564 |
+
{
|
565 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_options.php';
|
566 |
+
}
|
567 |
+
}
|
568 |
+
}
|
569 |
+
/**
|
570 |
+
* Dispaly the stcr_option_support template
|
571 |
+
* @since 160316
|
572 |
+
* @author reedyseth
|
573 |
+
*/
|
574 |
+
public function stcr_option_support()
|
575 |
+
{
|
576 |
+
//must check that the user has the required capability
|
577 |
+
if (!current_user_can('manage_options'))
|
578 |
+
{
|
579 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
580 |
+
}
|
581 |
+
|
582 |
+
$this->add_options_stylesheet();
|
583 |
+
|
584 |
+
// echo 'New Page Settings';
|
585 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
586 |
+
{
|
587 |
+
// What panel to display
|
588 |
+
$current_panel = 2;
|
589 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
590 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_support.php' ) )
|
591 |
+
{
|
592 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_support.php';
|
593 |
+
}
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Dispaly the stcr_option_donate template
|
600 |
+
* @since 160524
|
601 |
+
* @author reedyseth
|
602 |
+
*/
|
603 |
+
public function stcr_option_system()
|
604 |
+
{
|
605 |
+
//must check that the user has the required capability
|
606 |
+
if (!current_user_can('manage_options'))
|
607 |
+
{
|
608 |
+
wp_die( __('You do not have sufficient permissions to access this page.') );
|
609 |
+
}
|
610 |
+
|
611 |
+
$this->add_options_stylesheet();
|
612 |
+
|
613 |
+
// echo 'New Page Settings';
|
614 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php' ) )
|
615 |
+
{
|
616 |
+
// What panel to display
|
617 |
+
$current_panel = 2;
|
618 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/index.php';
|
619 |
+
if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_system.php' ) )
|
620 |
+
{
|
621 |
+
require_once trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/stcr_system.php';
|
622 |
+
}
|
623 |
+
}
|
624 |
+
}
|
625 |
+
|
626 |
+
/**
|
627 |
+
* Download system information file
|
628 |
+
*
|
629 |
+
* @since 190325
|
630 |
+
* @return void
|
631 |
+
*/
|
632 |
+
function sysinfo_download() {
|
633 |
+
|
634 |
+
if ( ! isset( $_POST['stcr_sysinfo_action'] ) ) {
|
635 |
+
return;
|
636 |
+
}
|
637 |
+
|
638 |
+
if ( $_POST['stcr_sysinfo_action'] != 'download_sysinfo' ) {
|
639 |
+
return;
|
640 |
+
}
|
641 |
+
|
642 |
+
if ( empty( $_POST['stcr_download_sysinfo_nonce'] ) ) {
|
643 |
+
return;
|
644 |
+
}
|
645 |
+
|
646 |
+
if ( ! wp_verify_nonce( $_POST['stcr_download_sysinfo_nonce'], 'stcr_download_sysinfo_nonce' ) ) {
|
647 |
+
return;
|
648 |
+
}
|
649 |
+
|
650 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
651 |
+
return;
|
652 |
+
}
|
653 |
+
|
654 |
+
nocache_headers();
|
655 |
+
|
656 |
+
header( 'Content-Type: text/plain' );
|
657 |
+
header( 'Content-Disposition: attachment; filename="stcr-sysinfo.txt"' );
|
658 |
+
|
659 |
+
echo stripslashes( $_POST['stcr_sysinfo'] );
|
660 |
+
|
661 |
+
exit;
|
662 |
+
|
663 |
+
}
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Adds a custom stylesheet file to the admin interface
|
667 |
+
*/
|
668 |
+
public function add_options_stylesheet() {
|
669 |
+
$stylesheet_url = plugins_url( '/style.css', STCR_PLUGIN_FILE );
|
670 |
+
wp_register_style( 'subscribe-to-comments', $stylesheet_url );
|
671 |
+
wp_enqueue_style( 'subscribe-to-comments' );
|
672 |
+
}
|
673 |
+
|
674 |
+
public function add_post_comments_stylesheet() {
|
675 |
+
$stylesheet_url = plugins_url( '/post-and-comments.css', STCR_PLUGIN_FILE );
|
676 |
+
wp_register_style( 'subscribe-to-comments', $stylesheet_url );
|
677 |
+
wp_enqueue_style( 'subscribe-to-comments' );
|
678 |
+
}
|
679 |
+
// end add_stylesheet
|
680 |
+
|
681 |
+
/**
|
682 |
+
* Adds custom HTML code to the HEAD section of the management page
|
683 |
+
*/
|
684 |
+
public function add_custom_header_meta() {
|
685 |
+
$a = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_custom_header_meta', '' ) ), ENT_QUOTES, 'UTF-8' );
|
686 |
+
echo $a;
|
687 |
+
}
|
688 |
+
// end add_custom_header_meta
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Adds a new column header to the Edit Comments panel
|
692 |
+
*/
|
693 |
+
public function add_column_header( $_columns ) {
|
694 |
+
$image_url = plugins_url( '/images', STCR_PLUGIN_FILE );
|
695 |
+
$image_tooltip = __( 'Subscriptions', 'subscribe-to-comments-reloaded' );
|
696 |
+
$_columns['subscribe-reloaded'] = "<span class='hidden'>" . $image_tooltip . "</span><img src='$image_url/subscribe-to-comments-small.png' width='17' height='12' alt='" . $image_tooltip . "' title='" . $image_tooltip . "' />";
|
697 |
+
|
698 |
+
return $_columns;
|
699 |
+
}
|
700 |
+
// end add_comment_column_header
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Adds a new column to the Edit Comments panel
|
704 |
+
*/
|
705 |
+
public function add_comment_column( $_column_name ) {
|
706 |
+
if ( 'subscribe-reloaded' != $_column_name ) {
|
707 |
+
return;
|
708 |
+
}
|
709 |
+
|
710 |
+
global $comment;
|
711 |
+
$subscription = $this->get_subscriptions(
|
712 |
+
array(
|
713 |
+
'post_id',
|
714 |
+
'email'
|
715 |
+
), array(
|
716 |
+
'equals',
|
717 |
+
'equals'
|
718 |
+
), array(
|
719 |
+
$comment->comment_post_ID,
|
720 |
+
$comment->comment_author_email
|
721 |
+
), 'dt', 'DESC', 0, 1
|
722 |
+
);
|
723 |
+
if ( count( $subscription ) == 0 ) {
|
724 |
+
echo '<a href="admin.php?page=stcr_manage_subscriptions&subscribepanel=1&sra=add-subscription&srp=' . $comment->comment_post_ID . '&sre=' . urlencode( $comment->comment_author_email ) . '">' . __( 'No', 'subscribe-to-comments-reloaded' ) . '</a>';
|
725 |
+
} else {
|
726 |
+
echo '<a href="admin.php?page=stcr_manage_subscriptions&subscribepanel=1&srf=email&srt=equals&srv=' . urlencode( $comment->comment_author_email ) . '">' . $subscription[0]->status . '</a>';
|
727 |
+
}
|
728 |
+
}
|
729 |
+
// end add_column
|
730 |
+
|
731 |
+
/**
|
732 |
+
* Adds a new column to the Posts management panel
|
733 |
+
*/
|
734 |
+
public function add_post_column( $_column_name ) {
|
735 |
+
if ( 'subscribe-reloaded' != $_column_name ) {
|
736 |
+
return;
|
737 |
+
}
|
738 |
+
|
739 |
+
global $post;
|
740 |
+
echo '<a href="admin.php?page=stcr_manage_subscriptions&subscribepanel=1&srf=post_id&srt=equals&srv=' . $post->ID . '">' . count( $this->get_subscriptions( 'post_id', 'equals', $post->ID ) ) . '</a>';
|
741 |
+
}
|
742 |
+
// end add_column
|
743 |
+
|
744 |
+
/**
|
745 |
+
* Returns the URL of the management page as a shortcode
|
746 |
+
*/
|
747 |
+
public function subscribe_url_shortcode() {
|
748 |
+
global $post;
|
749 |
+
$user_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '' );
|
750 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
751 |
+
$user_link = qtrans_convertURL( $user_link );
|
752 |
+
}
|
753 |
+
if ( strpos( $user_link, '?' ) !== false ) {
|
754 |
+
return "$user_link&srp=$post->ID&sra=s";
|
755 |
+
} else {
|
756 |
+
return "$user_link?srp=$post->ID&sra=s";
|
757 |
+
}
|
758 |
+
}
|
759 |
+
// end subscribe_url_shortcode
|
760 |
+
|
761 |
+
/**
|
762 |
+
* Exclude subscriptions on post duplication
|
763 |
+
*
|
764 |
+
* @since 200625
|
765 |
+
*/
|
766 |
+
public function duplicate_post_exclude_subs( $exclude ) {
|
767 |
+
|
768 |
+
return array_merge( $exclude, array( '_stcr' ) );
|
769 |
+
|
770 |
+
}
|
771 |
+
|
772 |
+
}
|
773 |
+
}
|
utils/stcr_upgrade.php
CHANGED
@@ -1,761 +1,819 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class with utility functions to upgrade the plugin.
|
4 |
-
* @author reedyseth
|
5 |
-
* @since 15-Jul-2015
|
6 |
-
* @version 160831
|
7 |
-
*/
|
8 |
-
namespace stcr;
|
9 |
-
// Avoid direct access to this piece of code
|
10 |
-
if ( ! function_exists( 'add_action' ) ) {
|
11 |
-
header( 'Location: /' );
|
12 |
-
exit;
|
13 |
-
}
|
14 |
-
|
15 |
-
if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_upgrade') ) {
|
16 |
-
class stcr_upgrade extends stcr_utils {
|
17 |
-
|
18 |
-
private $_stcr_charset = null;
|
19 |
-
private $_stcr_collate = null;
|
20 |
-
private $_db_collate = null;
|
21 |
-
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
$this->_stcr_charset = 'utf8';
|
25 |
-
$this->_stcr_collate = 'utf8_unicode_ci';
|
26 |
-
$this->_db_collate = "DEFAULT CHARSET={$this->_stcr_charset} COLLATE={$this->_stcr_collate}";
|
27 |
-
}
|
28 |
-
|
29 |
-
public function apply_patches()
|
30 |
-
{
|
31 |
-
$this->patch_collation();
|
32 |
-
}
|
33 |
-
|
34 |
-
public function _create_subscriber_table( $_fresh_install ) {
|
35 |
-
global $wpdb;
|
36 |
-
$errorMsg = '';
|
37 |
-
|
38 |
-
// If the update option is set to false
|
39 |
-
$stcr_opt_subscriber_table = get_option('subscribe_reloaded_subscriber_table');
|
40 |
-
|
41 |
-
if ( $_fresh_install || ( ! $stcr_opt_subscriber_table || $stcr_opt_subscriber_table == 'no' ) ) {
|
42 |
-
// Creation of table and subscribers.
|
43 |
-
$sqlCreateTable = " CREATE TABLE " . $wpdb->prefix . "subscribe_reloaded_subscribers (
|
44 |
-
stcr_id int(11) NOT NULL AUTO_INCREMENT,
|
45 |
-
subscriber_email varchar(100) NOT NULL,
|
46 |
-
salt int(15) NOT NULL,
|
47 |
-
subscriber_unique_id varchar(50) NULL,
|
48 |
-
add_date timestamp NOT NULL DEFAULT NOW(),
|
49 |
-
PRIMARY KEY (stcr_id),
|
50 |
-
UNIQUE KEY uk_subscriber_email (subscriber_email))
|
51 |
-
ENGINE = InnoDB
|
52 |
-
$this->_db_collate";
|
53 |
-
|
54 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
55 |
-
// dbDelta Will create or update the table safety
|
56 |
-
// Ref: https://codex.wordpress.org/Creating_Tables_with_Plugins
|
57 |
-
$result = dbDelta( $sqlCreateTable );
|
58 |
-
$retrieveNumberOfSubscribers = "SELECT COUNT(subscriber_email) FROM " . $wpdb->prefix . "subscribe_reloaded_subscribers";
|
59 |
-
$numSubscribers = $wpdb->get_var( $retrieveNumberOfSubscribers );
|
60 |
-
// If subscribers not found then the create routine.
|
61 |
-
if ( $numSubscribers == 0 ) {
|
62 |
-
// Get list of emails to be imported.
|
63 |
-
$retrieveEmails = "SELECT DISTINCT REPLACE(meta_key, '_stcr@_', '') AS email FROM " . $wpdb->postmeta
|
64 |
-
. " WHERE meta_key LIKE '\_stcr@\_%'";
|
65 |
-
$emails = $wpdb->get_results( $retrieveEmails, OBJECT );
|
66 |
-
// insert the records on the new table.
|
67 |
-
foreach ( $emails as $email ) {
|
68 |
-
// Insert email
|
69 |
-
$OK = $this->add_user_subscriber_table( $email->email );
|
70 |
-
if ( ! $OK) {
|
71 |
-
$notices = get_option( 'subscribe_reloaded_deferred_admin_notices', array() );
|
72 |
-
$notices[] = '<div class="error"><h3>' . __( 'Important Notice', 'subscribe-to-comments-reloaded' ) . '</h3>' .
|
73 |
-
'<p>The creation of of the table <strong>' . $wpdb->prefix . 'subscribe_reloaded_subscribers</strong> failed</p></div>';
|
74 |
-
update_option( 'subscribe_reloaded_deferred_admin_notices', $notices );
|
75 |
-
break 1;
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
if( ! $_fresh_install )
|
80 |
-
{
|
81 |
-
$this->stcr_create_admin_notice(
|
82 |
-
'notify_create_subscriber_table',
|
83 |
-
'unread',
|
84 |
-
'<p><strong>Subscribe to Comments Reloaded:</strong> The creation of table <code>' . $wpdb->prefix . 'subscribe_reloaded_subscribers</code> was successful.</p>'.
|
85 |
-
'<p>This new table will help to add your subscribers email addresses more safely and prevent Google PII violations.'
|
86 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
87 |
-
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">'
|
88 |
-
. '</p>',
|
89 |
-
'updated'
|
90 |
-
);
|
91 |
-
}
|
92 |
-
update_option('subscribe_reloaded_subscriber_table', 'yes');
|
93 |
-
}
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
public function _sanitize_db_information( $_fresh_install ) {
|
98 |
-
global $wpdb;
|
99 |
-
|
100 |
-
if ( ( ! get_option( "subscribe_reloaded_data_sanitized" )
|
101 |
-
|| get_option( "subscribe_reloaded_data_sanitized" ) == "no" )
|
102 |
-
&& ! $_fresh_install ) {
|
103 |
-
$stcr_data = $wpdb->get_results(
|
104 |
-
" SELECT * FROM $wpdb->options WHERE option_name like 'subscribe_reloaded%'
|
105 |
-
ORDER BY option_name", OBJECT
|
106 |
-
);
|
107 |
-
$sctr_data_array_size = sizeof( $stcr_data );
|
108 |
-
// Lets make sure that there is not another subscription with the same compose key
|
109 |
-
foreach ( $stcr_data as $row ) {
|
110 |
-
if ( $row->option_name != 'subscribe_reloaded_deferred_admin_notices' ) {
|
111 |
-
$optionValue = $row->option_value;
|
112 |
-
$optionValue = html_entity_decode( stripslashes( $optionValue ), ENT_QUOTES, 'UTF-8' );
|
113 |
-
$optionValue = esc_attr( $optionValue );
|
114 |
-
update_option( $row->option_name, $optionValue );
|
115 |
-
}
|
116 |
-
}
|
117 |
-
$this->stcr_create_admin_notice(
|
118 |
-
'notify_update_sanitize_db_options',
|
119 |
-
'unread',
|
120 |
-
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> The information in your database has been sanitized to prevent the raw html messages. <a class="dismiss" href="#">Dismiss. </a>'
|
121 |
-
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">' , 'subscribe-to-comments-reloaded' )
|
122 |
-
. '</p>',
|
123 |
-
'updated'
|
124 |
-
);
|
125 |
-
update_option( "subscribe_reloaded_data_sanitized", "yes" );
|
126 |
-
}
|
127 |
-
} // end _sanitize_db_information
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Copies the information from the stand-alone table to WP's core table
|
131 |
-
*/
|
132 |
-
public function _update_db() {
|
133 |
-
global $wpdb;
|
134 |
-
$stcr_table = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}subscribe_reloaded'" );
|
135 |
-
|
136 |
-
// Perform the import only if the target table does not contain any subscriptions
|
137 |
-
$count_postmeta_rows = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
138 |
-
if ( ! empty( $stcr_table ) && $count_postmeta_rows == 0 ) {
|
139 |
-
$wpdb->query(
|
140 |
-
"
|
141 |
-
INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
142 |
-
SELECT post_ID, CONCAT('_stcr@_', email), CONCAT(dt, '|Y')
|
143 |
-
FROM {$wpdb->prefix}subscribe_reloaded
|
144 |
-
WHERE email LIKE '%@%.%' AND status = 'Y'
|
145 |
-
GROUP BY email, post_ID"
|
146 |
-
);
|
147 |
-
}
|
148 |
-
}
|
149 |
-
// end _update_db
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Imports subscription data created with the Subscribe to Comments plugin
|
153 |
-
*/
|
154 |
-
public function _import_stc_data() {
|
155 |
-
global $wpdb;
|
156 |
-
|
157 |
-
// Import the information collected by Subscribe to Comments, if needed
|
158 |
-
$result = $wpdb->get_row( "DESC $wpdb->comments comment_subscribe", ARRAY_A );
|
159 |
-
|
160 |
-
// Perform the import only if the target table does not contain any subscriptions
|
161 |
-
$count_postmeta_rows = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
162 |
-
|
163 |
-
if ( ! empty( $result ) && is_array( $result ) && $count_postmeta_rows == 0 ) {
|
164 |
-
$wpdb->query(
|
165 |
-
"
|
166 |
-
INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
167 |
-
SELECT comment_post_ID, CONCAT('_stcr@_', comment_author_email), CONCAT(comment_date, '|Y')
|
168 |
-
FROM $wpdb->comments
|
169 |
-
WHERE comment_author_email LIKE '%@%.%' AND comment_subscribe = 'Y'
|
170 |
-
GROUP BY comment_post_ID, comment_author_email"
|
171 |
-
);
|
172 |
-
$this->stcr_create_admin_notice(
|
173 |
-
'notify_import_stc_data',
|
174 |
-
'unread',
|
175 |
-
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Comment subscription data from the <strong>Subscribe to Comments</strong> plugin was detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'subscribe-to-comments/subscribe-to-comments.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> Subscribe to Comments to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
176 |
-
'<p>' . __( 'If you have subscription data from Subscribe to Comments Reloaded < v2.0 that you want to import, you\'ll need to import that data manually, as only one import routine will ever run to prevent data loss.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
177 |
-
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
178 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
179 |
-
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
180 |
-
'updated'
|
181 |
-
);
|
182 |
-
}
|
183 |
-
}
|
184 |
-
// end _import_stc_data
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Imports subscriptions from Subscribe to Comments by Mark Jaquith
|
188 |
-
*
|
189 |
-
* @since 190708
|
190 |
-
*/
|
191 |
-
public function _import_stc_mj_data() {
|
192 |
-
|
193 |
-
global $wpdb;
|
194 |
-
|
195 |
-
// check if we currently have subscriptions
|
196 |
-
$current_subscriptions_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
197 |
-
|
198 |
-
// if subscriptions exists, do not proceed
|
199 |
-
if ( $current_subscriptions_count > 0 ) return;
|
200 |
-
|
201 |
-
// will hold subscriptions
|
202 |
-
$subscriptions = array();
|
203 |
-
|
204 |
-
// data from the other plugin
|
205 |
-
$result = $wpdb->get_results( "SELECT * FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments'", ARRAY_A );
|
206 |
-
|
207 |
-
// no results, go back
|
208 |
-
if ( empty( $result ) ) return;
|
209 |
-
|
210 |
-
// add the subscriptions to an array
|
211 |
-
foreach ( $result as $subscription ) {
|
212 |
-
$subscriptions[] = array(
|
213 |
-
'post_id' => $subscription['post_id'],
|
214 |
-
'email' => $this->clean_email( $subscription['meta_value'] ),
|
215 |
-
);
|
216 |
-
}
|
217 |
-
|
218 |
-
// no subscriptions, go back
|
219 |
-
if ( empty( $subscriptions ) ) return;
|
220 |
-
|
221 |
-
// add the subscriptions to the DB
|
222 |
-
$dt = date_i18n( 'Y-m-d H:i:s' );
|
223 |
-
$status = 'Y';
|
224 |
-
foreach ( $subscriptions as $subscription ) {
|
225 |
-
$post_id = $subscription['post_id'];
|
226 |
-
$meta_key = '_stcr@_' . $subscription['email'];
|
227 |
-
$meta_value = $dt . '|' . $status;
|
228 |
-
$wpdb->query(
|
229 |
-
$wpdb->prepare(
|
230 |
-
"INSERT IGNORE INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ( %s, %s, %s )",
|
231 |
-
$post_id, $meta_key, $meta_value
|
232 |
-
)
|
233 |
-
);
|
234 |
-
$this->add_user_subscriber_table( $subscription['email'] );
|
235 |
-
}
|
236 |
-
|
237 |
-
// notify the admin about the import
|
238 |
-
$this->stcr_create_admin_notice(
|
239 |
-
'notify_import_stc_mj_data',
|
240 |
-
'unread',
|
241 |
-
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Comment subscription data from the <strong>Subscribe to Comments</strong> plugin by Mark Jaquith was detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'subscribe-to-comments/subscribe-to-comments.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> Subscribe to Comments to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
242 |
-
'<p>' . __( 'If you have subscription data from Subscribe to Comments Reloaded < v2.0 that you want to import, you\'ll need to import that data manually, as only one import routine will ever run to prevent data loss.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
243 |
-
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
244 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
245 |
-
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
246 |
-
'updated'
|
247 |
-
);
|
248 |
-
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Imports subscription data created with the Comment Reply Notification plugin. This function is deprecated is not in use anymore.
|
253 |
-
*
|
254 |
-
* @deprecated
|
255 |
-
* @since 13-May-2014
|
256 |
-
*/
|
257 |
-
public function _import_crn_data() {
|
258 |
-
global $wpdb;
|
259 |
-
$crn_data_count = null;
|
260 |
-
$subscriptions_to_import = array();
|
261 |
-
$commentMailColumn = $wpdb->get_var( "SHOW COLUMNS FROM $wpdb->comments LIKE 'comment_mail_notify' " );
|
262 |
-
if ( empty( $commentMailColumn ) ) {
|
263 |
-
$crn_data_count = 0;
|
264 |
-
} else {
|
265 |
-
// Import the information collected by Subscribe to Comments, if needed
|
266 |
-
$crn_data_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_mail_notify = 1" );
|
267 |
-
}
|
268 |
-
|
269 |
-
if ( $crn_data_count > 0 ) { // if $crn_data_count is 0 there is no Comment Reply
|
270 |
-
// plugin installed and therefore no comment_mail_notify
|
271 |
-
// column.
|
272 |
-
// Since we know that there are subscriptions Retrieve all of them from COMMENT_REPLY_NOTIFICATION
|
273 |
-
$crn_data = $wpdb->get_results(
|
274 |
-
" SELECT comment_post_ID, comment_author_email"
|
275 |
-
. " FROM wp_comments WHERE comment_mail_notify = '1'"
|
276 |
-
. " GROUP BY comment_author_email"
|
277 |
-
, OBJECT
|
278 |
-
);
|
279 |
-
$stcr_data = $wpdb->get_results(
|
280 |
-
" SELECT post_id, SUBSTRING(meta_key,8) AS email"
|
281 |
-
. " FROM wp_postmeta WHERE meta_key LIKE '_stcr@_%'"
|
282 |
-
, ARRAY_N
|
283 |
-
);
|
284 |
-
$sctr_data_array_size = sizeof( $stcr_data );
|
285 |
-
// Lets make sure that there is not another subscription with the same compose key
|
286 |
-
foreach ( $crn_data as $row ) {
|
287 |
-
// Search the specific compose key in the array
|
288 |
-
for ( $i = 0; $i < $sctr_data_array_size; $i ++ ) {
|
289 |
-
$post_id_in_stcr = in_array( $row->comment_post_ID, $stcr_data[$i] );
|
290 |
-
$email_in_stcr = in_array( $row->comment_author_email, $stcr_data[$i] );
|
291 |
-
// validate with an If
|
292 |
-
if ( $post_id_in_stcr && $email_in_stcr ) {
|
293 |
-
// If the same compose key is in StCR search for the next value.
|
294 |
-
continue 2; // the next subscription.
|
295 |
-
}
|
296 |
-
}
|
297 |
-
// 2) Until this point the compose key is not on StCR so is safe to import.
|
298 |
-
$OK = $wpdb->insert(
|
299 |
-
$wpdb->postmeta,
|
300 |
-
array(
|
301 |
-
"post_id" => $row->comment_post_ID,
|
302 |
-
"meta_key" => "_stcr@_" . $row->comment_author_email,
|
303 |
-
"meta_value" => current_time( "mysql" ) . "|R"
|
304 |
-
),
|
305 |
-
array(
|
306 |
-
"%d",
|
307 |
-
"%s",
|
308 |
-
"%s"
|
309 |
-
)
|
310 |
-
);
|
311 |
-
|
312 |
-
}
|
313 |
-
$this->stcr_create_admin_notice(
|
314 |
-
'notify_import_comment_reply',
|
315 |
-
'unread',
|
316 |
-
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Comment subscription data from the <strong>Comment Reply Notification</strong> plugin was detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'comment-reply-notification/comment-reply-notification.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> Comment Reply Notification to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
317 |
-
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
318 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
319 |
-
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
320 |
-
'updated'
|
321 |
-
);
|
322 |
-
}
|
323 |
-
}
|
324 |
-
// end _import_crn_data
|
325 |
-
/**
|
326 |
-
* Imports options and subscription data created with the WP Comment Subscriptions plugin
|
327 |
-
*/
|
328 |
-
public function _import_wpcs_data() {
|
329 |
-
global $wpdb;
|
330 |
-
|
331 |
-
// Import the information collected by WP Comment Subscriptions, if needed
|
332 |
-
$wpcs_data_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_wpcs@\_%'" );
|
333 |
-
|
334 |
-
// Perform the import only if the target table does not contain any subscriptions
|
335 |
-
$count_postmeta_rows = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
336 |
-
|
337 |
-
if ( ! empty( $wpcs_data_count ) && $count_postmeta_rows == 0 ) {
|
338 |
-
$wpdb->query(
|
339 |
-
"
|
340 |
-
INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
341 |
-
SELECT post_id, REPLACE(meta_key, '_wpcs@_', '_stcr@_') meta_key, meta_value
|
342 |
-
FROM $wpdb->postmeta
|
343 |
-
WHERE meta_key LIKE '%_wpcs@_%'"
|
344 |
-
);
|
345 |
-
|
346 |
-
if ( $option = get_option( 'wp_comment_subscriptions_manager_page' ) ) {
|
347 |
-
add_option( 'subscribe_reloaded_manager_page', $option );
|
348 |
-
}
|
349 |
-
if ( $option = get_option( 'wp_comment_subscriptions_show_subscription_box' ) ) {
|
350 |
-
add_option( 'subscribe_reloaded_show_subscription_box', $option );
|
351 |
-
}
|
352 |
-
if ( $option = get_option( 'wp_comment_subscriptions_checked_by_default' ) ) {
|
353 |
-
add_option( 'subscribe_reloaded_checked_by_default', $option );
|
354 |
-
}
|
355 |
-
if ( $option = get_option( 'wp_comment_subscriptions_enable_advanced_subscriptions' ) ) {
|
356 |
-
add_option( 'subscribe_reloaded_enable_advanced_subscriptions', $option );
|
357 |
-
}
|
358 |
-
if ( $option = get_option( 'wp_comment_subscriptions_checkbox_inline_style' ) ) {
|
359 |
-
add_option( 'subscribe_reloaded_checkbox_inline_style', $option );
|
360 |
-
}
|
361 |
-
if ( $option = get_option( 'wp_comment_subscriptions_checkbox_html' ) ) {
|
362 |
-
add_option( 'subscribe_reloaded_checkbox_html', $option );
|
363 |
-
}
|
364 |
-
if ( $option = get_option( 'wp_comment_subscriptions_checkbox_label' ) ) {
|
365 |
-
add_option( 'subscribe_reloaded_checkbox_label', $option );
|
366 |
-
}
|
367 |
-
if ( $option = get_option( 'wp_comment_subscriptions_subscribed_label' ) ) {
|
368 |
-
add_option( 'subscribe_reloaded_subscribed_label', $option );
|
369 |
-
}
|
370 |
-
if ( $option = get_option( 'wp_comment_subscriptions_subscribed_waiting_label' ) ) {
|
371 |
-
add_option( 'subscribe_reloaded_subscribed_waiting_label', $option );
|
372 |
-
}
|
373 |
-
if ( $option = get_option( 'wp_comment_subscriptions_author_label' ) ) {
|
374 |
-
add_option( 'subscribe_reloaded_author_label', $option );
|
375 |
-
}
|
376 |
-
if ( $option = get_option( 'wp_comment_subscriptions_htmlify_message_links' ) ) {
|
377 |
-
add_option( 'subscribe_reloaded_htmlify_message_links', $option );
|
378 |
-
}
|
379 |
-
|
380 |
-
if ( $option = get_option( 'wp_comment_subscriptions_manager_page_enabled' ) ) {
|
381 |
-
add_option( 'subscribe_reloaded_manager_page_enabled', $option );
|
382 |
-
}
|
383 |
-
if ( $option = get_option( 'wp_comment_subscriptions_manager_page_title' ) ) {
|
384 |
-
add_option( 'subscribe_reloaded_manager_page_title', $option );
|
385 |
-
}
|
386 |
-
if ( $option = get_option( 'wp_comment_subscriptions_custom_header_meta' ) ) {
|
387 |
-
add_option( 'subscribe_reloaded_custom_header_meta', $option );
|
388 |
-
}
|
389 |
-
if ( $option = get_option( 'wp_comment_subscriptions_request_mgmt_link' ) ) {
|
390 |
-
add_option( 'subscribe_reloaded_request_mgmt_link', $option );
|
391 |
-
}
|
392 |
-
if ( $option = get_option( 'wp_comment_subscriptions_request_mgmt_link_thankyou' ) ) {
|
393 |
-
add_option( 'subscribe_reloaded_request_mgmt_link_thankyou', $option );
|
394 |
-
}
|
395 |
-
if ( $option = get_option( 'wp_comment_subscriptions_subscribe_without_commenting' ) ) {
|
396 |
-
add_option( 'subscribe_reloaded_subscribe_without_commenting', $option );
|
397 |
-
}
|
398 |
-
if ( $option = get_option( 'wp_comment_subscriptions_subscription_confirmed' ) ) {
|
399 |
-
add_option( 'subscribe_reloaded_subscription_confirmed', $option );
|
400 |
-
}
|
401 |
-
if ( $option = get_option( 'wp_comment_subscriptions_subscription_confirmed_dci' ) ) {
|
402 |
-
add_option( 'subscribe_reloaded_subscription_confirmed_dci', $option );
|
403 |
-
}
|
404 |
-
if ( $option = get_option( 'wp_comment_subscriptions_author_text' ) ) {
|
405 |
-
add_option( 'subscribe_reloaded_author_text', $option );
|
406 |
-
}
|
407 |
-
if ( $option = get_option( 'wp_comment_subscriptions_user_text' ) ) {
|
408 |
-
add_option( 'subscribe_reloaded_user_text', $option );
|
409 |
-
}
|
410 |
-
|
411 |
-
if ( $option = get_option( 'wp_comment_subscriptions_from_name' ) ) {
|
412 |
-
add_option( 'subscribe_reloaded_from_name', $option );
|
413 |
-
}
|
414 |
-
if ( $option = get_option( 'wp_comment_subscriptions_from_email' ) ) {
|
415 |
-
add_option( 'subscribe_reloaded_from_email', $option );
|
416 |
-
}
|
417 |
-
if ( $option = get_option( 'wp_comment_subscriptions_notification_subject' ) ) {
|
418 |
-
add_option( 'subscribe_reloaded_notification_subject', $option );
|
419 |
-
}
|
420 |
-
if ( $option = get_option( 'wp_comment_subscriptions_notification_content' ) ) {
|
421 |
-
add_option( 'subscribe_reloaded_notification_content', $option );
|
422 |
-
}
|
423 |
-
if ( $option = get_option( 'wp_comment_subscriptions_double_check_subject' ) ) {
|
424 |
-
add_option( 'subscribe_reloaded_double_check_subject', $option );
|
425 |
-
}
|
426 |
-
if ( $option = get_option( 'wp_comment_subscriptions_double_check_content' ) ) {
|
427 |
-
add_option( 'subscribe_reloaded_double_check_content', $option );
|
428 |
-
}
|
429 |
-
if ( $option = get_option( 'wp_comment_subscriptions_management_subject' ) ) {
|
430 |
-
add_option( 'subscribe_reloaded_management_subject', $option );
|
431 |
-
}
|
432 |
-
if ( $option = get_option( 'wp_comment_subscriptions_management_content' ) ) {
|
433 |
-
add_option( 'subscribe_reloaded_management_content', $option );
|
434 |
-
}
|
435 |
-
|
436 |
-
if ( $option = get_option( 'wp_comment_subscriptions_purge_days' ) ) {
|
437 |
-
add_option( 'subscribe_reloaded_purge_days', $option );
|
438 |
-
}
|
439 |
-
if ( $option = get_option( 'wp_comment_subscriptions_enable_double_check' ) ) {
|
440 |
-
add_option( 'subscribe_reloaded_enable_double_check', $option );
|
441 |
-
}
|
442 |
-
if ( $option = get_option( 'wp_comment_subscriptions_notify_authors' ) ) {
|
443 |
-
add_option( 'subscribe_reloaded_notify_authors', $option );
|
444 |
-
}
|
445 |
-
if ( $option = get_option( 'wp_comment_subscriptions_enable_html_emails' ) ) {
|
446 |
-
add_option( 'subscribe_reloaded_enable_html_emails', $option );
|
447 |
-
}
|
448 |
-
if ( $option = get_option( 'wp_comment_subscriptions_process_trackbacks' ) ) {
|
449 |
-
add_option( 'subscribe_reloaded_process_trackbacks', $option );
|
450 |
-
}
|
451 |
-
if ( $option = get_option( 'wp_comment_subscriptions_enable_admin_messages' ) ) {
|
452 |
-
add_option( 'subscribe_reloaded_enable_admin_messages', $option );
|
453 |
-
}
|
454 |
-
if ( $option = get_option( 'wp_comment_subscriptions_admin_subscribe' ) ) {
|
455 |
-
add_option( 'subscribe_reloaded_admin_subscribe', $option );
|
456 |
-
}
|
457 |
-
if ( $option = get_option( 'wp_comment_subscriptions_admin_bcc' ) ) {
|
458 |
-
add_option( 'subscribe_reloaded_admin_bcc', $option );
|
459 |
-
}
|
460 |
-
if ( $option = get_option( 'wp_comment_subscriptions_only_for_posts' ) ) {
|
461 |
-
add_option( 'subscribe_reloaded_only_for_posts', $option );
|
462 |
-
}
|
463 |
-
$this->stcr_create_admin_notice(
|
464 |
-
'notify_import_wpcs_data',
|
465 |
-
'unread',
|
466 |
-
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Plugin options and comment subscription data from the <strong>WP Comment Subscriptions</strong> plugin were detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'wp-comment-subscriptions/wp-comment-subscriptions.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> WP Comment Subscriptions to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
467 |
-
'<p>' . __( 'If you have subscription data from another plugin (such as Subscribe to Comments or Subscribe to Comments Reloaded < v2.0) that you want to import, you\'ll need to import that data manually, as only one import routine will ever run to prevent data loss.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
468 |
-
'<p>' . __( '<strong>Note:</strong> If you were previously using the <code>wp_comment_subscriptions_show()</code> function or the <code>[wpcs-subscribe-url]</code> shortcode, you\'ll need to replace those with <code>subscribe_reloaded_show()</code> and <code>[subscribe-url]</code> respectively.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
469 |
-
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
470 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
471 |
-
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
472 |
-
'updated'
|
473 |
-
);
|
474 |
-
}
|
475 |
-
}
|
476 |
-
// end _import_wpcs_data
|
477 |
-
public function upgrade_notification( $_version, $_db_version, $_fresh_install ) {
|
478 |
-
|
479 |
-
$options_link = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_options' ), __( 'Settings', 'subscribe-to-comments-reloaded' ) );
|
480 |
-
$system_link = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_system' ), __( 'Log Settings', 'subscribe-to-comments-reloaded' ) );
|
481 |
-
|
482 |
-
if( ! $_fresh_install ) {
|
483 |
-
|
484 |
-
switch ($_version) {
|
485 |
-
case '160106':
|
486 |
-
$this->stcr_create_admin_notice(
|
487 |
-
'notify_update_' . $_version,
|
488 |
-
'unread',
|
489 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160106.', 'subscribe-to-comments-reloaded') . '</p>' .
|
490 |
-
'<p>' . __('This version includes many changes and fixes to improve your experience with the plugin, including One Click Unsubscribe, Rich Text Editor to create HTML email templates, Subscription Checkbox position, and more!', 'subscribe-to-comments-reloaded') . '</p>' .
|
491 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
492 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
493 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
494 |
-
'updated'
|
495 |
-
);
|
496 |
-
// Update the HTML emails option
|
497 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
498 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
499 |
-
break;
|
500 |
-
case '160115':
|
501 |
-
$this->stcr_create_admin_notice(
|
502 |
-
'notify_update_' . $_version,
|
503 |
-
'unread',
|
504 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160115.', 'subscribe-to-comments-reloaded') . '</p>' .
|
505 |
-
'<p>' . __('This version includes fixes to broken links while managing your subscriptions', 'subscribe-to-comments-reloaded') . '</p>' .
|
506 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
507 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
508 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
509 |
-
'updated'
|
510 |
-
);
|
511 |
-
// Update the HTML emails option
|
512 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
513 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
514 |
-
break;
|
515 |
-
case '160831':
|
516 |
-
$this->stcr_create_admin_notice(
|
517 |
-
'notify_update_' . $_version,
|
518 |
-
'unread',
|
519 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160831', 'subscribe-to-comments-reloaded') . '</p>' .
|
520 |
-
'<p>' . __('This version includes fixes to many bugs and also new features, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
521 |
-
'<ul>' .
|
522 |
-
'<li>' . __("<strong>New Feature</strong> Add new option to set the Reply To email address. This will help the subscribers to use the Reply option in their email agents.", 'subscribe-to-comments-reloaded') . '</li>'.
|
523 |
-
'<li>' . __("<strong>New Feature</strong> Improve the Admin Menu for StCR. Replace the StCR menu on the Settings Menu for a new Menu with sub menus for the pages.", 'subscribe-to-comments-reloaded') . '</li>'.
|
524 |
-
'<li>' . __("<strong>New Feature</strong> Safely Uninstall option to Delete the plugin without loosing your subscriptions. You can use this option also for reset all the settings, see the FAQ.", 'subscribe-to-comments-reloaded') . '</li>'.
|
525 |
-
'<li>' . __("<strong>New Feature</strong> Now the WordPress Authors can use the <strong>Subscribe authors</strong> option to autor subscribe to a Custom Post Type.", 'subscribe-to-comments-reloaded') . '</li>'.
|
526 |
-
'<li>' . __("<strong>New Feature</strong> A new field was added under the notification options to and the management link only by email and not to display it on the request link page.", 'subscribe-to-comments-reloaded') . '</li>'.
|
527 |
-
'</ul>' .
|
528 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
529 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
530 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
531 |
-
'updated'
|
532 |
-
);
|
533 |
-
// Update the HTML emails option
|
534 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
535 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
536 |
-
break;
|
537 |
-
case '160902':
|
538 |
-
$this->stcr_create_admin_notice(
|
539 |
-
'notify_update_' . $_version,
|
540 |
-
'unread',
|
541 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160902', 'subscribe-to-comments-reloaded') . '</p>' .
|
542 |
-
'<p>' . __('This version includes fixes to many bugs and also new features, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
543 |
-
'<ul>' .
|
544 |
-
'<li>' . __("<strong>Fix update</strong> this version Fixes some issue trigger by the previous 160831 version.", 'subscribe-to-comments-reloaded') . '</li>'.
|
545 |
-
'<li>' . __("<strong>New Feature</strong> Add new option to set the Reply To email address. This will help the subscribers to use the Reply option in their email agents.", 'subscribe-to-comments-reloaded') . '</li>'.
|
546 |
-
'<li>' . __("<strong>New Feature</strong> Improve the Admin Menu for StCR. Replace the StCR menu on the Settings Menu for a new Menu with sub menus for the pages.", 'subscribe-to-comments-reloaded') . '</li>'.
|
547 |
-
'<li>' . __("<strong>New Feature</strong> Safely Uninstall option to Delete the plugin without loosing your subscriptions. You can use this option also for reset all the settings, see the FAQ.", 'subscribe-to-comments-reloaded') . '</li>'.
|
548 |
-
'<li>' . __("<strong>New Feature</strong> Now the WordPress Authors can use the <strong>Subscribe authors</strong> option to autor subscribe to a Custom Post Type.", 'subscribe-to-comments-reloaded') . '</li>'.
|
549 |
-
'<li>' . __("<strong>New Feature</strong> A new field was added under the notification options to and the management link only by email and not to display it on the request link page.", 'subscribe-to-comments-reloaded') . '</li>'.
|
550 |
-
'</ul>' .
|
551 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
552 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
553 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
554 |
-
'updated'
|
555 |
-
);
|
556 |
-
// Update the HTML emails option
|
557 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
558 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
559 |
-
break;
|
560 |
-
case '160915':
|
561 |
-
$options_link = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_options' ), __( 'Settings', 'subscribe-to-comments-reloaded' ) );
|
562 |
-
$this->stcr_create_admin_notice(
|
563 |
-
'notify_update_' . $_version,
|
564 |
-
'unread',
|
565 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160915', 'subscribe-to-comments-reloaded') . '</p>' .
|
566 |
-
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
567 |
-
'<ul>' .
|
568 |
-
'<li>' . __("<strong>Fix</strong> StCR checkbox position issues with some WordPress themes, Go to the {$options_link} to activate it.", 'subscribe-to-comments-reloaded') . '</li>'.
|
569 |
-
'<li>' . __("<strong>Change</strong> the radio buttons in the management page for a dropdown.", 'subscribe-to-comments-reloaded') . '</li>'.
|
570 |
-
'<li>' . __("<strong>Improve</strong> Email validation for empty values and using a regex.", 'subscribe-to-comments-reloaded') . '</li>'.
|
571 |
-
'</ul>' .
|
572 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
573 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
574 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
575 |
-
'updated'
|
576 |
-
);
|
577 |
-
// Update the HTML emails option
|
578 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
579 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
580 |
-
break;
|
581 |
-
case '170428':
|
582 |
-
$this->stcr_create_admin_notice(
|
583 |
-
'notify_update_' . $_version,
|
584 |
-
'unread',
|
585 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
586 |
-
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
587 |
-
|
588 |
-
'<ul>' .
|
589 |
-
'<li>' . __("<strong>Fix</strong> Wrong confirmation link when the double check option is enable.", 'subscribe-to-comments-reloaded') . '</li>'.
|
590 |
-
'<li>' . __("<strong>Improve</strong> Manage subscription page. Take a look ;).", 'subscribe-to-comments-reloaded') . '</li>'.
|
591 |
-
'<li>' . __("<strong>Improve</strong> Log file manipulation. Now you can control how the log behaves, take a look at the {$system_link}.", 'subscribe-to-comments-reloaded') . '</li>'.
|
592 |
-
'</ul>' .
|
593 |
-
|
594 |
-
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
595 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
596 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
597 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
598 |
-
'updated'
|
599 |
-
);
|
600 |
-
// Update the HTML emails option
|
601 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
602 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
603 |
-
break;
|
604 |
-
case '170607':
|
605 |
-
$this->stcr_create_admin_notice(
|
606 |
-
'notify_update_' . $_version,
|
607 |
-
'unread',
|
608 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
609 |
-
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
610 |
-
|
611 |
-
'<ul>' .
|
612 |
-
'<li>' . __("<strong>Fix Critical Bug</strong> This version fix a critical bug on fresh installation regarding a database table creation.", 'subscribe-to-comments-reloaded') . '</li>'.
|
613 |
-
'<li>' . __("<strong>Add</strong> Option to control the inclusion of the style Font Awesome.", 'subscribe-to-comments-reloaded') . '</li>'.
|
614 |
-
'</ul>' .
|
615 |
-
|
616 |
-
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
617 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
618 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
619 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
620 |
-
'updated'
|
621 |
-
);
|
622 |
-
// Update the HTML emails option
|
623 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
624 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
625 |
-
break;
|
626 |
-
case '180212':
|
627 |
-
$this->stcr_create_admin_notice(
|
628 |
-
'notify_update_' . $_version,
|
629 |
-
'unread',
|
630 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
631 |
-
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
632 |
-
|
633 |
-
'<ul>' .
|
634 |
-
'<li>' . __("<strong>Security Patch</strong> This version add a patch for some security issues.", 'subscribe-to-comments-reloaded') . '</li>'.
|
635 |
-
'<li>' . __("<strong>Add</strong> Option to reset all the plugin options", 'subscribe-to-comments-reloaded') . '</li>'.
|
636 |
-
'<li>' . __("<strong>Fix</strong> issue regarding database collations", 'subscribe-to-comments-reloaded') . '</li>'.
|
637 |
-
'</ul>' .
|
638 |
-
|
639 |
-
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
640 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
641 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
642 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
643 |
-
'updated'
|
644 |
-
);
|
645 |
-
// Update the HTML emails option
|
646 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
647 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
648 |
-
break;
|
649 |
-
case '180225':
|
650 |
-
$this->stcr_create_admin_notice(
|
651 |
-
'notify_update_' . $_version,
|
652 |
-
'unread',
|
653 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
654 |
-
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
655 |
-
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
656 |
-
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
657 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
658 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
659 |
-
'updated'
|
660 |
-
);
|
661 |
-
// Update the HTML emails option
|
662 |
-
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
663 |
-
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
664 |
-
break;
|
665 |
-
case '190117':
|
666 |
-
$this->stcr_create_admin_notice(
|
667 |
-
'notify_update_' . $_version,
|
668 |
-
'unread',
|
669 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
670 |
-
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
671 |
-
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
672 |
-
'<p>' . __('You might need to clear you cache !!', 'subscribe-to-comments-reloaded') . '</p>' .
|
673 |
-
'<p>' . __('Please visit the <a href="http://subscribe-reloaded.com/update/stcr-release-version-'.$_version.'/" target="_blank">Release Post</a> for a complete list of changes and guide about the new version.'
|
674 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
675 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
676 |
-
'updated'
|
677 |
-
);
|
678 |
-
break;
|
679 |
-
case '190214':
|
680 |
-
$this->stcr_create_admin_notice(
|
681 |
-
'notify_update_' . $_version,
|
682 |
-
'unread',
|
683 |
-
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
684 |
-
'<p>' . __('This version includes fixes., ', 'subscribe-to-comments-reloaded') . '</p>' .
|
685 |
-
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
686 |
-
'<p>' . __('You might need to clear you cache !!', 'subscribe-to-comments-reloaded') . '</p>' .
|
687 |
-
'<p>' . __('Please visit the <a href="http://subscribe-reloaded.com/update/stcr-release-version-'.$_version.'/" target="_blank">Release Post</a> for a complete list of changes and guide about the new version.'
|
688 |
-
. '<a class="dismiss" href="#">Dismiss. </a>'
|
689 |
-
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
690 |
-
'updated'
|
691 |
-
);
|
692 |
-
break;
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class with utility functions to upgrade the plugin.
|
4 |
+
* @author reedyseth
|
5 |
+
* @since 15-Jul-2015
|
6 |
+
* @version 160831
|
7 |
+
*/
|
8 |
+
namespace stcr;
|
9 |
+
// Avoid direct access to this piece of code
|
10 |
+
if ( ! function_exists( 'add_action' ) ) {
|
11 |
+
header( 'Location: /' );
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_upgrade') ) {
|
16 |
+
class stcr_upgrade extends stcr_utils {
|
17 |
+
|
18 |
+
private $_stcr_charset = null;
|
19 |
+
private $_stcr_collate = null;
|
20 |
+
private $_db_collate = null;
|
21 |
+
|
22 |
+
public function __construct()
|
23 |
+
{
|
24 |
+
$this->_stcr_charset = 'utf8';
|
25 |
+
$this->_stcr_collate = 'utf8_unicode_ci';
|
26 |
+
$this->_db_collate = "DEFAULT CHARSET={$this->_stcr_charset} COLLATE={$this->_stcr_collate}";
|
27 |
+
}
|
28 |
+
|
29 |
+
public function apply_patches()
|
30 |
+
{
|
31 |
+
$this->patch_collation();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function _create_subscriber_table( $_fresh_install ) {
|
35 |
+
global $wpdb;
|
36 |
+
$errorMsg = '';
|
37 |
+
|
38 |
+
// If the update option is set to false
|
39 |
+
$stcr_opt_subscriber_table = get_option('subscribe_reloaded_subscriber_table');
|
40 |
+
|
41 |
+
if ( $_fresh_install || ( ! $stcr_opt_subscriber_table || $stcr_opt_subscriber_table == 'no' ) ) {
|
42 |
+
// Creation of table and subscribers.
|
43 |
+
$sqlCreateTable = " CREATE TABLE " . $wpdb->prefix . "subscribe_reloaded_subscribers (
|
44 |
+
stcr_id int(11) NOT NULL AUTO_INCREMENT,
|
45 |
+
subscriber_email varchar(100) NOT NULL,
|
46 |
+
salt int(15) NOT NULL,
|
47 |
+
subscriber_unique_id varchar(50) NULL,
|
48 |
+
add_date timestamp NOT NULL DEFAULT NOW(),
|
49 |
+
PRIMARY KEY (stcr_id),
|
50 |
+
UNIQUE KEY uk_subscriber_email (subscriber_email))
|
51 |
+
ENGINE = InnoDB
|
52 |
+
$this->_db_collate";
|
53 |
+
|
54 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
55 |
+
// dbDelta Will create or update the table safety
|
56 |
+
// Ref: https://codex.wordpress.org/Creating_Tables_with_Plugins
|
57 |
+
$result = dbDelta( $sqlCreateTable );
|
58 |
+
$retrieveNumberOfSubscribers = "SELECT COUNT(subscriber_email) FROM " . $wpdb->prefix . "subscribe_reloaded_subscribers";
|
59 |
+
$numSubscribers = $wpdb->get_var( $retrieveNumberOfSubscribers );
|
60 |
+
// If subscribers not found then the create routine.
|
61 |
+
if ( $numSubscribers == 0 ) {
|
62 |
+
// Get list of emails to be imported.
|
63 |
+
$retrieveEmails = "SELECT DISTINCT REPLACE(meta_key, '_stcr@_', '') AS email FROM " . $wpdb->postmeta
|
64 |
+
. " WHERE meta_key LIKE '\_stcr@\_%'";
|
65 |
+
$emails = $wpdb->get_results( $retrieveEmails, OBJECT );
|
66 |
+
// insert the records on the new table.
|
67 |
+
foreach ( $emails as $email ) {
|
68 |
+
// Insert email
|
69 |
+
$OK = $this->add_user_subscriber_table( $email->email );
|
70 |
+
if ( ! $OK) {
|
71 |
+
$notices = get_option( 'subscribe_reloaded_deferred_admin_notices', array() );
|
72 |
+
$notices[] = '<div class="error"><h3>' . __( 'Important Notice', 'subscribe-to-comments-reloaded' ) . '</h3>' .
|
73 |
+
'<p>The creation of of the table <strong>' . $wpdb->prefix . 'subscribe_reloaded_subscribers</strong> failed</p></div>';
|
74 |
+
update_option( 'subscribe_reloaded_deferred_admin_notices', $notices );
|
75 |
+
break 1;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
if( ! $_fresh_install )
|
80 |
+
{
|
81 |
+
$this->stcr_create_admin_notice(
|
82 |
+
'notify_create_subscriber_table',
|
83 |
+
'unread',
|
84 |
+
'<p><strong>Subscribe to Comments Reloaded:</strong> The creation of table <code>' . $wpdb->prefix . 'subscribe_reloaded_subscribers</code> was successful.</p>'.
|
85 |
+
'<p>This new table will help to add your subscribers email addresses more safely and prevent Google PII violations.'
|
86 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
87 |
+
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">'
|
88 |
+
. '</p>',
|
89 |
+
'updated'
|
90 |
+
);
|
91 |
+
}
|
92 |
+
update_option('subscribe_reloaded_subscriber_table', 'yes');
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
public function _sanitize_db_information( $_fresh_install ) {
|
98 |
+
global $wpdb;
|
99 |
+
|
100 |
+
if ( ( ! get_option( "subscribe_reloaded_data_sanitized" )
|
101 |
+
|| get_option( "subscribe_reloaded_data_sanitized" ) == "no" )
|
102 |
+
&& ! $_fresh_install ) {
|
103 |
+
$stcr_data = $wpdb->get_results(
|
104 |
+
" SELECT * FROM $wpdb->options WHERE option_name like 'subscribe_reloaded%'
|
105 |
+
ORDER BY option_name", OBJECT
|
106 |
+
);
|
107 |
+
$sctr_data_array_size = sizeof( $stcr_data );
|
108 |
+
// Lets make sure that there is not another subscription with the same compose key
|
109 |
+
foreach ( $stcr_data as $row ) {
|
110 |
+
if ( $row->option_name != 'subscribe_reloaded_deferred_admin_notices' ) {
|
111 |
+
$optionValue = $row->option_value;
|
112 |
+
$optionValue = html_entity_decode( stripslashes( $optionValue ), ENT_QUOTES, 'UTF-8' );
|
113 |
+
$optionValue = esc_attr( $optionValue );
|
114 |
+
update_option( $row->option_name, $optionValue );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
$this->stcr_create_admin_notice(
|
118 |
+
'notify_update_sanitize_db_options',
|
119 |
+
'unread',
|
120 |
+
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> The information in your database has been sanitized to prevent the raw html messages. <a class="dismiss" href="#">Dismiss. </a>'
|
121 |
+
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">' , 'subscribe-to-comments-reloaded' )
|
122 |
+
. '</p>',
|
123 |
+
'updated'
|
124 |
+
);
|
125 |
+
update_option( "subscribe_reloaded_data_sanitized", "yes" );
|
126 |
+
}
|
127 |
+
} // end _sanitize_db_information
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Copies the information from the stand-alone table to WP's core table
|
131 |
+
*/
|
132 |
+
public function _update_db() {
|
133 |
+
global $wpdb;
|
134 |
+
$stcr_table = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}subscribe_reloaded'" );
|
135 |
+
|
136 |
+
// Perform the import only if the target table does not contain any subscriptions
|
137 |
+
$count_postmeta_rows = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
138 |
+
if ( ! empty( $stcr_table ) && $count_postmeta_rows == 0 ) {
|
139 |
+
$wpdb->query(
|
140 |
+
"
|
141 |
+
INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
142 |
+
SELECT post_ID, CONCAT('_stcr@_', email), CONCAT(dt, '|Y')
|
143 |
+
FROM {$wpdb->prefix}subscribe_reloaded
|
144 |
+
WHERE email LIKE '%@%.%' AND status = 'Y'
|
145 |
+
GROUP BY email, post_ID"
|
146 |
+
);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
// end _update_db
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Imports subscription data created with the Subscribe to Comments plugin
|
153 |
+
*/
|
154 |
+
public function _import_stc_data() {
|
155 |
+
global $wpdb;
|
156 |
+
|
157 |
+
// Import the information collected by Subscribe to Comments, if needed
|
158 |
+
$result = $wpdb->get_row( "DESC $wpdb->comments comment_subscribe", ARRAY_A );
|
159 |
+
|
160 |
+
// Perform the import only if the target table does not contain any subscriptions
|
161 |
+
$count_postmeta_rows = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
162 |
+
|
163 |
+
if ( ! empty( $result ) && is_array( $result ) && $count_postmeta_rows == 0 ) {
|
164 |
+
$wpdb->query(
|
165 |
+
"
|
166 |
+
INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
167 |
+
SELECT comment_post_ID, CONCAT('_stcr@_', comment_author_email), CONCAT(comment_date, '|Y')
|
168 |
+
FROM $wpdb->comments
|
169 |
+
WHERE comment_author_email LIKE '%@%.%' AND comment_subscribe = 'Y'
|
170 |
+
GROUP BY comment_post_ID, comment_author_email"
|
171 |
+
);
|
172 |
+
$this->stcr_create_admin_notice(
|
173 |
+
'notify_import_stc_data',
|
174 |
+
'unread',
|
175 |
+
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Comment subscription data from the <strong>Subscribe to Comments</strong> plugin was detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'subscribe-to-comments/subscribe-to-comments.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> Subscribe to Comments to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
176 |
+
'<p>' . __( 'If you have subscription data from Subscribe to Comments Reloaded < v2.0 that you want to import, you\'ll need to import that data manually, as only one import routine will ever run to prevent data loss.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
177 |
+
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
178 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
179 |
+
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
180 |
+
'updated'
|
181 |
+
);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
// end _import_stc_data
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Imports subscriptions from Subscribe to Comments by Mark Jaquith
|
188 |
+
*
|
189 |
+
* @since 190708
|
190 |
+
*/
|
191 |
+
public function _import_stc_mj_data() {
|
192 |
+
|
193 |
+
global $wpdb;
|
194 |
+
|
195 |
+
// check if we currently have subscriptions
|
196 |
+
$current_subscriptions_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
197 |
+
|
198 |
+
// if subscriptions exists, do not proceed
|
199 |
+
if ( $current_subscriptions_count > 0 ) return;
|
200 |
+
|
201 |
+
// will hold subscriptions
|
202 |
+
$subscriptions = array();
|
203 |
+
|
204 |
+
// data from the other plugin
|
205 |
+
$result = $wpdb->get_results( "SELECT * FROM $wpdb->postmeta WHERE meta_key = '_sg_subscribe-to-comments'", ARRAY_A );
|
206 |
+
|
207 |
+
// no results, go back
|
208 |
+
if ( empty( $result ) ) return;
|
209 |
+
|
210 |
+
// add the subscriptions to an array
|
211 |
+
foreach ( $result as $subscription ) {
|
212 |
+
$subscriptions[] = array(
|
213 |
+
'post_id' => $subscription['post_id'],
|
214 |
+
'email' => $this->clean_email( $subscription['meta_value'] ),
|
215 |
+
);
|
216 |
+
}
|
217 |
+
|
218 |
+
// no subscriptions, go back
|
219 |
+
if ( empty( $subscriptions ) ) return;
|
220 |
+
|
221 |
+
// add the subscriptions to the DB
|
222 |
+
$dt = date_i18n( 'Y-m-d H:i:s' );
|
223 |
+
$status = 'Y';
|
224 |
+
foreach ( $subscriptions as $subscription ) {
|
225 |
+
$post_id = $subscription['post_id'];
|
226 |
+
$meta_key = '_stcr@_' . $subscription['email'];
|
227 |
+
$meta_value = $dt . '|' . $status;
|
228 |
+
$wpdb->query(
|
229 |
+
$wpdb->prepare(
|
230 |
+
"INSERT IGNORE INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ( %s, %s, %s )",
|
231 |
+
$post_id, $meta_key, $meta_value
|
232 |
+
)
|
233 |
+
);
|
234 |
+
$this->add_user_subscriber_table( $subscription['email'] );
|
235 |
+
}
|
236 |
+
|
237 |
+
// notify the admin about the import
|
238 |
+
$this->stcr_create_admin_notice(
|
239 |
+
'notify_import_stc_mj_data',
|
240 |
+
'unread',
|
241 |
+
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Comment subscription data from the <strong>Subscribe to Comments</strong> plugin by Mark Jaquith was detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'subscribe-to-comments/subscribe-to-comments.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> Subscribe to Comments to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
242 |
+
'<p>' . __( 'If you have subscription data from Subscribe to Comments Reloaded < v2.0 that you want to import, you\'ll need to import that data manually, as only one import routine will ever run to prevent data loss.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
243 |
+
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
244 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
245 |
+
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
246 |
+
'updated'
|
247 |
+
);
|
248 |
+
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Imports subscription data created with the Comment Reply Notification plugin. This function is deprecated is not in use anymore.
|
253 |
+
*
|
254 |
+
* @deprecated
|
255 |
+
* @since 13-May-2014
|
256 |
+
*/
|
257 |
+
public function _import_crn_data() {
|
258 |
+
global $wpdb;
|
259 |
+
$crn_data_count = null;
|
260 |
+
$subscriptions_to_import = array();
|
261 |
+
$commentMailColumn = $wpdb->get_var( "SHOW COLUMNS FROM $wpdb->comments LIKE 'comment_mail_notify' " );
|
262 |
+
if ( empty( $commentMailColumn ) ) {
|
263 |
+
$crn_data_count = 0;
|
264 |
+
} else {
|
265 |
+
// Import the information collected by Subscribe to Comments, if needed
|
266 |
+
$crn_data_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_mail_notify = 1" );
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( $crn_data_count > 0 ) { // if $crn_data_count is 0 there is no Comment Reply
|
270 |
+
// plugin installed and therefore no comment_mail_notify
|
271 |
+
// column.
|
272 |
+
// Since we know that there are subscriptions Retrieve all of them from COMMENT_REPLY_NOTIFICATION
|
273 |
+
$crn_data = $wpdb->get_results(
|
274 |
+
" SELECT comment_post_ID, comment_author_email"
|
275 |
+
. " FROM wp_comments WHERE comment_mail_notify = '1'"
|
276 |
+
. " GROUP BY comment_author_email"
|
277 |
+
, OBJECT
|
278 |
+
);
|
279 |
+
$stcr_data = $wpdb->get_results(
|
280 |
+
" SELECT post_id, SUBSTRING(meta_key,8) AS email"
|
281 |
+
. " FROM wp_postmeta WHERE meta_key LIKE '_stcr@_%'"
|
282 |
+
, ARRAY_N
|
283 |
+
);
|
284 |
+
$sctr_data_array_size = sizeof( $stcr_data );
|
285 |
+
// Lets make sure that there is not another subscription with the same compose key
|
286 |
+
foreach ( $crn_data as $row ) {
|
287 |
+
// Search the specific compose key in the array
|
288 |
+
for ( $i = 0; $i < $sctr_data_array_size; $i ++ ) {
|
289 |
+
$post_id_in_stcr = in_array( $row->comment_post_ID, $stcr_data[$i] );
|
290 |
+
$email_in_stcr = in_array( $row->comment_author_email, $stcr_data[$i] );
|
291 |
+
// validate with an If
|
292 |
+
if ( $post_id_in_stcr && $email_in_stcr ) {
|
293 |
+
// If the same compose key is in StCR search for the next value.
|
294 |
+
continue 2; // the next subscription.
|
295 |
+
}
|
296 |
+
}
|
297 |
+
// 2) Until this point the compose key is not on StCR so is safe to import.
|
298 |
+
$OK = $wpdb->insert(
|
299 |
+
$wpdb->postmeta,
|
300 |
+
array(
|
301 |
+
"post_id" => $row->comment_post_ID,
|
302 |
+
"meta_key" => "_stcr@_" . $row->comment_author_email,
|
303 |
+
"meta_value" => current_time( "mysql" ) . "|R"
|
304 |
+
),
|
305 |
+
array(
|
306 |
+
"%d",
|
307 |
+
"%s",
|
308 |
+
"%s"
|
309 |
+
)
|
310 |
+
);
|
311 |
+
|
312 |
+
}
|
313 |
+
$this->stcr_create_admin_notice(
|
314 |
+
'notify_import_comment_reply',
|
315 |
+
'unread',
|
316 |
+
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Comment subscription data from the <strong>Comment Reply Notification</strong> plugin was detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'comment-reply-notification/comment-reply-notification.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> Comment Reply Notification to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
317 |
+
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
318 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
319 |
+
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
320 |
+
'updated'
|
321 |
+
);
|
322 |
+
}
|
323 |
+
}
|
324 |
+
// end _import_crn_data
|
325 |
+
/**
|
326 |
+
* Imports options and subscription data created with the WP Comment Subscriptions plugin
|
327 |
+
*/
|
328 |
+
public function _import_wpcs_data() {
|
329 |
+
global $wpdb;
|
330 |
+
|
331 |
+
// Import the information collected by WP Comment Subscriptions, if needed
|
332 |
+
$wpcs_data_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_wpcs@\_%'" );
|
333 |
+
|
334 |
+
// Perform the import only if the target table does not contain any subscriptions
|
335 |
+
$count_postmeta_rows = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%'" );
|
336 |
+
|
337 |
+
if ( ! empty( $wpcs_data_count ) && $count_postmeta_rows == 0 ) {
|
338 |
+
$wpdb->query(
|
339 |
+
"
|
340 |
+
INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
341 |
+
SELECT post_id, REPLACE(meta_key, '_wpcs@_', '_stcr@_') meta_key, meta_value
|
342 |
+
FROM $wpdb->postmeta
|
343 |
+
WHERE meta_key LIKE '%_wpcs@_%'"
|
344 |
+
);
|
345 |
+
|
346 |
+
if ( $option = get_option( 'wp_comment_subscriptions_manager_page' ) ) {
|
347 |
+
add_option( 'subscribe_reloaded_manager_page', $option );
|
348 |
+
}
|
349 |
+
if ( $option = get_option( 'wp_comment_subscriptions_show_subscription_box' ) ) {
|
350 |
+
add_option( 'subscribe_reloaded_show_subscription_box', $option );
|
351 |
+
}
|
352 |
+
if ( $option = get_option( 'wp_comment_subscriptions_checked_by_default' ) ) {
|
353 |
+
add_option( 'subscribe_reloaded_checked_by_default', $option );
|
354 |
+
}
|
355 |
+
if ( $option = get_option( 'wp_comment_subscriptions_enable_advanced_subscriptions' ) ) {
|
356 |
+
add_option( 'subscribe_reloaded_enable_advanced_subscriptions', $option );
|
357 |
+
}
|
358 |
+
if ( $option = get_option( 'wp_comment_subscriptions_checkbox_inline_style' ) ) {
|
359 |
+
add_option( 'subscribe_reloaded_checkbox_inline_style', $option );
|
360 |
+
}
|
361 |
+
if ( $option = get_option( 'wp_comment_subscriptions_checkbox_html' ) ) {
|
362 |
+
add_option( 'subscribe_reloaded_checkbox_html', $option );
|
363 |
+
}
|
364 |
+
if ( $option = get_option( 'wp_comment_subscriptions_checkbox_label' ) ) {
|
365 |
+
add_option( 'subscribe_reloaded_checkbox_label', $option );
|
366 |
+
}
|
367 |
+
if ( $option = get_option( 'wp_comment_subscriptions_subscribed_label' ) ) {
|
368 |
+
add_option( 'subscribe_reloaded_subscribed_label', $option );
|
369 |
+
}
|
370 |
+
if ( $option = get_option( 'wp_comment_subscriptions_subscribed_waiting_label' ) ) {
|
371 |
+
add_option( 'subscribe_reloaded_subscribed_waiting_label', $option );
|
372 |
+
}
|
373 |
+
if ( $option = get_option( 'wp_comment_subscriptions_author_label' ) ) {
|
374 |
+
add_option( 'subscribe_reloaded_author_label', $option );
|
375 |
+
}
|
376 |
+
if ( $option = get_option( 'wp_comment_subscriptions_htmlify_message_links' ) ) {
|
377 |
+
add_option( 'subscribe_reloaded_htmlify_message_links', $option );
|
378 |
+
}
|
379 |
+
|
380 |
+
if ( $option = get_option( 'wp_comment_subscriptions_manager_page_enabled' ) ) {
|
381 |
+
add_option( 'subscribe_reloaded_manager_page_enabled', $option );
|
382 |
+
}
|
383 |
+
if ( $option = get_option( 'wp_comment_subscriptions_manager_page_title' ) ) {
|
384 |
+
add_option( 'subscribe_reloaded_manager_page_title', $option );
|
385 |
+
}
|
386 |
+
if ( $option = get_option( 'wp_comment_subscriptions_custom_header_meta' ) ) {
|
387 |
+
add_option( 'subscribe_reloaded_custom_header_meta', $option );
|
388 |
+
}
|
389 |
+
if ( $option = get_option( 'wp_comment_subscriptions_request_mgmt_link' ) ) {
|
390 |
+
add_option( 'subscribe_reloaded_request_mgmt_link', $option );
|
391 |
+
}
|
392 |
+
if ( $option = get_option( 'wp_comment_subscriptions_request_mgmt_link_thankyou' ) ) {
|
393 |
+
add_option( 'subscribe_reloaded_request_mgmt_link_thankyou', $option );
|
394 |
+
}
|
395 |
+
if ( $option = get_option( 'wp_comment_subscriptions_subscribe_without_commenting' ) ) {
|
396 |
+
add_option( 'subscribe_reloaded_subscribe_without_commenting', $option );
|
397 |
+
}
|
398 |
+
if ( $option = get_option( 'wp_comment_subscriptions_subscription_confirmed' ) ) {
|
399 |
+
add_option( 'subscribe_reloaded_subscription_confirmed', $option );
|
400 |
+
}
|
401 |
+
if ( $option = get_option( 'wp_comment_subscriptions_subscription_confirmed_dci' ) ) {
|
402 |
+
add_option( 'subscribe_reloaded_subscription_confirmed_dci', $option );
|
403 |
+
}
|
404 |
+
if ( $option = get_option( 'wp_comment_subscriptions_author_text' ) ) {
|
405 |
+
add_option( 'subscribe_reloaded_author_text', $option );
|
406 |
+
}
|
407 |
+
if ( $option = get_option( 'wp_comment_subscriptions_user_text' ) ) {
|
408 |
+
add_option( 'subscribe_reloaded_user_text', $option );
|
409 |
+
}
|
410 |
+
|
411 |
+
if ( $option = get_option( 'wp_comment_subscriptions_from_name' ) ) {
|
412 |
+
add_option( 'subscribe_reloaded_from_name', $option );
|
413 |
+
}
|
414 |
+
if ( $option = get_option( 'wp_comment_subscriptions_from_email' ) ) {
|
415 |
+
add_option( 'subscribe_reloaded_from_email', $option );
|
416 |
+
}
|
417 |
+
if ( $option = get_option( 'wp_comment_subscriptions_notification_subject' ) ) {
|
418 |
+
add_option( 'subscribe_reloaded_notification_subject', $option );
|
419 |
+
}
|
420 |
+
if ( $option = get_option( 'wp_comment_subscriptions_notification_content' ) ) {
|
421 |
+
add_option( 'subscribe_reloaded_notification_content', $option );
|
422 |
+
}
|
423 |
+
if ( $option = get_option( 'wp_comment_subscriptions_double_check_subject' ) ) {
|
424 |
+
add_option( 'subscribe_reloaded_double_check_subject', $option );
|
425 |
+
}
|
426 |
+
if ( $option = get_option( 'wp_comment_subscriptions_double_check_content' ) ) {
|
427 |
+
add_option( 'subscribe_reloaded_double_check_content', $option );
|
428 |
+
}
|
429 |
+
if ( $option = get_option( 'wp_comment_subscriptions_management_subject' ) ) {
|
430 |
+
add_option( 'subscribe_reloaded_management_subject', $option );
|
431 |
+
}
|
432 |
+
if ( $option = get_option( 'wp_comment_subscriptions_management_content' ) ) {
|
433 |
+
add_option( 'subscribe_reloaded_management_content', $option );
|
434 |
+
}
|
435 |
+
|
436 |
+
if ( $option = get_option( 'wp_comment_subscriptions_purge_days' ) ) {
|
437 |
+
add_option( 'subscribe_reloaded_purge_days', $option );
|
438 |
+
}
|
439 |
+
if ( $option = get_option( 'wp_comment_subscriptions_enable_double_check' ) ) {
|
440 |
+
add_option( 'subscribe_reloaded_enable_double_check', $option );
|
441 |
+
}
|
442 |
+
if ( $option = get_option( 'wp_comment_subscriptions_notify_authors' ) ) {
|
443 |
+
add_option( 'subscribe_reloaded_notify_authors', $option );
|
444 |
+
}
|
445 |
+
if ( $option = get_option( 'wp_comment_subscriptions_enable_html_emails' ) ) {
|
446 |
+
add_option( 'subscribe_reloaded_enable_html_emails', $option );
|
447 |
+
}
|
448 |
+
if ( $option = get_option( 'wp_comment_subscriptions_process_trackbacks' ) ) {
|
449 |
+
add_option( 'subscribe_reloaded_process_trackbacks', $option );
|
450 |
+
}
|
451 |
+
if ( $option = get_option( 'wp_comment_subscriptions_enable_admin_messages' ) ) {
|
452 |
+
add_option( 'subscribe_reloaded_enable_admin_messages', $option );
|
453 |
+
}
|
454 |
+
if ( $option = get_option( 'wp_comment_subscriptions_admin_subscribe' ) ) {
|
455 |
+
add_option( 'subscribe_reloaded_admin_subscribe', $option );
|
456 |
+
}
|
457 |
+
if ( $option = get_option( 'wp_comment_subscriptions_admin_bcc' ) ) {
|
458 |
+
add_option( 'subscribe_reloaded_admin_bcc', $option );
|
459 |
+
}
|
460 |
+
if ( $option = get_option( 'wp_comment_subscriptions_only_for_posts' ) ) {
|
461 |
+
add_option( 'subscribe_reloaded_only_for_posts', $option );
|
462 |
+
}
|
463 |
+
$this->stcr_create_admin_notice(
|
464 |
+
'notify_import_wpcs_data',
|
465 |
+
'unread',
|
466 |
+
'<p>' . __( '<strong>Subscribe to Comments Reloaded:</strong> Plugin options and comment subscription data from the <strong>WP Comment Subscriptions</strong> plugin were detected and automatically imported into <strong>Subscribe to Comments Reloaded</strong>.', 'subscribe-to-comments-reloaded' ) . ( is_plugin_active( 'wp-comment-subscriptions/wp-comment-subscriptions.php' ) ? __( ' It is recommended that you now <strong>deactivate</strong> WP Comment Subscriptions to prevent confusion between the two plugins.', 'subscribe-to-comments-reloaded' ) : '' ) . '</p>' .
|
467 |
+
'<p>' . __( 'If you have subscription data from another plugin (such as Subscribe to Comments or Subscribe to Comments Reloaded < v2.0) that you want to import, you\'ll need to import that data manually, as only one import routine will ever run to prevent data loss.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
468 |
+
'<p>' . __( '<strong>Note:</strong> If you were previously using the <code>wp_comment_subscriptions_show()</code> function or the <code>[wpcs-subscribe-url]</code> shortcode, you\'ll need to replace those with <code>subscribe_reloaded_show()</code> and <code>[subscribe-url]</code> respectively.', 'subscribe-to-comments-reloaded' ) . '</p>' .
|
469 |
+
'<p>' . __( 'Please visit <a href="options-general.php?page=subscribe-to-comments-reloaded/options/index.php">Settings -> Subscribe to Comments</a> to review your configuration.'
|
470 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
471 |
+
. '<img class="stcr-loading-animation" src="'. esc_url( admin_url() . '/images/loading.gif'). '" alt="Working...">', 'subscribe-to-comments-reloaded' ) . '</p>',
|
472 |
+
'updated'
|
473 |
+
);
|
474 |
+
}
|
475 |
+
}
|
476 |
+
// end _import_wpcs_data
|
477 |
+
public function upgrade_notification( $_version, $_db_version, $_fresh_install ) {
|
478 |
+
|
479 |
+
$options_link = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_options' ), __( 'Settings', 'subscribe-to-comments-reloaded' ) );
|
480 |
+
$system_link = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_system' ), __( 'Log Settings', 'subscribe-to-comments-reloaded' ) );
|
481 |
+
|
482 |
+
if( ! $_fresh_install ) {
|
483 |
+
|
484 |
+
switch ($_version) {
|
485 |
+
case '160106':
|
486 |
+
$this->stcr_create_admin_notice(
|
487 |
+
'notify_update_' . $_version,
|
488 |
+
'unread',
|
489 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160106.', 'subscribe-to-comments-reloaded') . '</p>' .
|
490 |
+
'<p>' . __('This version includes many changes and fixes to improve your experience with the plugin, including One Click Unsubscribe, Rich Text Editor to create HTML email templates, Subscription Checkbox position, and more!', 'subscribe-to-comments-reloaded') . '</p>' .
|
491 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
492 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
493 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
494 |
+
'updated'
|
495 |
+
);
|
496 |
+
// Update the HTML emails option
|
497 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
498 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
499 |
+
break;
|
500 |
+
case '160115':
|
501 |
+
$this->stcr_create_admin_notice(
|
502 |
+
'notify_update_' . $_version,
|
503 |
+
'unread',
|
504 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160115.', 'subscribe-to-comments-reloaded') . '</p>' .
|
505 |
+
'<p>' . __('This version includes fixes to broken links while managing your subscriptions', 'subscribe-to-comments-reloaded') . '</p>' .
|
506 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
507 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
508 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
509 |
+
'updated'
|
510 |
+
);
|
511 |
+
// Update the HTML emails option
|
512 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
513 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
514 |
+
break;
|
515 |
+
case '160831':
|
516 |
+
$this->stcr_create_admin_notice(
|
517 |
+
'notify_update_' . $_version,
|
518 |
+
'unread',
|
519 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160831', 'subscribe-to-comments-reloaded') . '</p>' .
|
520 |
+
'<p>' . __('This version includes fixes to many bugs and also new features, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
521 |
+
'<ul>' .
|
522 |
+
'<li>' . __("<strong>New Feature</strong> Add new option to set the Reply To email address. This will help the subscribers to use the Reply option in their email agents.", 'subscribe-to-comments-reloaded') . '</li>'.
|
523 |
+
'<li>' . __("<strong>New Feature</strong> Improve the Admin Menu for StCR. Replace the StCR menu on the Settings Menu for a new Menu with sub menus for the pages.", 'subscribe-to-comments-reloaded') . '</li>'.
|
524 |
+
'<li>' . __("<strong>New Feature</strong> Safely Uninstall option to Delete the plugin without loosing your subscriptions. You can use this option also for reset all the settings, see the FAQ.", 'subscribe-to-comments-reloaded') . '</li>'.
|
525 |
+
'<li>' . __("<strong>New Feature</strong> Now the WordPress Authors can use the <strong>Subscribe authors</strong> option to autor subscribe to a Custom Post Type.", 'subscribe-to-comments-reloaded') . '</li>'.
|
526 |
+
'<li>' . __("<strong>New Feature</strong> A new field was added under the notification options to and the management link only by email and not to display it on the request link page.", 'subscribe-to-comments-reloaded') . '</li>'.
|
527 |
+
'</ul>' .
|
528 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
529 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
530 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
531 |
+
'updated'
|
532 |
+
);
|
533 |
+
// Update the HTML emails option
|
534 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
535 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
536 |
+
break;
|
537 |
+
case '160902':
|
538 |
+
$this->stcr_create_admin_notice(
|
539 |
+
'notify_update_' . $_version,
|
540 |
+
'unread',
|
541 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160902', 'subscribe-to-comments-reloaded') . '</p>' .
|
542 |
+
'<p>' . __('This version includes fixes to many bugs and also new features, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
543 |
+
'<ul>' .
|
544 |
+
'<li>' . __("<strong>Fix update</strong> this version Fixes some issue trigger by the previous 160831 version.", 'subscribe-to-comments-reloaded') . '</li>'.
|
545 |
+
'<li>' . __("<strong>New Feature</strong> Add new option to set the Reply To email address. This will help the subscribers to use the Reply option in their email agents.", 'subscribe-to-comments-reloaded') . '</li>'.
|
546 |
+
'<li>' . __("<strong>New Feature</strong> Improve the Admin Menu for StCR. Replace the StCR menu on the Settings Menu for a new Menu with sub menus for the pages.", 'subscribe-to-comments-reloaded') . '</li>'.
|
547 |
+
'<li>' . __("<strong>New Feature</strong> Safely Uninstall option to Delete the plugin without loosing your subscriptions. You can use this option also for reset all the settings, see the FAQ.", 'subscribe-to-comments-reloaded') . '</li>'.
|
548 |
+
'<li>' . __("<strong>New Feature</strong> Now the WordPress Authors can use the <strong>Subscribe authors</strong> option to autor subscribe to a Custom Post Type.", 'subscribe-to-comments-reloaded') . '</li>'.
|
549 |
+
'<li>' . __("<strong>New Feature</strong> A new field was added under the notification options to and the management link only by email and not to display it on the request link page.", 'subscribe-to-comments-reloaded') . '</li>'.
|
550 |
+
'</ul>' .
|
551 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
552 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
553 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
554 |
+
'updated'
|
555 |
+
);
|
556 |
+
// Update the HTML emails option
|
557 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
558 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
559 |
+
break;
|
560 |
+
case '160915':
|
561 |
+
$options_link = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_options' ), __( 'Settings', 'subscribe-to-comments-reloaded' ) );
|
562 |
+
$this->stcr_create_admin_notice(
|
563 |
+
'notify_update_' . $_version,
|
564 |
+
'unread',
|
565 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version 160915', 'subscribe-to-comments-reloaded') . '</p>' .
|
566 |
+
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
567 |
+
'<ul>' .
|
568 |
+
'<li>' . __("<strong>Fix</strong> StCR checkbox position issues with some WordPress themes, Go to the {$options_link} to activate it.", 'subscribe-to-comments-reloaded') . '</li>'.
|
569 |
+
'<li>' . __("<strong>Change</strong> the radio buttons in the management page for a dropdown.", 'subscribe-to-comments-reloaded') . '</li>'.
|
570 |
+
'<li>' . __("<strong>Improve</strong> Email validation for empty values and using a regex.", 'subscribe-to-comments-reloaded') . '</li>'.
|
571 |
+
'</ul>' .
|
572 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
573 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
574 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Working...">', 'subscribe-to-comments-reloaded') . '</p>',
|
575 |
+
'updated'
|
576 |
+
);
|
577 |
+
// Update the HTML emails option
|
578 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
579 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
580 |
+
break;
|
581 |
+
case '170428':
|
582 |
+
$this->stcr_create_admin_notice(
|
583 |
+
'notify_update_' . $_version,
|
584 |
+
'unread',
|
585 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
586 |
+
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
587 |
+
|
588 |
+
'<ul>' .
|
589 |
+
'<li>' . __("<strong>Fix</strong> Wrong confirmation link when the double check option is enable.", 'subscribe-to-comments-reloaded') . '</li>'.
|
590 |
+
'<li>' . __("<strong>Improve</strong> Manage subscription page. Take a look ;).", 'subscribe-to-comments-reloaded') . '</li>'.
|
591 |
+
'<li>' . __("<strong>Improve</strong> Log file manipulation. Now you can control how the log behaves, take a look at the {$system_link}.", 'subscribe-to-comments-reloaded') . '</li>'.
|
592 |
+
'</ul>' .
|
593 |
+
|
594 |
+
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
595 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
596 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
597 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
598 |
+
'updated'
|
599 |
+
);
|
600 |
+
// Update the HTML emails option
|
601 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
602 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
603 |
+
break;
|
604 |
+
case '170607':
|
605 |
+
$this->stcr_create_admin_notice(
|
606 |
+
'notify_update_' . $_version,
|
607 |
+
'unread',
|
608 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
609 |
+
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
610 |
+
|
611 |
+
'<ul>' .
|
612 |
+
'<li>' . __("<strong>Fix Critical Bug</strong> This version fix a critical bug on fresh installation regarding a database table creation.", 'subscribe-to-comments-reloaded') . '</li>'.
|
613 |
+
'<li>' . __("<strong>Add</strong> Option to control the inclusion of the style Font Awesome.", 'subscribe-to-comments-reloaded') . '</li>'.
|
614 |
+
'</ul>' .
|
615 |
+
|
616 |
+
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
617 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
618 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
619 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
620 |
+
'updated'
|
621 |
+
);
|
622 |
+
// Update the HTML emails option
|
623 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
624 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
625 |
+
break;
|
626 |
+
case '180212':
|
627 |
+
$this->stcr_create_admin_notice(
|
628 |
+
'notify_update_' . $_version,
|
629 |
+
'unread',
|
630 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
631 |
+
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
632 |
+
|
633 |
+
'<ul>' .
|
634 |
+
'<li>' . __("<strong>Security Patch</strong> This version add a patch for some security issues.", 'subscribe-to-comments-reloaded') . '</li>'.
|
635 |
+
'<li>' . __("<strong>Add</strong> Option to reset all the plugin options", 'subscribe-to-comments-reloaded') . '</li>'.
|
636 |
+
'<li>' . __("<strong>Fix</strong> issue regarding database collations", 'subscribe-to-comments-reloaded') . '</li>'.
|
637 |
+
'</ul>' .
|
638 |
+
|
639 |
+
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
640 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
641 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
642 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
643 |
+
'updated'
|
644 |
+
);
|
645 |
+
// Update the HTML emails option
|
646 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
647 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
648 |
+
break;
|
649 |
+
case '180225':
|
650 |
+
$this->stcr_create_admin_notice(
|
651 |
+
'notify_update_' . $_version,
|
652 |
+
'unread',
|
653 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
654 |
+
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
655 |
+
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
656 |
+
'<p>' . __('Please visit the <a href="https://wordpress.org/plugins/subscribe-to-comments-reloaded/changelog/" target="_blank">Changelog</a> for a complete list of changes.'
|
657 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
658 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
659 |
+
'updated'
|
660 |
+
);
|
661 |
+
// Update the HTML emails option
|
662 |
+
update_option( 'subscribe_reloaded_htmlify_message_links', 'no' );
|
663 |
+
update_option( 'subscribe_reloaded_enable_html_emails', 'yes' );
|
664 |
+
break;
|
665 |
+
case '190117':
|
666 |
+
$this->stcr_create_admin_notice(
|
667 |
+
'notify_update_' . $_version,
|
668 |
+
'unread',
|
669 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
670 |
+
'<p>' . __('This version includes fixes and improvements, ', 'subscribe-to-comments-reloaded') . '</p>' .
|
671 |
+
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
672 |
+
'<p>' . __('You might need to clear you cache !!', 'subscribe-to-comments-reloaded') . '</p>' .
|
673 |
+
'<p>' . __('Please visit the <a href="http://subscribe-reloaded.com/update/stcr-release-version-'.$_version.'/" target="_blank">Release Post</a> for a complete list of changes and guide about the new version.'
|
674 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
675 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
676 |
+
'updated'
|
677 |
+
);
|
678 |
+
break;
|
679 |
+
case '190214':
|
680 |
+
$this->stcr_create_admin_notice(
|
681 |
+
'notify_update_' . $_version,
|
682 |
+
'unread',
|
683 |
+
'<p>' . __('<strong>Subscribe to Comments Reloaded</strong> has been updated to version ' . $_version, 'subscribe-to-comments-reloaded') . '</p>' .
|
684 |
+
'<p>' . __('This version includes fixes., ', 'subscribe-to-comments-reloaded') . '</p>' .
|
685 |
+
'<p>' . __('If you find a bug or an issue you can report it <a href="https://github.com/stcr/subscribe-to-comments-reloaded/issues" target="_blank">here</a>.', 'subscribe-to-comments-reloaded') . '</p>' .
|
686 |
+
'<p>' . __('You might need to clear you cache !!', 'subscribe-to-comments-reloaded') . '</p>' .
|
687 |
+
'<p>' . __('Please visit the <a href="http://subscribe-reloaded.com/update/stcr-release-version-'.$_version.'/" target="_blank">Release Post</a> for a complete list of changes and guide about the new version.'
|
688 |
+
. '<a class="dismiss" href="#">Dismiss. </a>'
|
689 |
+
. '<img class="stcr-loading-animation" src="' . esc_url(admin_url() . '/images/loading.gif') . '" alt="Dismissing Message">', 'subscribe-to-comments-reloaded') . '</p>',
|
690 |
+
'updated'
|
691 |
+
);
|
692 |
+
break;
|
693 |
+
}
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Migrate/Add new plugin options on version upgrade.
|
699 |
+
*/
|
700 |
+
public function email_blacklist_post_types_recaptcha() {
|
701 |
+
|
702 |
+
// Return if already migrated.
|
703 |
+
if ( get_option( 'subscribe_reloaded_email_blacklist_post_types_recaptcha_migrated' ) ) {
|
704 |
+
return;
|
705 |
+
}
|
706 |
+
|
707 |
+
// For blacklist email.
|
708 |
+
update_option( 'subscribe_reloaded_blacklisted_emails', '' );
|
709 |
+
|
710 |
+
// For recaptcha version.
|
711 |
+
update_option( 'subscribe_reloaded_recaptcha_version', 'v2' );
|
712 |
+
|
713 |
+
// Migrate the Enable only on blog posts option to newly used options.
|
714 |
+
add_action( 'admin_init', array( $this, 'migrate_post_type_support' ) );
|
715 |
+
|
716 |
+
// Update the option.
|
717 |
+
update_option( 'subscribe_reloaded_email_blacklist_post_types_recaptcha_migrated', true );
|
718 |
+
|
719 |
+
}
|
720 |
+
|
721 |
+
/**
|
722 |
+
* Migrate the Enable only on blog posts option to newly used options.
|
723 |
+
*/
|
724 |
+
public function migrate_post_type_support() {
|
725 |
+
|
726 |
+
// Get the old data of Enable only on blog posts from database.
|
727 |
+
$only_for_posts = get_option( 'subscribe_reloaded_only_for_posts', 'no' );
|
728 |
+
if ( 'yes' == $only_for_posts ) {
|
729 |
+
$post_type_supports[] = 'post';
|
730 |
+
} else {
|
731 |
+
$post_type_supports = array();
|
732 |
+
$args = array(
|
733 |
+
'_builtin' => false,
|
734 |
+
'public' => true,
|
735 |
+
);
|
736 |
+
$post_types = get_post_types( $args );
|
737 |
+
$default_post_types = array(
|
738 |
+
'post',
|
739 |
+
'page',
|
740 |
+
);
|
741 |
+
$post_types = array_merge( $default_post_types, $post_types );
|
742 |
+
foreach ( $post_types as $post_type ) {
|
743 |
+
$post_type_supports[] = $post_type;
|
744 |
+
}
|
745 |
+
}
|
746 |
+
|
747 |
+
// Update the new option for the same Enable only on blog posts option with new way.
|
748 |
+
update_option( 'subscribe_reloaded_post_type_supports', $post_type_supports );
|
749 |
+
|
750 |
+
// Old key is required no more now.
|
751 |
+
delete_option( 'subscribe_reloaded_only_for_posts' );
|
752 |
+
|
753 |
+
}
|
754 |
+
|
755 |
+
private function patch_collation()
|
756 |
+
{
|
757 |
+
global $wpdb;
|
758 |
+
$wp_postmeta_table_data = $wpdb->get_results( 'SHOW TABLE STATUS LIKE \''. $wpdb->prefix .'postmeta\'' );
|
759 |
+
$wp_stcr_subs_table_data = $wpdb->get_results( 'SHOW TABLE STATUS LIKE \''. $wpdb->prefix .'subscribe_reloaded_subscribers\'' );
|
760 |
+
$wp_postmeta_collation_data = $wpdb->get_results( 'SHOW COLLATION' );
|
761 |
+
|
762 |
+
$wp_postmeta_collation = $wp_postmeta_table_data[0]->Collation;
|
763 |
+
$wp_stcr_subs_collation = $wp_stcr_subs_table_data[0]->Collation;
|
764 |
+
// Check Collation
|
765 |
+
if( $wp_postmeta_collation !== $wp_stcr_subs_collation )
|
766 |
+
{
|
767 |
+
// Get database collations
|
768 |
+
$database_collations = $wpdb->get_results( 'SHOW COLLATION' );
|
769 |
+
$collations = array();
|
770 |
+
|
771 |
+
if( ! empty($database_collations))
|
772 |
+
{
|
773 |
+
foreach ( $database_collations as $collation)
|
774 |
+
{
|
775 |
+
$collations[$collation->Collation] = $collation->Charset;
|
776 |
+
}
|
777 |
+
//$collations = array_unique($collations, SORT_STRING);
|
778 |
+
}
|
779 |
+
// Update subscribe_reloaded_subscribers table collation
|
780 |
+
$new_charset = $collations[$wp_postmeta_collation];
|
781 |
+
$new_collation = $wp_postmeta_collation;
|
782 |
+
$sql = 'ALTER TABLE '. $wpdb->prefix .'subscribe_reloaded_subscribers CONVERT TO CHARACTER SET '. $new_charset .' COLLATE '. $new_collation;
|
783 |
+
$result = $wpdb->query( $sql );
|
784 |
+
|
785 |
+
if( $result !== false ) // Query executed without any error.
|
786 |
+
{
|
787 |
+
// Update subscribe_reloaded_subscribers columns collation
|
788 |
+
$sql = 'ALTER TABLE '. $wpdb->prefix .'subscribe_reloaded_subscribers CHANGE subscriber_email subscriber_email VARCHAR(100) CHARACTER SET '. $new_charset .' COLLATE '. $new_collation .' NOT NULL';
|
789 |
+
$result = $wpdb->query( $sql );
|
790 |
+
|
791 |
+
if( $result !== false ) // Query executed without any error.
|
792 |
+
{
|
793 |
+
$sql = 'ALTER TABLE '. $wpdb->prefix .'subscribe_reloaded_subscribers CHANGE subscriber_unique_id subscriber_unique_id VARCHAR(50) CHARACTER SET '. $new_charset .' COLLATE '. $new_collation .' NOT NULL';
|
794 |
+
$result = $wpdb->query( $sql );
|
795 |
+
|
796 |
+
if( $result === false ) // Query executed without any error.
|
797 |
+
{
|
798 |
+
// Log query execution.
|
799 |
+
$this->stcr_logger("Error while updating the collation for the subscribe_reloaded_subscribers COLUMN subscriber_unique_id.");
|
800 |
+
$this->stcr_logger("\nDatabase Error: \" $wpdb->last_error \"\n");
|
801 |
+
}
|
802 |
+
}
|
803 |
+
else
|
804 |
+
{
|
805 |
+
// Log query execution.
|
806 |
+
$this->stcr_logger("Error while updating the collation for the subscribe_reloaded_subscribers table COLUMN subscriber_email");
|
807 |
+
$this->stcr_logger("\nDatabase Error: \" $wpdb->last_error \"\n");
|
808 |
+
}
|
809 |
+
}
|
810 |
+
else
|
811 |
+
{
|
812 |
+
// Log query execution.
|
813 |
+
$this->stcr_logger("Error while updating the collation for the subscribe_reloaded_subscribers table");
|
814 |
+
$this->stcr_logger("\nDatabase Error: \" $wpdb->last_error \"\n");
|
815 |
+
}
|
816 |
+
}
|
817 |
+
}
|
818 |
+
}
|
819 |
+
}
|
utils/stcr_utils.php
CHANGED
@@ -20,7 +20,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
20 |
Â
|
21 |
Â
public function __construct()
|
22 |
Â
{
|
23 |
-
|
24 |
Â
}
|
25 |
Â
|
26 |
Â
public function __destruct()
|
@@ -89,9 +89,10 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
89 |
Â
public function remove_user_subscriber_table($_email) {
|
90 |
Â
global $wpdb;
|
91 |
Â
|
92 |
-
$OK = $wpdb->query(
|
93 |
-
|
94 |
-
|
Â
|
|
95 |
Â
return $OK === false || $OK == 0 || empty( $OK ) ? false : $OK;
|
96 |
Â
}
|
97 |
Â
|
@@ -268,7 +269,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
268 |
Â
* Creates the HTML structure to properly handle HTML messages
|
269 |
Â
*/
|
270 |
Â
public function wrap_html_message( $_message = '', $_subject = '' ) {
|
271 |
-
|
272 |
Â
global $wp_locale;
|
273 |
Â
|
274 |
Â
// HTML emails
|
@@ -289,7 +290,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
289 |
Â
$body = "<body>$_message</body>";
|
290 |
Â
return $html . $head . $body . "</html>";
|
291 |
Â
}
|
292 |
-
|
293 |
Â
// Plain text emails
|
294 |
Â
} else {
|
295 |
Â
|
@@ -303,7 +304,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
303 |
Â
* Returns an email address where some possible 'offending' strings have been removed
|
304 |
Â
*/
|
305 |
Â
public function clean_email( $_email ) {
|
306 |
-
|
307 |
Â
if ( is_array( $_email) || is_object( $_email ) ) {
|
308 |
Â
return;
|
309 |
Â
}
|
@@ -318,8 +319,8 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
318 |
Â
"/mime\-version\:/i"
|
319 |
Â
);
|
320 |
Â
|
321 |
-
return sanitize_email( stripslashes( strip_tags( preg_replace( $offending_strings, '', $_email ) ) ) );
|
322 |
-
|
323 |
Â
}
|
324 |
Â
// end clean_email
|
325 |
Â
|
@@ -391,8 +392,29 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
391 |
Â
add_option( 'subscribe_reloaded_enable_font_awesome', 'yes', '', 'yes' );
|
392 |
Â
add_option( 'subscribe_reloaded_delete_options_subscriptions', 'no', '', 'no' );
|
393 |
Â
add_option( 'subscribe_reloaded_date_format', 'd M Y', '', 'no' );
|
394 |
-
add_option( 'subscribe_reloaded_only_for_posts', 'no', '', 'yes' );
|
395 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
396 |
Â
}
|
397 |
Â
/**
|
398 |
Â
* @since 08-February-2018
|
@@ -537,8 +559,8 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
537 |
Â
public function register_admin_scripts( $hook ) {
|
538 |
Â
|
539 |
Â
// paths
|
540 |
-
$stcr_admin_js = plugins_url( '
|
541 |
-
$stcr_admin_css = plugins_url( '
|
542 |
Â
|
543 |
Â
// register scripts
|
544 |
Â
wp_register_script('stcr-admin-js', $stcr_admin_js, array( 'jquery' ) );
|
@@ -548,7 +570,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
548 |
Â
|
549 |
Â
// check if we're on our pages
|
550 |
Â
if ( strpos( $hook, 'stcr' ) !== false ) {
|
551 |
-
|
552 |
Â
// enqueue scripts
|
553 |
Â
wp_enqueue_script('stcr-admin-js');
|
554 |
Â
|
@@ -578,7 +600,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
578 |
Â
*/
|
579 |
Â
public function register_script_to_wp( $handle, $script_name, $path_add = "" )
|
580 |
Â
{
|
581 |
-
$js_resource = plugins_url(
|
582 |
Â
wp_register_script( $handle, $js_resource );
|
583 |
Â
}
|
584 |
Â
/**includes/js/admin
|
@@ -596,8 +618,8 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
596 |
Â
* @author reedyseth
|
597 |
Â
*/
|
598 |
Â
public function register_plugin_scripts() {
|
599 |
-
|
600 |
-
$stcr_font_awesome_css = plugins_url( '
|
601 |
Â
// Font Awesome
|
602 |
Â
if ( get_option( 'subscribe_reloaded_enable_font_awesome' ) == "yes" ) {
|
603 |
Â
wp_register_style( 'stcr-font-awesome', $stcr_font_awesome_css );
|
@@ -606,7 +628,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
606 |
Â
|
607 |
Â
// google recaptcha
|
608 |
Â
if ( get_option( 'subscribe_reloaded_use_captcha', 'no' ) == 'yes' ) {
|
609 |
-
|
610 |
Â
// management page permalink
|
611 |
Â
$manager_page_permalink = get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
612 |
Â
if ( function_exists( 'qtrans_convertURL' ) ) {
|
@@ -617,7 +639,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
617 |
Â
if ( empty( $manager_page_permalink ) ) {
|
618 |
Â
$manager_page_permalink = '/comment-subscriptions/';
|
619 |
Â
}
|
620 |
-
|
621 |
Â
// remove the ending slash so both variations (with and without slash) work in the strpos check below
|
622 |
Â
$manager_page_permalink = rtrim( $manager_page_permalink, '/' );
|
623 |
Â
|
@@ -680,8 +702,8 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
680 |
Â
else
|
681 |
Â
{
|
682 |
Â
$value = get_option( 'subscribe_reloaded_' . $_option, $_default );
|
683 |
-
$value = html_entity_decode( stripslashes( $value ), ENT_QUOTES, 'UTF-8' );
|
684 |
-
$value = stripslashes( $value );
|
685 |
Â
// Set the cache value
|
686 |
Â
$this->menu_opts_cache[$_option] = $value;
|
687 |
Â
}
|
@@ -760,7 +782,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
760 |
Â
}
|
761 |
Â
|
762 |
Â
// Prevent XSS/CSRF attacks
|
763 |
-
$_value = trim( stripslashes( $_value ) );
|
764 |
Â
|
765 |
Â
switch ( $_type ) {
|
766 |
Â
case 'yesno':
|
@@ -787,6 +809,18 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
787 |
Â
case 'url':
|
788 |
Â
update_option( 'subscribe_reloaded_' . $_option, esc_url( $_value ) );
|
789 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
790 |
Â
break;
|
791 |
Â
default:
|
792 |
Â
update_option( 'subscribe_reloaded_' . $_option, esc_attr( $_value ) );
|
@@ -848,7 +882,7 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
848 |
Â
|
849 |
Â
return;
|
850 |
Â
}
|
851 |
-
|
852 |
Â
/**
|
853 |
Â
* Update a StCR notification status
|
854 |
Â
*
|
@@ -899,7 +933,36 @@ if( ! class_exists('\\'.__NAMESPACE__.'\\stcr_utils') )
|
|
899 |
Â
|
900 |
Â
fclose($file);
|
901 |
Â
}
|
902 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
903 |
Â
}
|
904 |
Â
}
|
905 |
-
}
|
20 |
Â
|
21 |
Â
public function __construct()
|
22 |
Â
{
|
23 |
+
|
24 |
Â
}
|
25 |
Â
|
26 |
Â
public function __destruct()
|
89 |
Â
public function remove_user_subscriber_table($_email) {
|
90 |
Â
global $wpdb;
|
91 |
Â
|
92 |
+
$OK = $wpdb->query( $wpdb->prepare(
|
93 |
+
"DELETE FROM " . $wpdb->prefix . "subscribe_reloaded_subscribers WHERE subscriber_email = %s",
|
94 |
+
$_email
|
95 |
+
));
|
96 |
Â
return $OK === false || $OK == 0 || empty( $OK ) ? false : $OK;
|
97 |
Â
}
|
98 |
Â
|
269 |
Â
* Creates the HTML structure to properly handle HTML messages
|
270 |
Â
*/
|
271 |
Â
public function wrap_html_message( $_message = '', $_subject = '' ) {
|
272 |
+
|
273 |
Â
global $wp_locale;
|
274 |
Â
|
275 |
Â
// HTML emails
|
290 |
Â
$body = "<body>$_message</body>";
|
291 |
Â
return $html . $head . $body . "</html>";
|
292 |
Â
}
|
293 |
+
|
294 |
Â
// Plain text emails
|
295 |
Â
} else {
|
296 |
Â
|
304 |
Â
* Returns an email address where some possible 'offending' strings have been removed
|
305 |
Â
*/
|
306 |
Â
public function clean_email( $_email ) {
|
307 |
+
|
308 |
Â
if ( is_array( $_email) || is_object( $_email ) ) {
|
309 |
Â
return;
|
310 |
Â
}
|
319 |
Â
"/mime\-version\:/i"
|
320 |
Â
);
|
321 |
Â
|
322 |
+
return sanitize_email( stripslashes( strip_tags( preg_replace( $offending_strings, '', strtolower( $_email ) ) ) ) );
|
323 |
+
|
324 |
Â
}
|
325 |
Â
// end clean_email
|
326 |
Â
|
392 |
Â
add_option( 'subscribe_reloaded_enable_font_awesome', 'yes', '', 'yes' );
|
393 |
Â
add_option( 'subscribe_reloaded_delete_options_subscriptions', 'no', '', 'no' );
|
394 |
Â
add_option( 'subscribe_reloaded_date_format', 'd M Y', '', 'no' );
|
Â
|
|
395 |
Â
|
396 |
+
// For blacklist email.
|
397 |
+
add_option( 'subscribe_reloaded_blacklisted_emails', '', '', 'yes' );
|
398 |
+
|
399 |
+
// For recaptcha version.
|
400 |
+
add_option( 'subscribe_reloaded_recaptcha_version', 'v2', '', 'yes' );
|
401 |
+
|
402 |
+
// For post type support.
|
403 |
+
$post_type_supports = array();
|
404 |
+
$args = array(
|
405 |
+
'_builtin' => false,
|
406 |
+
'public' => true,
|
407 |
+
);
|
408 |
+
$post_types = get_post_types( $args );
|
409 |
+
$default_post_types = array(
|
410 |
+
'post',
|
411 |
+
'page',
|
412 |
+
);
|
413 |
+
$post_types = array_merge( $default_post_types, $post_types );
|
414 |
+
foreach ( $post_types as $post_type ) {
|
415 |
+
$post_type_supports[] = $post_type;
|
416 |
+
}
|
417 |
+
add_option( 'subscribe_reloaded_post_type_supports', $post_type_supports, '', 'yes' );
|
418 |
Â
}
|
419 |
Â
/**
|
420 |
Â
* @since 08-February-2018
|
559 |
Â
public function register_admin_scripts( $hook ) {
|
560 |
Â
|
561 |
Â
// paths
|
562 |
+
$stcr_admin_js = plugins_url( '/includes/js/stcr-admin.js', STCR_PLUGIN_FILE );
|
563 |
+
$stcr_admin_css = plugins_url( '/includes/css/stcr-admin-style.css', STCR_PLUGIN_FILE );
|
564 |
Â
|
565 |
Â
// register scripts
|
566 |
Â
wp_register_script('stcr-admin-js', $stcr_admin_js, array( 'jquery' ) );
|
570 |
Â
|
571 |
Â
// check if we're on our pages
|
572 |
Â
if ( strpos( $hook, 'stcr' ) !== false ) {
|
573 |
+
|
574 |
Â
// enqueue scripts
|
575 |
Â
wp_enqueue_script('stcr-admin-js');
|
576 |
Â
|
600 |
Â
*/
|
601 |
Â
public function register_script_to_wp( $handle, $script_name, $path_add = "" )
|
602 |
Â
{
|
603 |
+
$js_resource = plugins_url( "/$path_add/$script_name", STCR_PLUGIN_FILE );
|
604 |
Â
wp_register_script( $handle, $js_resource );
|
605 |
Â
}
|
606 |
Â
/**includes/js/admin
|
618 |
Â
* @author reedyseth
|
619 |
Â
*/
|
620 |
Â
public function register_plugin_scripts() {
|
621 |
+
|
622 |
+
$stcr_font_awesome_css = plugins_url( '/includes/css/font-awesome.min.css', STCR_PLUGIN_FILE );
|
623 |
Â
// Font Awesome
|
624 |
Â
if ( get_option( 'subscribe_reloaded_enable_font_awesome' ) == "yes" ) {
|
625 |
Â
wp_register_style( 'stcr-font-awesome', $stcr_font_awesome_css );
|
628 |
Â
|
629 |
Â
// google recaptcha
|
630 |
Â
if ( get_option( 'subscribe_reloaded_use_captcha', 'no' ) == 'yes' ) {
|
631 |
+
|
632 |
Â
// management page permalink
|
633 |
Â
$manager_page_permalink = get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
634 |
Â
if ( function_exists( 'qtrans_convertURL' ) ) {
|
639 |
Â
if ( empty( $manager_page_permalink ) ) {
|
640 |
Â
$manager_page_permalink = '/comment-subscriptions/';
|
641 |
Â
}
|
642 |
+
|
643 |
Â
// remove the ending slash so both variations (with and without slash) work in the strpos check below
|
644 |
Â
$manager_page_permalink = rtrim( $manager_page_permalink, '/' );
|
645 |
Â
|
702 |
Â
else
|
703 |
Â
{
|
704 |
Â
$value = get_option( 'subscribe_reloaded_' . $_option, $_default );
|
705 |
+
$value = ( ! is_array( $value ) ) ? html_entity_decode( stripslashes( $value ), ENT_QUOTES, 'UTF-8' ) : wp_unslash( $value );
|
706 |
+
$value = ( ! is_array( $value ) ) ? stripslashes( $value ) : wp_unslash( $value );
|
707 |
Â
// Set the cache value
|
708 |
Â
$this->menu_opts_cache[$_option] = $value;
|
709 |
Â
}
|
782 |
Â
}
|
783 |
Â
|
784 |
Â
// Prevent XSS/CSRF attacks
|
785 |
+
$_value = ( 'multicheck' !== $_type ) ? trim( stripslashes( $_value ) ) : wp_unslash( $_value );
|
786 |
Â
|
787 |
Â
switch ( $_type ) {
|
788 |
Â
case 'yesno':
|
809 |
Â
case 'url':
|
810 |
Â
update_option( 'subscribe_reloaded_' . $_option, esc_url( $_value ) );
|
811 |
Â
|
812 |
+
break;
|
813 |
+
case 'textarea':
|
814 |
+
update_option( 'subscribe_reloaded_' . $_option, wp_kses_post( $_value ) );
|
815 |
+
|
816 |
+
break;
|
817 |
+
case 'multicheck':
|
818 |
+
update_option( 'subscribe_reloaded_' . $_option, wp_unslash( $_value ) );
|
819 |
+
|
820 |
+
break;
|
821 |
+
case 'select':
|
822 |
+
update_option( 'subscribe_reloaded_' . $_option, sanitize_key( $_value ) );
|
823 |
+
|
824 |
Â
break;
|
825 |
Â
default:
|
826 |
Â
update_option( 'subscribe_reloaded_' . $_option, esc_attr( $_value ) );
|
882 |
Â
|
883 |
Â
return;
|
884 |
Â
}
|
885 |
+
|
886 |
Â
/**
|
887 |
Â
* Update a StCR notification status
|
888 |
Â
*
|
933 |
Â
|
934 |
Â
fclose($file);
|
935 |
Â
}
|
936 |
+
|
937 |
+
}
|
938 |
+
|
939 |
+
/**
|
940 |
+
* Function to check if the commenter email address is blacklisted or not.
|
941 |
+
*
|
942 |
+
* @param string $email_to_check The commentor's email address.
|
943 |
+
*
|
944 |
+
* @return bool
|
945 |
+
*/
|
946 |
+
public function blacklisted_emails( $email_to_check = '' ) {
|
947 |
+
|
948 |
+
// If the emails is blacklisted then, do not proceed to send the subscription confirmation email.
|
949 |
+
$blacklisted_emails = get_option( 'subscribe_reloaded_blacklisted_emails', '' );
|
950 |
+
$email_blacklist = ! empty( $blacklisted_emails ) ? explode( ',', $blacklisted_emails ) : false;
|
951 |
+
|
952 |
+
if ( is_array( $email_blacklist ) ) {
|
953 |
+
foreach ( $email_blacklist as $blacklist_item ) {
|
954 |
+
$blacklisted_items = trim( $blacklist_item );
|
955 |
+
|
956 |
+
if ( ! empty( trim( $blacklisted_items ) ) ) {
|
957 |
+
if ( is_email( $email_to_check ) === is_email( $blacklisted_items ) ) {
|
958 |
+
return false;
|
959 |
+
}
|
960 |
+
}
|
961 |
+
}
|
962 |
+
}
|
963 |
+
|
964 |
+
return true;
|
965 |
+
|
966 |
Â
}
|
967 |
Â
}
|
968 |
+
}
|
wp_subscribe_reloaded.php
CHANGED
@@ -1,1746 +1,1780 @@
|
|
1 |
-
<?php
|
2 |
-
namespace stcr;
|
3 |
-
|
4 |
-
// Avoid direct access to this piece of code
|
5 |
-
if ( ! function_exists( 'add_action' ) ) {
|
6 |
-
header( 'Location: /' );
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
// globals
|
11 |
-
define( __NAMESPACE__.'\\VERSION','
|
12 |
-
define( __NAMESPACE__.'\\DEVELOPMENT', false );
|
13 |
-
define( __NAMESPACE__.'\\SLUG', "subscribe-to-comments-reloaded" );
|
14 |
-
|
15 |
-
// load files
|
16 |
-
require_once dirname(__FILE__).'/utils/stcr_manage.php';
|
17 |
-
require_once dirname(__FILE__).'/classes/stcr_i18n.php';
|
18 |
-
require_once dirname(__FILE__).'/utils/functions.php';
|
19 |
-
|
20 |
-
// Main plugin class
|
21 |
-
if( ! class_exists('\\'.__NAMESPACE__.'\\wp_subscribe_reloaded') ) {
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Main plugin class
|
25 |
-
*
|
26 |
-
* __construct ( Constructor )
|
27 |
-
* add_test_subscriptions ( Adds subscriptions for testing purposes )
|
28 |
-
* define_wp_hooks ( Define the WordPress Hooks that will be used by the plugin. )
|
29 |
-
* display_admin_header ( Display admin header menu )
|
30 |
-
* subscribe_reloaded_load_plugin_textdomain ( Load localization files )
|
31 |
-
* plugin_settings_link ( Add Settings link to plugin on plugins page )
|
32 |
-
* _get_comment_object ( Retrieves the comment information from the database )
|
33 |
-
* new_comment_posted ( Takes the appropriate action, when a new comment is posted )
|
34 |
-
* is_double_check_enabled ( Is double check ( subscriptions need to be confirmed ) enabled )
|
35 |
-
* comment_status_changed ( Actions when comments status changes ( approve/unapprove/spam/trash ) )
|
36 |
-
* comment_deleted ( Actions when comment is deleted )
|
37 |
-
* subscribe_post_author ( Subscribe the post author )
|
38 |
-
* subscribe_reloaded_manage ( Displays the appropriate management page )
|
39 |
-
* is_author ( Checks if current logged in user is the author )
|
40 |
-
* is_user_subscribed ( Checks if a given email address is subscribed to a post )
|
41 |
-
* add_subscription ( Adds a new subscription )
|
42 |
-
* delete_subscriptions ( Deletes one or more subscriptions from the database )
|
43 |
-
* retrieve_user_subscriptions ( Retries user subscriptions by post ID )
|
44 |
-
* update_subscription_status ( Updates the status of an existing subscription )
|
45 |
-
* update_subscription_email ( Updates the email address of an existing subscription )
|
46 |
-
* get_subscriptions ( Retrieves a list of emails subscribed to a specific post )
|
47 |
-
* notify_user ( Sends the notification message to a given user )
|
48 |
-
* subscribe_reloaded_show ( Displays the checkbox to allow visitors to subscribe )
|
49 |
-
* set_user_cookie ( Set a cookie if the user just subscribed without commenting )
|
50 |
-
* management_page_sc ( Management page shortcode )
|
51 |
-
* comment_content_prepend ( Add custom content before comment content )
|
52 |
-
*/
|
53 |
-
class wp_subscribe_reloaded extends stcr_manage {
|
54 |
-
|
55 |
-
public $stcr_i18n;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Constructor
|
59 |
-
*/
|
60 |
-
public function __construct() {
|
61 |
-
|
62 |
-
// run parent constructor.
|
63 |
-
parent::__construct();
|
64 |
-
|
65 |
-
$this->salt = defined( 'NONCE_KEY' ) ? NONCE_KEY : 'please create a unique key in your wp-config.php';
|
66 |
-
|
67 |
-
// show the checkbox - You can manually override this by adding the corresponding function in your template
|
68 |
-
if ( get_option( 'subscribe_reloaded_show_subscription_box' ) === 'yes' ) {
|
69 |
-
|
70 |
-
if ( get_option('subscribe_reloaded_stcr_position') == 'yes' ) {
|
71 |
-
add_action( 'comment_form', array($this, 'subscribe_reloaded_show'), 5, 0 );
|
72 |
-
} else {
|
73 |
-
add_filter( 'comment_form_submit_field', array($this, 'subscribe_reloaded_show'), 5, 1 );
|
74 |
-
}
|
75 |
-
|
76 |
-
// when users must be logged in to comment and current visitor is not logged in
|
77 |
-
add_action( 'comment_form_must_log_in_after', array($this, 'subscribe_reloaded_show'), 5, 0 );
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
$this->maybe_update();
|
82 |
-
|
83 |
-
// define WordPress hooks the plugin uses
|
84 |
-
$this->define_wp_hooks();
|
85 |
-
|
86 |
-
// localization
|
87 |
-
$this->stcr_i18n = new stcr_i18n();
|
88 |
-
|
89 |
-
// add subscriptions for tests
|
90 |
-
if ( DEVELOPMENT ) {
|
91 |
-
$this->add_test_subscriptions( 1000, 18,'Y', 'dev', 30);
|
92 |
-
}
|
93 |
-
|
94 |
-
// management page shortcode
|
95 |
-
add_shortcode( 'stcr_management_page', array( $this, 'management_page_sc' ) );
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Adds subscriptions for testing purposes
|
101 |
-
*
|
102 |
-
* @since 190705
|
103 |
-
*/
|
104 |
-
public function add_test_subscriptions( $iterations, $post_id, $status = 'Y', $email_prefix = 'dev', $last_id_subs = 0 ) {
|
105 |
-
for ( $i = $last_id_subs+1; $i <= $iterations; $i++) {
|
106 |
-
$this->add_subscription( $post_id, "{$email_prefix}_{$i}" . time() . "@dev.com", $status );
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Define the WordPress Hooks that will be used by the plugin.
|
112 |
-
*
|
113 |
-
* @since 180302
|
114 |
-
*/
|
115 |
-
public function define_wp_hooks() {
|
116 |
-
|
117 |
-
// new comment posted
|
118 |
-
add_action( 'comment_post', array( $this, 'new_comment_posted' ), 12, 2 );
|
119 |
-
|
120 |
-
// add hook for the subscribe_reloaded_purge, define on the constructure so that the hook is read on time.
|
121 |
-
add_action('_cron_subscribe_reloaded_purge', array($this, 'subscribe_reloaded_purge'), 10 );
|
122 |
-
add_action('_cron_log_file_purge', array($this, 'log_file_purge'), 10 );
|
123 |
-
|
124 |
-
// load text domain
|
125 |
-
add_action( 'plugins_loaded', array( $this, 'subscribe_reloaded_load_plugin_textdomain' ) );
|
126 |
-
|
127 |
-
// front end
|
128 |
-
if ( ! is_admin() ) {
|
129 |
-
|
130 |
-
// management page permalink
|
131 |
-
$manager_page_permalink = get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
132 |
-
if ( function_exists( 'qtrans_convertURL' ) ) {
|
133 |
-
$manager_page_permalink = qtrans_convertURL( $manager_page_permalink );
|
134 |
-
}
|
135 |
-
|
136 |
-
// management page permalink fallback
|
137 |
-
if ( empty( $manager_page_permalink ) ) {
|
138 |
-
$manager_page_permalink = '/comment-subscriptions/';
|
139 |
-
}
|
140 |
-
|
141 |
-
// remove the ending slash so both variations (with and without slash) work in the strpos check below
|
142 |
-
$manager_page_permalink = rtrim( $manager_page_permalink, '/' );
|
143 |
-
|
144 |
-
// if we are on the management page, filter the_posts
|
145 |
-
if ( ( strpos( $_SERVER["REQUEST_URI"], $manager_page_permalink ) !== false ) ) {
|
146 |
-
|
147 |
-
$request_uri = $_SERVER['REQUEST_URI'];
|
148 |
-
$request_uri_arr = explode( $manager_page_permalink, $request_uri );
|
149 |
-
|
150 |
-
// don't show management page if a "child page"
|
151 |
-
if ( empty( $request_uri_arr[1] ) || $request_uri_arr[1] == '/' || strpos( $request_uri_arr[1], '/?' ) === 0 ) {
|
152 |
-
add_filter( 'the_posts', array( $this, 'subscribe_reloaded_manage' ), 10, 2 );
|
153 |
-
}
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
// filter to add custom output before comment content
|
158 |
-
add_filter( 'comment_text', array( $this, 'comment_content_prepend' ), 10, 2 );
|
159 |
-
|
160 |
-
// script to move the subscription form
|
161 |
-
add_action( 'wp_footer', array( $this, 'move_form_with_js' ), 20 );
|
162 |
-
|
163 |
-
// enqueue scripts
|
164 |
-
$this->utils->hook_plugin_scripts();
|
165 |
-
|
166 |
-
// wp admin
|
167 |
-
} else {
|
168 |
-
|
169 |
-
// hook for WPMU - new blog created
|
170 |
-
add_action( 'wpmu_new_blog', array( $this, 'new_blog' ), 10, 1 );
|
171 |
-
|
172 |
-
// remove subscriptions for post that is being deleted
|
173 |
-
add_action( 'delete_post', array( $this, 'delete_subscriptions' ), 10, 2 );
|
174 |
-
|
175 |
-
// remove subscriptions when a comment is deleted or status changed
|
176 |
-
add_action( 'deleted_comment', array( $this, 'comment_deleted' ) );
|
177 |
-
add_action( 'wp_set_comment_status', array( $this, 'comment_status_changed' ) );
|
178 |
-
|
179 |
-
// new columns in post/comment tables ( WP admin > Posts and WP admin > Comments )
|
180 |
-
add_filter( 'manage_edit-comments_columns', array( $this, 'add_column_header' ) );
|
181 |
-
add_filter( 'manage_posts_columns', array( $this, 'add_column_header' ) );
|
182 |
-
add_action( 'manage_comments_custom_column', array( $this, 'add_comment_column' ) );
|
183 |
-
add_action( 'manage_posts_custom_column', array( $this, 'add_post_column' ) );
|
184 |
-
|
185 |
-
// Add appropriate entries in the admin menu
|
186 |
-
add_action( 'admin_menu', array( $this, 'add_config_menu' ) );
|
187 |
-
add_action( 'admin_print_styles-edit-comments.php', array( $this, 'add_post_comments_stylesheet' ) );
|
188 |
-
add_action( 'admin_print_styles-edit.php', array( $this, 'add_post_comments_stylesheet' ) );
|
189 |
-
|
190 |
-
// admin header
|
191 |
-
add_action( 'in_admin_header', array( $this, 'display_admin_header' ), 100 );
|
192 |
-
|
193 |
-
// admin init
|
194 |
-
add_action( 'admin_init', array( $this, 'stcr_admin_init' ) );
|
195 |
-
|
196 |
-
// admin notices
|
197 |
-
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
198 |
-
|
199 |
-
// shortcodes to use the management URL sitewide
|
200 |
-
add_shortcode( 'subscribe-url', array( $this, 'subscribe_url_shortcode' ) );
|
201 |
-
|
202 |
-
// action links for listing on WP admin > Plugins
|
203 |
-
add_filter( 'plugin_action_links', array( $this, 'plugin_settings_link' ), 10, 2 );
|
204 |
-
|
205 |
-
// subscribe post authors, if auto subscribe for authors enabled
|
206 |
-
if ( get_option( 'subscribe_reloaded_notify_authors' ) === 'yes' ) {
|
207 |
-
add_action( 'publish_post', array( $this, 'subscribe_post_author' ) );
|
208 |
-
}
|
209 |
-
|
210 |
-
// enqueue scripts
|
211 |
-
$this->utils->hook_admin_scripts();
|
212 |
-
|
213 |
-
// ajax for admin notices ( mark as read )
|
214 |
-
$this->utils->stcr_create_ajax_notices();
|
215 |
-
|
216 |
-
// download system information file
|
217 |
-
add_action( 'admin_init', array( $this, 'sysinfo_download' ) );
|
218 |
-
|
219 |
-
// exclude subscriptions on post duplication
|
220 |
-
add_filter( 'duplicate_post_blacklist_filter', array( $this, 'duplicate_post_exclude_subs' ) );
|
221 |
-
|
222 |
-
}
|
223 |
-
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Display the admin header menu
|
228 |
-
*
|
229 |
-
* @since 190705 Cleanup
|
230 |
-
*/
|
231 |
-
public function display_admin_header () {
|
232 |
-
|
233 |
-
global $wp_locale;
|
234 |
-
|
235 |
-
$slug = 'stcr_manage_subscriptions';
|
236 |
-
$current_page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
237 |
-
|
238 |
-
// define the menu items
|
239 |
-
$array_pages = array(
|
240 |
-
'stcr_manage_subscriptions' => __( 'Manage subscriptions', 'subscribe-to-comments-reloaded' ),
|
241 |
-
'stcr_comment_form' => __( 'Comment Form', 'subscribe-to-comments-reloaded' ),
|
242 |
-
'stcr_management_page' => __( 'Management Page', 'subscribe-to-comments-reloaded' ),
|
243 |
-
'stcr_notifications' => __( 'Notifications', 'subscribe-to-comments-reloaded' ),
|
244 |
-
'stcr_options' => __( 'Options', 'subscribe-to-comments-reloaded' ),
|
245 |
-
'stcr_support' => __( 'Support', 'subscribe-to-comments-reloaded' ),
|
246 |
-
'stcr_system' => __( 'Options', 'subscribe-to-comments-reloaded' )
|
247 |
-
);
|
248 |
-
|
249 |
-
// do not proceed if not on a STCR admin page
|
250 |
-
if ( ! array_key_exists( $current_page, $array_pages) ) {
|
251 |
-
return;
|
252 |
-
}
|
253 |
-
|
254 |
-
?>
|
255 |
-
|
256 |
-
<nav class="navbar navbar-expand-lg navbar-light bg-light <?php echo $wp_locale->text_direction ?>">
|
257 |
-
|
258 |
-
<a class="navbar-brand"><img src="<?php echo plugins_url(
|
259 |
-
|
260 |
-
<div class="collapse navbar-collapse">
|
261 |
-
|
262 |
-
<ul class="navbar-nav">
|
263 |
-
|
264 |
-
<?php
|
265 |
-
|
266 |
-
// go through each stcr admin page
|
267 |
-
foreach ( $array_pages as $page => $page_desc ) :
|
268 |
-
|
269 |
-
// skip strc_system because it's added as part of stcr_options
|
270 |
-
if ( $page == 'stcr_system' ) continue;
|
271 |
-
|
272 |
-
?><li class="<?php echo $page == 'stcr_options' ? 'dropdown' : ''; ?>"><?php
|
273 |
-
|
274 |
-
// dropdrown for options menu item
|
275 |
-
if ( $page == 'stcr_options' ) :
|
276 |
-
|
277 |
-
?>
|
278 |
-
<a
|
279 |
-
class="nav-link dropdown-toggle <?php echo ( $current_page == $page || $current_page == 'stcr_system' ? ' stcr-active-tab' : '' ); ?>"
|
280 |
-
style="padding: 5px 12px 0 0;"
|
281 |
-
href="#"
|
282 |
-
id="navbarDropdown"
|
283 |
-
role="button"
|
284 |
-
data-toggle="dropdown"
|
285 |
-
aria-haspopup="true"
|
286 |
-
aria-expanded="false">
|
287 |
-
<?php echo $page_desc; ?>
|
288 |
-
</a>
|
289 |
-
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
290 |
-
<a class="dropdown-item" href="admin.php?page=<?php echo $page; ?>"><?php echo __('StCR Options', 'subscribe-to-comments-reloaded'); ?></a>
|
291 |
-
<div class="dropdown-divider"></div>
|
292 |
-
<a class="dropdown-item" href="admin.php?page=stcr_system"><?php echo __('StCR System', 'subscribe-to-comments-reloaded'); ?></a>
|
293 |
-
</div>
|
294 |
-
<?php
|
295 |
-
|
296 |
-
// regular menu items
|
297 |
-
else :
|
298 |
-
|
299 |
-
?>
|
300 |
-
<a
|
301 |
-
class="navbar-brand <?php echo ( $current_page == $page ) ? ' stcr-active-tab' : ''; ?>"
|
302 |
-
href="admin.php?page=<?php echo $page; ?>">
|
303 |
-
<?php echo $page_desc; ?>
|
304 |
-
</a>
|
305 |
-
<?php
|
306 |
-
|
307 |
-
endif;
|
308 |
-
|
309 |
-
?></li><?php
|
310 |
-
|
311 |
-
endforeach;
|
312 |
-
|
313 |
-
?>
|
314 |
-
|
315 |
-
</ul><!-- .navbar-nav -->
|
316 |
-
|
317 |
-
</div><!-- .navbar-collapse -->
|
318 |
-
|
319 |
-
</nav><!-- .navbar -->
|
320 |
-
<?php
|
321 |
-
|
322 |
-
}
|
323 |
-
|
324 |
-
/**
|
325 |
-
* Load localization files
|
326 |
-
*
|
327 |
-
* @since 190705 cleanup
|
328 |
-
*/
|
329 |
-
function subscribe_reloaded_load_plugin_textdomain() {
|
330 |
-
|
331 |
-
load_plugin_textdomain( 'subscribe-to-comments-reloaded', FALSE, SLUG . '/langs/' );
|
332 |
-
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Add Settings link to plugin on plugins page
|
337 |
-
*
|
338 |
-
* @since 190705 cleanup
|
339 |
-
*/
|
340 |
-
public function plugin_settings_link( $links, $file ) {
|
341 |
-
|
342 |
-
if (
|
343 |
-
$links['settings'] = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_options' ), __( 'Settings', 'subscribe-to-comments-reloaded' ) );
|
344 |
-
}
|
345 |
-
|
346 |
-
return $links;
|
347 |
-
|
348 |
-
}
|
349 |
-
|
350 |
-
/**
|
351 |
-
* Retrieves the comment information from the database
|
352 |
-
*
|
353 |
-
* @since 190705 cleanup
|
354 |
-
*/
|
355 |
-
public function _get_comment_object( $_comment_ID ) {
|
356 |
-
|
357 |
-
global $wpdb;
|
358 |
-
|
359 |
-
return $wpdb->get_row(
|
360 |
-
$wpdb->prepare(
|
361 |
-
"SELECT comment_post_ID, comment_author_email, comment_approved, comment_type, comment_parent
|
362 |
-
FROM $wpdb->comments
|
363 |
-
WHERE comment_ID = %d
|
364 |
-
LIMIT 1", $_comment_ID
|
365 |
-
), OBJECT
|
366 |
-
);
|
367 |
-
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Takes the appropriate action, when a new comment is posted
|
372 |
-
*
|
373 |
-
* @since 190705 cleanup
|
374 |
-
*/
|
375 |
-
public function new_comment_posted( $_comment_ID = 0, $_comment_status = 0 ) {
|
376 |
-
|
377 |
-
// get information about the comment
|
378 |
-
$info = $this->_get_comment_object( $_comment_ID );
|
379 |
-
|
380 |
-
// return if no info found or comment marked as spam
|
381 |
-
if ( empty( $info ) || $info->comment_approved == 'spam' ) {
|
382 |
-
return $_comment_ID;
|
383 |
-
}
|
384 |
-
|
385 |
-
// return if subscriptions disabled for this post
|
386 |
-
$is_disabled = get_post_meta( $info->comment_post_ID, 'stcr_disable_subscriptions', true );
|
387 |
-
if ( ! empty( $is_disabled ) ) {
|
388 |
-
return $_comment_ID;
|
389 |
-
}
|
390 |
-
|
391 |
-
// return if trackback/pingback ( if set not to notify on those )
|
392 |
-
if ( ( get_option( 'subscribe_reloaded_process_trackbacks', 'no' ) == 'no' ) && ( $info->comment_type == 'trackback' || $info->comment_type == 'pingback' ) ) {
|
393 |
-
return $_comment_ID;
|
394 |
-
}
|
395 |
-
|
396 |
-
// process the subscription
|
397 |
-
if ( ! empty( $_POST['subscribe-reloaded'] ) && ! empty( $info->comment_author_email ) ) {
|
398 |
-
|
399 |
-
// check if subscription type is valid
|
400 |
-
if ( in_array( $_POST['subscribe-reloaded'], array( 'replies', 'digest', 'yes' ) ) ) {
|
401 |
-
|
402 |
-
// get subscription type
|
403 |
-
switch ($_POST['subscribe-reloaded']) {
|
404 |
-
case 'replies':
|
405 |
-
$status = 'R';
|
406 |
-
break;
|
407 |
-
case 'digest':
|
408 |
-
$status = 'D';
|
409 |
-
break;
|
410 |
-
default:
|
411 |
-
$status = 'Y';
|
412 |
-
break;
|
413 |
-
}
|
414 |
-
|
415 |
-
// if not already subscribed
|
416 |
-
if ( ! $this->is_user_subscribed($info->comment_post_ID, $info->comment_author_email)) {
|
417 |
-
|
418 |
-
// if double check enabled, send confirmation email and append C to status
|
419 |
-
if ( $this->is_double_check_enabled($info) ) {
|
420 |
-
$this->sendConfirmationEMail($info);
|
421 |
-
$status = "{$status}C";
|
422 |
-
}
|
423 |
-
|
424 |
-
// add the subscription
|
425 |
-
$this->add_subscription($info->comment_post_ID, $info->comment_author_email, $status);
|
426 |
-
|
427 |
-
// return ( do not proceed with sending notifications ) if comment held for moderation
|
428 |
-
if ( $info->comment_approved == 0 ) {
|
429 |
-
return $_comment_ID;
|
430 |
-
}
|
431 |
-
|
432 |
-
}
|
433 |
-
|
434 |
-
}
|
435 |
-
|
436 |
-
}
|
437 |
-
|
438 |
-
// if comment approved, notify subscribed users about the comment
|
439 |
-
if ( $info->comment_approved == 1 ) {
|
440 |
-
|
441 |
-
// get all subscriptions
|
442 |
-
$subscriptions = $this->get_subscriptions(
|
443 |
-
array(
|
444 |
-
'post_id',
|
445 |
-
'status'
|
446 |
-
),
|
447 |
-
array(
|
448 |
-
'equals',
|
449 |
-
'equals'
|
450 |
-
),
|
451 |
-
array(
|
452 |
-
$info->comment_post_ID,
|
453 |
-
'Y'
|
454 |
-
)
|
455 |
-
);
|
456 |
-
|
457 |
-
// is this a reply to an existing comment?
|
458 |
-
if ( ! empty( $info->comment_parent ) ) {
|
459 |
-
|
460 |
-
// merge subscriptions
|
461 |
-
$subscriptions = array_merge(
|
462 |
-
$subscriptions,
|
463 |
-
$this->get_subscriptions(
|
464 |
-
'parent',
|
465 |
-
'equals',
|
466 |
-
array(
|
467 |
-
$info->comment_parent,
|
468 |
-
$info->comment_post_ID
|
469 |
-
)
|
470 |
-
)
|
471 |
-
);
|
472 |
-
|
473 |
-
}
|
474 |
-
|
475 |
-
// post author info
|
476 |
-
$post_author_id = get_post_field( 'post_author', $info->comment_post_ID );
|
477 |
-
$post_author_data = get_userdata( $post_author_id );
|
478 |
-
$post_author_email = $post_author_data->user_email;
|
479 |
-
$post_author_notified = false;
|
480 |
-
|
481 |
-
// notify subscribers
|
482 |
-
foreach ( $subscriptions as $a_subscription ) {
|
483 |
-
|
484 |
-
// skip comment author
|
485 |
-
if ( $a_subscription->email != $info->comment_author_email ) {
|
486 |
-
|
487 |
-
//
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
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 |
-
|
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 |
-
return
|
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 |
-
if ( ! empty( $
|
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 |
-
if
|
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 |
-
$key_expired
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
($
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
//
|
844 |
-
|
845 |
-
($post_ID > 0) &&
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
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 |
-
if ( empty( $_email ) ) {
|
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 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
//
|
1295 |
-
$
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
$
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
//
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
$
|
1458 |
-
$message
|
1459 |
-
$
|
1460 |
-
$
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
$
|
1474 |
-
|
1475 |
-
|
1476 |
-
$
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
);
|
1483 |
-
|
1484 |
-
|
1485 |
-
$
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
$
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
$
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
$
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
$
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
)
|
1594 |
-
|
1595 |
-
|
1596 |
-
//
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
$
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
$
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
if (
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
namespace stcr;
|
3 |
+
|
4 |
+
// Avoid direct access to this piece of code
|
5 |
+
if ( ! function_exists( 'add_action' ) ) {
|
6 |
+
header( 'Location: /' );
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
// globals
|
11 |
+
define( __NAMESPACE__.'\\VERSION','220502' );
|
12 |
+
define( __NAMESPACE__.'\\DEVELOPMENT', false );
|
13 |
+
define( __NAMESPACE__.'\\SLUG', "subscribe-to-comments-reloaded" );
|
14 |
+
|
15 |
+
// load files
|
16 |
+
require_once dirname(__FILE__).'/utils/stcr_manage.php';
|
17 |
+
require_once dirname(__FILE__).'/classes/stcr_i18n.php';
|
18 |
+
require_once dirname(__FILE__).'/utils/functions.php';
|
19 |
+
|
20 |
+
// Main plugin class
|
21 |
+
if( ! class_exists('\\'.__NAMESPACE__.'\\wp_subscribe_reloaded') ) {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Main plugin class
|
25 |
+
*
|
26 |
+
* __construct ( Constructor )
|
27 |
+
* add_test_subscriptions ( Adds subscriptions for testing purposes )
|
28 |
+
* define_wp_hooks ( Define the WordPress Hooks that will be used by the plugin. )
|
29 |
+
* display_admin_header ( Display admin header menu )
|
30 |
+
* subscribe_reloaded_load_plugin_textdomain ( Load localization files )
|
31 |
+
* plugin_settings_link ( Add Settings link to plugin on plugins page )
|
32 |
+
* _get_comment_object ( Retrieves the comment information from the database )
|
33 |
+
* new_comment_posted ( Takes the appropriate action, when a new comment is posted )
|
34 |
+
* is_double_check_enabled ( Is double check ( subscriptions need to be confirmed ) enabled )
|
35 |
+
* comment_status_changed ( Actions when comments status changes ( approve/unapprove/spam/trash ) )
|
36 |
+
* comment_deleted ( Actions when comment is deleted )
|
37 |
+
* subscribe_post_author ( Subscribe the post author )
|
38 |
+
* subscribe_reloaded_manage ( Displays the appropriate management page )
|
39 |
+
* is_author ( Checks if current logged in user is the author )
|
40 |
+
* is_user_subscribed ( Checks if a given email address is subscribed to a post )
|
41 |
+
* add_subscription ( Adds a new subscription )
|
42 |
+
* delete_subscriptions ( Deletes one or more subscriptions from the database )
|
43 |
+
* retrieve_user_subscriptions ( Retries user subscriptions by post ID )
|
44 |
+
* update_subscription_status ( Updates the status of an existing subscription )
|
45 |
+
* update_subscription_email ( Updates the email address of an existing subscription )
|
46 |
+
* get_subscriptions ( Retrieves a list of emails subscribed to a specific post )
|
47 |
+
* notify_user ( Sends the notification message to a given user )
|
48 |
+
* subscribe_reloaded_show ( Displays the checkbox to allow visitors to subscribe )
|
49 |
+
* set_user_cookie ( Set a cookie if the user just subscribed without commenting )
|
50 |
+
* management_page_sc ( Management page shortcode )
|
51 |
+
* comment_content_prepend ( Add custom content before comment content )
|
52 |
+
*/
|
53 |
+
class wp_subscribe_reloaded extends stcr_manage {
|
54 |
+
|
55 |
+
public $stcr_i18n;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Constructor
|
59 |
+
*/
|
60 |
+
public function __construct() {
|
61 |
+
|
62 |
+
// run parent constructor.
|
63 |
+
parent::__construct();
|
64 |
+
|
65 |
+
$this->salt = defined( 'NONCE_KEY' ) ? NONCE_KEY : 'please create a unique key in your wp-config.php';
|
66 |
+
|
67 |
+
// show the checkbox - You can manually override this by adding the corresponding function in your template
|
68 |
+
if ( get_option( 'subscribe_reloaded_show_subscription_box' ) === 'yes' ) {
|
69 |
+
|
70 |
+
if ( get_option('subscribe_reloaded_stcr_position') == 'yes' ) {
|
71 |
+
add_action( 'comment_form', array($this, 'subscribe_reloaded_show'), 5, 0 );
|
72 |
+
} else {
|
73 |
+
add_filter( 'comment_form_submit_field', array($this, 'subscribe_reloaded_show'), 5, 1 );
|
74 |
+
}
|
75 |
+
|
76 |
+
// when users must be logged in to comment and current visitor is not logged in
|
77 |
+
add_action( 'comment_form_must_log_in_after', array($this, 'subscribe_reloaded_show'), 5, 0 );
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
$this->maybe_update();
|
82 |
+
|
83 |
+
// define WordPress hooks the plugin uses
|
84 |
+
$this->define_wp_hooks();
|
85 |
+
|
86 |
+
// localization
|
87 |
+
$this->stcr_i18n = new stcr_i18n();
|
88 |
+
|
89 |
+
// add subscriptions for tests
|
90 |
+
if ( DEVELOPMENT ) {
|
91 |
+
$this->add_test_subscriptions( 1000, 18,'Y', 'dev', 30);
|
92 |
+
}
|
93 |
+
|
94 |
+
// management page shortcode
|
95 |
+
add_shortcode( 'stcr_management_page', array( $this, 'management_page_sc' ) );
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Adds subscriptions for testing purposes
|
101 |
+
*
|
102 |
+
* @since 190705
|
103 |
+
*/
|
104 |
+
public function add_test_subscriptions( $iterations, $post_id, $status = 'Y', $email_prefix = 'dev', $last_id_subs = 0 ) {
|
105 |
+
for ( $i = $last_id_subs+1; $i <= $iterations; $i++) {
|
106 |
+
$this->add_subscription( $post_id, "{$email_prefix}_{$i}" . time() . "@dev.com", $status );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Define the WordPress Hooks that will be used by the plugin.
|
112 |
+
*
|
113 |
+
* @since 180302
|
114 |
+
*/
|
115 |
+
public function define_wp_hooks() {
|
116 |
+
|
117 |
+
// new comment posted
|
118 |
+
add_action( 'comment_post', array( $this, 'new_comment_posted' ), 12, 2 );
|
119 |
+
|
120 |
+
// add hook for the subscribe_reloaded_purge, define on the constructure so that the hook is read on time.
|
121 |
+
add_action('_cron_subscribe_reloaded_purge', array($this, 'subscribe_reloaded_purge'), 10 );
|
122 |
+
add_action('_cron_log_file_purge', array($this, 'log_file_purge'), 10 );
|
123 |
+
|
124 |
+
// load text domain
|
125 |
+
add_action( 'plugins_loaded', array( $this, 'subscribe_reloaded_load_plugin_textdomain' ) );
|
126 |
+
|
127 |
+
// front end
|
128 |
+
if ( ! is_admin() ) {
|
129 |
+
|
130 |
+
// management page permalink
|
131 |
+
$manager_page_permalink = get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
132 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
133 |
+
$manager_page_permalink = qtrans_convertURL( $manager_page_permalink );
|
134 |
+
}
|
135 |
+
|
136 |
+
// management page permalink fallback
|
137 |
+
if ( empty( $manager_page_permalink ) ) {
|
138 |
+
$manager_page_permalink = '/comment-subscriptions/';
|
139 |
+
}
|
140 |
+
|
141 |
+
// remove the ending slash so both variations (with and without slash) work in the strpos check below
|
142 |
+
$manager_page_permalink = rtrim( $manager_page_permalink, '/' );
|
143 |
+
|
144 |
+
// if we are on the management page, filter the_posts
|
145 |
+
if ( ( strpos( $_SERVER["REQUEST_URI"], $manager_page_permalink ) !== false ) ) {
|
146 |
+
|
147 |
+
$request_uri = $_SERVER['REQUEST_URI'];
|
148 |
+
$request_uri_arr = explode( $manager_page_permalink, $request_uri );
|
149 |
+
|
150 |
+
// don't show management page if a "child page"
|
151 |
+
if ( empty( $request_uri_arr[1] ) || $request_uri_arr[1] == '/' || strpos( $request_uri_arr[1], '/?' ) === 0 ) {
|
152 |
+
add_filter( 'the_posts', array( $this, 'subscribe_reloaded_manage' ), 10, 2 );
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
// filter to add custom output before comment content
|
158 |
+
add_filter( 'comment_text', array( $this, 'comment_content_prepend' ), 10, 2 );
|
159 |
+
|
160 |
+
// script to move the subscription form
|
161 |
+
add_action( 'wp_footer', array( $this, 'move_form_with_js' ), 20 );
|
162 |
+
|
163 |
+
// enqueue scripts
|
164 |
+
$this->utils->hook_plugin_scripts();
|
165 |
+
|
166 |
+
// wp admin
|
167 |
+
} else {
|
168 |
+
|
169 |
+
// hook for WPMU - new blog created
|
170 |
+
add_action( 'wpmu_new_blog', array( $this, 'new_blog' ), 10, 1 );
|
171 |
+
|
172 |
+
// remove subscriptions for post that is being deleted
|
173 |
+
add_action( 'delete_post', array( $this, 'delete_subscriptions' ), 10, 2 );
|
174 |
+
|
175 |
+
// remove subscriptions when a comment is deleted or status changed
|
176 |
+
add_action( 'deleted_comment', array( $this, 'comment_deleted' ) );
|
177 |
+
add_action( 'wp_set_comment_status', array( $this, 'comment_status_changed' ) );
|
178 |
+
|
179 |
+
// new columns in post/comment tables ( WP admin > Posts and WP admin > Comments )
|
180 |
+
add_filter( 'manage_edit-comments_columns', array( $this, 'add_column_header' ) );
|
181 |
+
add_filter( 'manage_posts_columns', array( $this, 'add_column_header' ) );
|
182 |
+
add_action( 'manage_comments_custom_column', array( $this, 'add_comment_column' ) );
|
183 |
+
add_action( 'manage_posts_custom_column', array( $this, 'add_post_column' ) );
|
184 |
+
|
185 |
+
// Add appropriate entries in the admin menu
|
186 |
+
add_action( 'admin_menu', array( $this, 'add_config_menu' ) );
|
187 |
+
add_action( 'admin_print_styles-edit-comments.php', array( $this, 'add_post_comments_stylesheet' ) );
|
188 |
+
add_action( 'admin_print_styles-edit.php', array( $this, 'add_post_comments_stylesheet' ) );
|
189 |
+
|
190 |
+
// admin header
|
191 |
+
add_action( 'in_admin_header', array( $this, 'display_admin_header' ), 100 );
|
192 |
+
|
193 |
+
// admin init
|
194 |
+
add_action( 'admin_init', array( $this, 'stcr_admin_init' ) );
|
195 |
+
|
196 |
+
// admin notices
|
197 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
198 |
+
|
199 |
+
// shortcodes to use the management URL sitewide
|
200 |
+
add_shortcode( 'subscribe-url', array( $this, 'subscribe_url_shortcode' ) );
|
201 |
+
|
202 |
+
// action links for listing on WP admin > Plugins
|
203 |
+
add_filter( 'plugin_action_links', array( $this, 'plugin_settings_link' ), 10, 2 );
|
204 |
+
|
205 |
+
// subscribe post authors, if auto subscribe for authors enabled
|
206 |
+
if ( get_option( 'subscribe_reloaded_notify_authors' ) === 'yes' ) {
|
207 |
+
add_action( 'publish_post', array( $this, 'subscribe_post_author' ) );
|
208 |
+
}
|
209 |
+
|
210 |
+
// enqueue scripts
|
211 |
+
$this->utils->hook_admin_scripts();
|
212 |
+
|
213 |
+
// ajax for admin notices ( mark as read )
|
214 |
+
$this->utils->stcr_create_ajax_notices();
|
215 |
+
|
216 |
+
// download system information file
|
217 |
+
add_action( 'admin_init', array( $this, 'sysinfo_download' ) );
|
218 |
+
|
219 |
+
// exclude subscriptions on post duplication
|
220 |
+
add_filter( 'duplicate_post_blacklist_filter', array( $this, 'duplicate_post_exclude_subs' ) );
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Display the admin header menu
|
228 |
+
*
|
229 |
+
* @since 190705 Cleanup
|
230 |
+
*/
|
231 |
+
public function display_admin_header () {
|
232 |
+
|
233 |
+
global $wp_locale;
|
234 |
+
|
235 |
+
$slug = 'stcr_manage_subscriptions';
|
236 |
+
$current_page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
237 |
+
|
238 |
+
// define the menu items
|
239 |
+
$array_pages = array(
|
240 |
+
'stcr_manage_subscriptions' => __( 'Manage subscriptions', 'subscribe-to-comments-reloaded' ),
|
241 |
+
'stcr_comment_form' => __( 'Comment Form', 'subscribe-to-comments-reloaded' ),
|
242 |
+
'stcr_management_page' => __( 'Management Page', 'subscribe-to-comments-reloaded' ),
|
243 |
+
'stcr_notifications' => __( 'Notifications', 'subscribe-to-comments-reloaded' ),
|
244 |
+
'stcr_options' => __( 'Options', 'subscribe-to-comments-reloaded' ),
|
245 |
+
'stcr_support' => __( 'Support', 'subscribe-to-comments-reloaded' ),
|
246 |
+
'stcr_system' => __( 'Options', 'subscribe-to-comments-reloaded' )
|
247 |
+
);
|
248 |
+
|
249 |
+
// do not proceed if not on a STCR admin page
|
250 |
+
if ( ! array_key_exists( $current_page, $array_pages) ) {
|
251 |
+
return;
|
252 |
+
}
|
253 |
+
|
254 |
+
?>
|
255 |
+
|
256 |
+
<nav class="navbar navbar-expand-lg navbar-light bg-light <?php echo $wp_locale->text_direction ?>">
|
257 |
+
|
258 |
+
<a class="navbar-brand"><img src="<?php echo plugins_url( '/images/stcr-logo-150.png', STCR_PLUGIN_FILE ); ?>" alt="" width="25" height="19"></a>
|
259 |
+
|
260 |
+
<div class="collapse navbar-collapse">
|
261 |
+
|
262 |
+
<ul class="navbar-nav">
|
263 |
+
|
264 |
+
<?php
|
265 |
+
|
266 |
+
// go through each stcr admin page
|
267 |
+
foreach ( $array_pages as $page => $page_desc ) :
|
268 |
+
|
269 |
+
// skip strc_system because it's added as part of stcr_options
|
270 |
+
if ( $page == 'stcr_system' ) continue;
|
271 |
+
|
272 |
+
?><li class="<?php echo $page == 'stcr_options' ? 'dropdown' : ''; ?>"><?php
|
273 |
+
|
274 |
+
// dropdrown for options menu item
|
275 |
+
if ( $page == 'stcr_options' ) :
|
276 |
+
|
277 |
+
?>
|
278 |
+
<a
|
279 |
+
class="nav-link dropdown-toggle <?php echo ( $current_page == $page || $current_page == 'stcr_system' ? ' stcr-active-tab' : '' ); ?>"
|
280 |
+
style="padding: 5px 12px 0 0;"
|
281 |
+
href="#"
|
282 |
+
id="navbarDropdown"
|
283 |
+
role="button"
|
284 |
+
data-toggle="dropdown"
|
285 |
+
aria-haspopup="true"
|
286 |
+
aria-expanded="false">
|
287 |
+
<?php echo $page_desc; ?>
|
288 |
+
</a>
|
289 |
+
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
290 |
+
<a class="dropdown-item" href="admin.php?page=<?php echo $page; ?>"><?php echo __('StCR Options', 'subscribe-to-comments-reloaded'); ?></a>
|
291 |
+
<div class="dropdown-divider"></div>
|
292 |
+
<a class="dropdown-item" href="admin.php?page=stcr_system"><?php echo __('StCR System', 'subscribe-to-comments-reloaded'); ?></a>
|
293 |
+
</div>
|
294 |
+
<?php
|
295 |
+
|
296 |
+
// regular menu items
|
297 |
+
else :
|
298 |
+
|
299 |
+
?>
|
300 |
+
<a
|
301 |
+
class="navbar-brand <?php echo ( $current_page == $page ) ? ' stcr-active-tab' : ''; ?>"
|
302 |
+
href="admin.php?page=<?php echo $page; ?>">
|
303 |
+
<?php echo $page_desc; ?>
|
304 |
+
</a>
|
305 |
+
<?php
|
306 |
+
|
307 |
+
endif;
|
308 |
+
|
309 |
+
?></li><?php
|
310 |
+
|
311 |
+
endforeach;
|
312 |
+
|
313 |
+
?>
|
314 |
+
|
315 |
+
</ul><!-- .navbar-nav -->
|
316 |
+
|
317 |
+
</div><!-- .navbar-collapse -->
|
318 |
+
|
319 |
+
</nav><!-- .navbar -->
|
320 |
+
<?php
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Load localization files
|
326 |
+
*
|
327 |
+
* @since 190705 cleanup
|
328 |
+
*/
|
329 |
+
function subscribe_reloaded_load_plugin_textdomain() {
|
330 |
+
|
331 |
+
load_plugin_textdomain( 'subscribe-to-comments-reloaded', FALSE, SLUG . '/langs/' );
|
332 |
+
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Add Settings link to plugin on plugins page
|
337 |
+
*
|
338 |
+
* @since 190705 cleanup
|
339 |
+
*/
|
340 |
+
public function plugin_settings_link( $links, $file ) {
|
341 |
+
|
342 |
+
if ( plugin_basename( STCR_PLUGIN_FILE ) == $file ) {
|
343 |
+
$links['settings'] = sprintf( '<a href="%s"> %s </a>', admin_url( 'admin.php?page=stcr_options' ), __( 'Settings', 'subscribe-to-comments-reloaded' ) );
|
344 |
+
}
|
345 |
+
|
346 |
+
return $links;
|
347 |
+
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Retrieves the comment information from the database
|
352 |
+
*
|
353 |
+
* @since 190705 cleanup
|
354 |
+
*/
|
355 |
+
public function _get_comment_object( $_comment_ID ) {
|
356 |
+
|
357 |
+
global $wpdb;
|
358 |
+
|
359 |
+
return $wpdb->get_row(
|
360 |
+
$wpdb->prepare(
|
361 |
+
"SELECT comment_post_ID, comment_author_email, comment_approved, comment_type, comment_parent
|
362 |
+
FROM $wpdb->comments
|
363 |
+
WHERE comment_ID = %d
|
364 |
+
LIMIT 1", $_comment_ID
|
365 |
+
), OBJECT
|
366 |
+
);
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Takes the appropriate action, when a new comment is posted
|
372 |
+
*
|
373 |
+
* @since 190705 cleanup
|
374 |
+
*/
|
375 |
+
public function new_comment_posted( $_comment_ID = 0, $_comment_status = 0 ) {
|
376 |
+
|
377 |
+
// get information about the comment
|
378 |
+
$info = $this->_get_comment_object( $_comment_ID );
|
379 |
+
|
380 |
+
// return if no info found or comment marked as spam
|
381 |
+
if ( empty( $info ) || $info->comment_approved == 'spam' ) {
|
382 |
+
return $_comment_ID;
|
383 |
+
}
|
384 |
+
|
385 |
+
// return if subscriptions disabled for this post
|
386 |
+
$is_disabled = get_post_meta( $info->comment_post_ID, 'stcr_disable_subscriptions', true );
|
387 |
+
if ( ! empty( $is_disabled ) ) {
|
388 |
+
return $_comment_ID;
|
389 |
+
}
|
390 |
+
|
391 |
+
// return if trackback/pingback ( if set not to notify on those )
|
392 |
+
if ( ( get_option( 'subscribe_reloaded_process_trackbacks', 'no' ) == 'no' ) && ( $info->comment_type == 'trackback' || $info->comment_type == 'pingback' ) ) {
|
393 |
+
return $_comment_ID;
|
394 |
+
}
|
395 |
+
|
396 |
+
// process the subscription
|
397 |
+
if ( ! empty( $_POST['subscribe-reloaded'] ) && ! empty( $info->comment_author_email ) ) {
|
398 |
+
|
399 |
+
// check if subscription type is valid
|
400 |
+
if ( in_array( $_POST['subscribe-reloaded'], array( 'replies', 'digest', 'yes' ) ) ) {
|
401 |
+
|
402 |
+
// get subscription type
|
403 |
+
switch ($_POST['subscribe-reloaded']) {
|
404 |
+
case 'replies':
|
405 |
+
$status = 'R';
|
406 |
+
break;
|
407 |
+
case 'digest':
|
408 |
+
$status = 'D';
|
409 |
+
break;
|
410 |
+
default:
|
411 |
+
$status = 'Y';
|
412 |
+
break;
|
413 |
+
}
|
414 |
+
|
415 |
+
// if not already subscribed
|
416 |
+
if ( ! $this->is_user_subscribed($info->comment_post_ID, $info->comment_author_email)) {
|
417 |
+
|
418 |
+
// if double check enabled, send confirmation email and append C to status
|
419 |
+
if ( $this->is_double_check_enabled($info) ) {
|
420 |
+
$this->sendConfirmationEMail($info);
|
421 |
+
$status = "{$status}C";
|
422 |
+
}
|
423 |
+
|
424 |
+
// add the subscription
|
425 |
+
$this->add_subscription($info->comment_post_ID, $info->comment_author_email, $status);
|
426 |
+
|
427 |
+
// return ( do not proceed with sending notifications ) if comment held for moderation
|
428 |
+
if ( $info->comment_approved == 0 ) {
|
429 |
+
return $_comment_ID;
|
430 |
+
}
|
431 |
+
|
432 |
+
}
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
}
|
437 |
+
|
438 |
+
// if comment approved, notify subscribed users about the comment
|
439 |
+
if ( $info->comment_approved == 1 ) {
|
440 |
+
|
441 |
+
// get all subscriptions
|
442 |
+
$subscriptions = $this->get_subscriptions(
|
443 |
+
array(
|
444 |
+
'post_id',
|
445 |
+
'status'
|
446 |
+
),
|
447 |
+
array(
|
448 |
+
'equals',
|
449 |
+
'equals'
|
450 |
+
),
|
451 |
+
array(
|
452 |
+
$info->comment_post_ID,
|
453 |
+
'Y'
|
454 |
+
)
|
455 |
+
);
|
456 |
+
|
457 |
+
// is this a reply to an existing comment?
|
458 |
+
if ( ! empty( $info->comment_parent ) ) {
|
459 |
+
|
460 |
+
// merge subscriptions
|
461 |
+
$subscriptions = array_merge(
|
462 |
+
$subscriptions,
|
463 |
+
$this->get_subscriptions(
|
464 |
+
'parent',
|
465 |
+
'equals',
|
466 |
+
array(
|
467 |
+
$info->comment_parent,
|
468 |
+
$info->comment_post_ID
|
469 |
+
)
|
470 |
+
)
|
471 |
+
);
|
472 |
+
|
473 |
+
}
|
474 |
+
|
475 |
+
// post author info
|
476 |
+
$post_author_id = get_post_field( 'post_author', $info->comment_post_ID );
|
477 |
+
$post_author_data = get_userdata( $post_author_id );
|
478 |
+
$post_author_email = $post_author_data->user_email;
|
479 |
+
$post_author_notified = false;
|
480 |
+
|
481 |
+
// notify subscribers
|
482 |
+
foreach ( $subscriptions as $a_subscription ) {
|
483 |
+
|
484 |
+
// skip comment author
|
485 |
+
if ( $a_subscription->email != $info->comment_author_email ) {
|
486 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $a_subscription->email );
|
487 |
+
// Do not proceed on sending the new comment email, if the email
|
488 |
+
// address is already in blacklist email list.
|
489 |
+
if ( false === $has_blacklist_email ) {
|
490 |
+
continue;
|
491 |
+
}
|
492 |
+
|
493 |
+
// notify the user
|
494 |
+
$this->notify_user( $info->comment_post_ID, $a_subscription->email, $_comment_ID );
|
495 |
+
|
496 |
+
// post author notified?
|
497 |
+
if ( $a_subscription->email == $post_author_email ) {
|
498 |
+
$post_author_notified = true;
|
499 |
+
}
|
500 |
+
|
501 |
+
}
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
// notify author
|
506 |
+
if ( ! $post_author_notified && get_option( 'subscribe_reloaded_notify_authors', 'no' ) == 'yes' ) {
|
507 |
+
|
508 |
+
// send email to author unless the author made the comment
|
509 |
+
if ( $info->comment_author_email != $post_author_email ) {
|
510 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $info->comment_author_email );
|
511 |
+
// Do not proceed on sending the new comment email, if the email
|
512 |
+
// address is already in blacklist email list.
|
513 |
+
if ( false === $has_blacklist_email ) {
|
514 |
+
return;
|
515 |
+
}
|
516 |
+
|
517 |
+
$this->notify_user( $info->comment_post_ID, $post_author_email, $_comment_ID );
|
518 |
+
}
|
519 |
+
|
520 |
+
}
|
521 |
+
|
522 |
+
}
|
523 |
+
|
524 |
+
// that's all, return
|
525 |
+
return $_comment_ID;
|
526 |
+
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Is double check ( subscriptions need to be confirmed ) enabled
|
531 |
+
*
|
532 |
+
* @since 190705
|
533 |
+
*/
|
534 |
+
public function is_double_check_enabled( $info ) {
|
535 |
+
|
536 |
+
$is_subscribe_to_post = false;
|
537 |
+
$is_user_logged_in = is_user_logged_in();
|
538 |
+
$is_option_enabled = false;
|
539 |
+
if ( get_option( 'subscribe_reloaded_enable_double_check', 'no' ) == 'yes' ) {
|
540 |
+
$is_option_enabled = true;
|
541 |
+
}
|
542 |
+
|
543 |
+
$approved_subscriptions = $this->get_subscriptions(
|
544 |
+
array(
|
545 |
+
'status',
|
546 |
+
'email'
|
547 |
+
),
|
548 |
+
array(
|
549 |
+
'equals',
|
550 |
+
'equals'
|
551 |
+
), array(
|
552 |
+
'Y',
|
553 |
+
$info->comment_author_email
|
554 |
+
)
|
555 |
+
);
|
556 |
+
|
557 |
+
// check if the user is already subscribed to the requested Post ID
|
558 |
+
foreach ( $approved_subscriptions as $subscription ) {
|
559 |
+
if ( $info->comment_post_ID == $subscription->post_id ) {
|
560 |
+
$is_subscribe_to_post = true;
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
// option enabled AND user not logged in AND not already subscribed
|
565 |
+
if ( $is_option_enabled && ! $is_user_logged_in && ( ! $is_subscribe_to_post || empty( $approved_subscriptions ) ) ) {
|
566 |
+
return true;
|
567 |
+
} else {
|
568 |
+
return false;
|
569 |
+
}
|
570 |
+
|
571 |
+
}
|
572 |
+
|
573 |
+
/**
|
574 |
+
* Actions when comments status changes ( approve/unapprove/spam/trash )
|
575 |
+
*
|
576 |
+
* @since 190705 cleanup
|
577 |
+
*/
|
578 |
+
public function comment_status_changed( $_comment_ID = 0, $_comment_status = 0 ) {
|
579 |
+
|
580 |
+
// get information about the comment
|
581 |
+
$info = $this->_get_comment_object( $_comment_ID );
|
582 |
+
|
583 |
+
// return, no information found
|
584 |
+
if ( empty( $info ) ) {
|
585 |
+
return $_comment_ID;
|
586 |
+
}
|
587 |
+
|
588 |
+
// go through the types of statuses
|
589 |
+
switch ( $info->comment_approved ) {
|
590 |
+
|
591 |
+
// unapproved
|
592 |
+
case '0':
|
593 |
+
|
594 |
+
$this->update_subscription_status( $info->comment_post_ID, $info->comment_author_email, 'C' );
|
595 |
+
break;
|
596 |
+
|
597 |
+
// approved
|
598 |
+
case '1':
|
599 |
+
|
600 |
+
$this->update_subscription_status( $info->comment_post_ID, $info->comment_author_email, '-C' );
|
601 |
+
|
602 |
+
// get subscriptions
|
603 |
+
$subscriptions = $this->get_subscriptions(
|
604 |
+
array(
|
605 |
+
'post_id',
|
606 |
+
'status'
|
607 |
+
), array(
|
608 |
+
'equals',
|
609 |
+
'equals'
|
610 |
+
), array(
|
611 |
+
$info->comment_post_ID,
|
612 |
+
'Y'
|
613 |
+
)
|
614 |
+
);
|
615 |
+
|
616 |
+
if ( ! empty( $info->comment_parent ) ) {
|
617 |
+
|
618 |
+
$subscriptions = array_merge(
|
619 |
+
$subscriptions, $this->get_subscriptions(
|
620 |
+
'parent',
|
621 |
+
'equals',
|
622 |
+
array(
|
623 |
+
$info->comment_parent,
|
624 |
+
$info->comment_post_ID
|
625 |
+
)
|
626 |
+
)
|
627 |
+
);
|
628 |
+
|
629 |
+
}
|
630 |
+
|
631 |
+
// go through subscriptions and notify subscribers
|
632 |
+
foreach ( $subscriptions as $a_subscription ) {
|
633 |
+
|
634 |
+
// skip the comment author
|
635 |
+
if ( $a_subscription->email != $info->comment_author_email ) {
|
636 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $a_subscription->email );
|
637 |
+
// Do not proceed on sending the new comment email, if the email
|
638 |
+
// address is already in blacklist email list.
|
639 |
+
if ( false === $has_blacklist_email ) {
|
640 |
+
continue;
|
641 |
+
}
|
642 |
+
|
643 |
+
$this->notify_user( $info->comment_post_ID, $a_subscription->email, $_comment_ID );
|
644 |
+
}
|
645 |
+
|
646 |
+
}
|
647 |
+
|
648 |
+
break;
|
649 |
+
|
650 |
+
case 'trash':
|
651 |
+
|
652 |
+
case 'spam':
|
653 |
+
|
654 |
+
// perform the same actions as if it were deleted
|
655 |
+
$this->comment_deleted( $_comment_ID );
|
656 |
+
break;
|
657 |
+
|
658 |
+
default:
|
659 |
+
break;
|
660 |
+
|
661 |
+
}
|
662 |
+
|
663 |
+
// return
|
664 |
+
return $_comment_ID;
|
665 |
+
|
666 |
+
}
|
667 |
+
|
668 |
+
/**
|
669 |
+
* Actions when comment is deleted
|
670 |
+
*
|
671 |
+
* @since 190705 cleanup
|
672 |
+
*/
|
673 |
+
public function comment_deleted( $_comment_ID ) {
|
674 |
+
|
675 |
+
global $wpdb;
|
676 |
+
|
677 |
+
// get information about the comments
|
678 |
+
$info = $this->_get_comment_object( $_comment_ID );
|
679 |
+
|
680 |
+
// return, no information found
|
681 |
+
if ( empty( $info ) ) {
|
682 |
+
return $_comment_ID;
|
683 |
+
}
|
684 |
+
|
685 |
+
// how many comments does the author have on this post
|
686 |
+
$count_approved_comments = $wpdb->get_var( $wpdb->prepare(
|
687 |
+
"SELECT COUNT(*)
|
688 |
+
FROM $wpdb->comments
|
689 |
+
WHERE comment_post_ID = %d
|
690 |
+
AND comment_author_email = %s
|
691 |
+
AND comment_approved = 1",
|
692 |
+
$info->comment_post_ID,
|
693 |
+
$info->comment_author_email
|
694 |
+
));
|
695 |
+
|
696 |
+
// if author has no comments left on this post, remove his subscription
|
697 |
+
if ( intval( $count_approved_comments ) == 0 ) {
|
698 |
+
$this->delete_subscriptions( $info->comment_post_ID, $info->comment_author_email );
|
699 |
+
}
|
700 |
+
|
701 |
+
// return
|
702 |
+
return $_comment_ID;
|
703 |
+
}
|
704 |
+
|
705 |
+
/**
|
706 |
+
* Subscribe the post author
|
707 |
+
*
|
708 |
+
* @since 190705 cleanup
|
709 |
+
*/
|
710 |
+
public function subscribe_post_author( $_post_ID ) {
|
711 |
+
|
712 |
+
$new_post = get_post( $_post_ID );
|
713 |
+
$author_email = get_the_author_meta( 'user_email', $new_post->post_author );
|
714 |
+
|
715 |
+
if ( ! empty( $author_email ) ) {
|
716 |
+
$this->add_subscription( $_post_ID, $author_email, 'Y' );
|
717 |
+
}
|
718 |
+
|
719 |
+
}
|
720 |
+
|
721 |
+
/**
|
722 |
+
* Displays the appropriate management page
|
723 |
+
*
|
724 |
+
* @since 190705 cleanup
|
725 |
+
*/
|
726 |
+
public function subscribe_reloaded_manage( $_posts = '', $_query = '' ) {
|
727 |
+
|
728 |
+
// vars
|
729 |
+
global $current_user;
|
730 |
+
$stcr_unique_key = get_option( 'subscribe_reloaded_unique_key' );
|
731 |
+
$date = date_i18n( 'Y-m-d H:i:s' );
|
732 |
+
$error_exits = false;
|
733 |
+
$email = '';
|
734 |
+
$virtual_page_enabled = get_option( 'subscribe_reloaded_manager_page_enabled', 'yes' );
|
735 |
+
|
736 |
+
// if something exists at this URL and virtual page disabled, abort mission
|
737 |
+
if ( ! empty( $_posts ) && $virtual_page_enabled == 'no' ) {
|
738 |
+
return $_posts;
|
739 |
+
}
|
740 |
+
|
741 |
+
// make sure we don't call the code below twice on non-virtual page
|
742 |
+
if ( $virtual_page_enabled == 'no' && ! in_the_loop() ) {
|
743 |
+
return;
|
744 |
+
}
|
745 |
+
|
746 |
+
try {
|
747 |
+
|
748 |
+
// get post ID
|
749 |
+
$post_ID = !empty($_POST['srp']) ? intval($_POST['srp']) : (!empty($_GET['srp']) ? intval($_GET['srp']) : 0);
|
750 |
+
|
751 |
+
// does a post with that ID exist
|
752 |
+
$target_post = get_post($post_ID);
|
753 |
+
if ( ( $post_ID > 0 ) && ! is_object($target_post) ) {
|
754 |
+
return $_posts;
|
755 |
+
}
|
756 |
+
|
757 |
+
// vars
|
758 |
+
$action = !empty($_POST['sra']) ? $_POST['sra'] : (!empty($_GET['sra']) ? $_GET['sra'] : 0);
|
759 |
+
$key = !empty($_POST['srk']) ? $_POST['srk'] : (!empty($_GET['srk']) ? $_GET['srk'] : 0);
|
760 |
+
|
761 |
+
$sre = !empty($_POST['sre']) ? $_POST['sre'] : (!empty($_GET['sre']) ? $_GET['sre'] : '');
|
762 |
+
if ( is_user_logged_in() ) {
|
763 |
+
$sre = $current_user->data->user_email;
|
764 |
+
}
|
765 |
+
|
766 |
+
$srek = !empty($_POST['srek']) ? $_POST['srek'] : (!empty($_GET['srek']) ? $_GET['srek'] : '');
|
767 |
+
$link_source = !empty($_POST['srsrc']) ? $_POST['srsrc'] : (!empty($_GET['srsrc']) ? $_GET['srsrc'] : '');
|
768 |
+
$key_expired = !empty($_POST['key_expired']) ? $_POST['key_expired'] : (!empty($_GET['key_expired']) ? $_GET['key_expired'] : '0');
|
769 |
+
|
770 |
+
// check if the current subscriber has valid email using the $srek key.
|
771 |
+
$email_by_key = $this->utils->get_subscriber_email_by_key($srek);
|
772 |
+
|
773 |
+
// stop if invalid SRE key
|
774 |
+
if ( ! $email_by_key && ! empty( $srek ) ) {
|
775 |
+
|
776 |
+
$this->utils->stcr_logger("\n [ERROR][$date] - Couldn\'t find an email with the SRE key: ( $srek )\n");
|
777 |
+
$email = '';
|
778 |
+
|
779 |
+
// valid key, proceed
|
780 |
+
} else {
|
781 |
+
|
782 |
+
if ( ! $email_by_key && empty( $sre ) ) {
|
783 |
+
$email = '';
|
784 |
+
} else if ( $email_by_key && ! empty( $email_by_key ) ) {
|
785 |
+
$email = $email_by_key;
|
786 |
+
} else if ( ! empty( $sre ) ) {
|
787 |
+
$email = $this->utils->check_valid_email( $sre );
|
788 |
+
} else {
|
789 |
+
$email = '';
|
790 |
+
}
|
791 |
+
|
792 |
+
}
|
793 |
+
|
794 |
+
// comes from the comment form.
|
795 |
+
if ($link_source == 'f') {
|
796 |
+
|
797 |
+
// Check for a valid SRK key, until this point we know the email is correct but the $key has expired/change
|
798 |
+
// or is wrong, in that case display the request management page template
|
799 |
+
if ($email !== "" && $key !== 0 && $stcr_unique_key !== $key || $key_expired == "1") {
|
800 |
+
if ($key_expired == "1") {
|
801 |
+
$error_exits = true;
|
802 |
+
} else {
|
803 |
+
$this->utils->stcr_logger("\n [ERROR][$date] - Couldn\'t find a valid SRK key with the email ( $email_by_key ) and the SRK key: ( $key )\n This is the current unique key: ( $stcr_unique_key )\n");
|
804 |
+
$error_exits = true;
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
// comes from email link
|
809 |
+
} else if ($link_source == 'e') {
|
810 |
+
|
811 |
+
if ($email !== "" && $key !== 0 && !$this->utils->_is_valid_key($key, $email) || $key_expired == "1") {
|
812 |
+
if ($key_expired == "1") {
|
813 |
+
$error_exits = true;
|
814 |
+
} else {
|
815 |
+
$this->utils->stcr_logger("\n [ERROR][$date] - Couldn\'t find a valid SRK key with the email ( $email_by_key ) and the SRK key: ( $key )\n This is the current unique key: ( $stcr_unique_key )\n");
|
816 |
+
$error_exits = true;
|
817 |
+
}
|
818 |
+
}
|
819 |
+
|
820 |
+
}
|
821 |
+
|
822 |
+
// error found, show message
|
823 |
+
if ($error_exits) {
|
824 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/key_expired.php';
|
825 |
+
|
826 |
+
// all fine, proceed
|
827 |
+
} else {
|
828 |
+
|
829 |
+
// subscribe without commenting
|
830 |
+
if (
|
831 |
+
!empty($action) &&
|
832 |
+
($action == 's') &&
|
833 |
+
($post_ID > 0) &&
|
834 |
+
$key_expired != "1"
|
835 |
+
) {
|
836 |
+
|
837 |
+
if ( get_option( 'subscribe_reloaded_allow_subscribe_without_comment', 'yes' ) == 'yes' ) {
|
838 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/subscribe.php';
|
839 |
+
} else {
|
840 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/not-allowed.php';
|
841 |
+
}
|
842 |
+
|
843 |
+
// post author
|
844 |
+
} elseif (
|
845 |
+
($post_ID > 0) &&
|
846 |
+
$this->is_author($target_post->post_author)
|
847 |
+
) {
|
848 |
+
|
849 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/author.php';
|
850 |
+
|
851 |
+
// confirm subscription
|
852 |
+
} elseif (
|
853 |
+
($post_ID > 0) &&
|
854 |
+
!empty($email) &&
|
855 |
+
!empty($key) &&
|
856 |
+
!empty($action) &&
|
857 |
+
$this->utils->_is_valid_key($key, $email) &&
|
858 |
+
$this->is_user_subscribed($post_ID, $email, 'C') &&
|
859 |
+
($action == 'c') &&
|
860 |
+
$key_expired != "1"
|
861 |
+
) {
|
862 |
+
|
863 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/confirm.php';
|
864 |
+
|
865 |
+
// unsubscribe
|
866 |
+
} elseif (
|
867 |
+
($post_ID > 0) &&
|
868 |
+
!empty($email) &&
|
869 |
+
!empty($key) &&
|
870 |
+
!empty($action) &&
|
871 |
+
$this->utils->_is_valid_key($key, $email) &&
|
872 |
+
($action == 'u') &&
|
873 |
+
$key_expired != "1"
|
874 |
+
) {
|
875 |
+
|
876 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/one-click-unsubscribe.php';
|
877 |
+
|
878 |
+
// user management page
|
879 |
+
} elseif (
|
880 |
+
!empty($email) &&
|
881 |
+
($key !== 0 && $this->utils->_is_valid_key($key, $email) || (!empty($current_user->data->user_email) && ($current_user->data->user_email === $email && current_user_can('read'))))
|
882 |
+
) {
|
883 |
+
|
884 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/user.php';
|
885 |
+
|
886 |
+
// wrong request
|
887 |
+
} elseif (
|
888 |
+
!empty($email) &&
|
889 |
+
($key === 0 && (!empty($current_user->data->user_email) && ($current_user->data->user_email !== $email)))
|
890 |
+
) {
|
891 |
+
|
892 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/wrong-request.php';
|
893 |
+
|
894 |
+
}
|
895 |
+
|
896 |
+
// request management link
|
897 |
+
if (empty($include_post_content)) {
|
898 |
+
|
899 |
+
if ( get_option( 'subscribe_reloaded_allow_request_management_link', 'yes' ) == 'yes' ) {
|
900 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/request-management-link.php';
|
901 |
+
} else {
|
902 |
+
$include_post_content = include trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'templates/not-allowed.php';
|
903 |
+
}
|
904 |
+
|
905 |
+
}
|
906 |
+
|
907 |
+
}
|
908 |
+
|
909 |
+
global $wp_query;
|
910 |
+
|
911 |
+
// management page title
|
912 |
+
$manager_page_title = html_entity_decode(get_option('subscribe_reloaded_manager_page_title', 'Manage subscriptions'), ENT_QUOTES, 'UTF-8');
|
913 |
+
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
|
914 |
+
$manager_page_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($manager_page_title);
|
915 |
+
} else {
|
916 |
+
$manager_page_title = $manager_page_title;
|
917 |
+
}
|
918 |
+
|
919 |
+
// fake posts
|
920 |
+
$posts[] =
|
921 |
+
(object)array(
|
922 |
+
'ID' => '-999',
|
923 |
+
'post_author' => '1',
|
924 |
+
'post_date' => current_time( 'mysql' ),
|
925 |
+
'post_date_gmt' => current_time( 'mysql', 1 ),
|
926 |
+
'post_content' => $include_post_content,
|
927 |
+
'post_title' => $manager_page_title,
|
928 |
+
'post_excerpt' => '',
|
929 |
+
'post_status' => 'publish',
|
930 |
+
'comment_status' => 'closed',
|
931 |
+
'ping_status' => 'closed',
|
932 |
+
'post_password' => '',
|
933 |
+
'to_ping' => '',
|
934 |
+
'pinged' => '',
|
935 |
+
'post_modified' => current_time( 'mysql' ),
|
936 |
+
'post_modified_gmt' => current_time( 'mysql', 1 ),
|
937 |
+
'post_content_filtered' => '',
|
938 |
+
'post_parent' => '0',
|
939 |
+
'menu_order' => '0',
|
940 |
+
'post_type' => 'page',
|
941 |
+
'post_mime_type' => '',
|
942 |
+
'post_category' => '0',
|
943 |
+
'comment_count' => '0',
|
944 |
+
'filter' => 'raw',
|
945 |
+
'guid' => get_bloginfo('url') . '/?page_id=-999',
|
946 |
+
'post_name' => get_bloginfo('url') . '/?page_id=-999',
|
947 |
+
'ancestors' => array()
|
948 |
+
);
|
949 |
+
|
950 |
+
// Make WP believe this is a real page, with no comments attached
|
951 |
+
$wp_query->is_page = true;
|
952 |
+
$wp_query->is_single = false;
|
953 |
+
$wp_query->is_home = false;
|
954 |
+
$wp_query->comments = false;
|
955 |
+
|
956 |
+
// Discard 404 errors thrown by other checks
|
957 |
+
unset($wp_query->query["error"]);
|
958 |
+
$wp_query->query_vars["error"] = "";
|
959 |
+
$wp_query->is_404 = false;
|
960 |
+
|
961 |
+
// Seems like WP adds its own HTML formatting code to the content, we don't need that here
|
962 |
+
remove_filter('the_content', 'wpautop');
|
963 |
+
|
964 |
+
// Look like the plugin is call twice and therefor subscribe to the "the_posts" filter again so we need to
|
965 |
+
// tell to WordPress to not register again.
|
966 |
+
// remove_filter("the_posts", array($this, "subscribe_reloaded_manage"));
|
967 |
+
add_action('wp_head', array($this, 'add_custom_header_meta'));
|
968 |
+
|
969 |
+
// log the error
|
970 |
+
} catch(\Exception $ex) {
|
971 |
+
|
972 |
+
$this->utils->stcr_logger( "\n [ERROR][$date] - $ex->getMessage()\n" );
|
973 |
+
$this->utils->stcr_logger( "\n [ERROR][$date] - $ex->getTraceAsString()\n" );
|
974 |
+
|
975 |
+
}
|
976 |
+
|
977 |
+
// return filtered posts
|
978 |
+
return $posts;
|
979 |
+
|
980 |
+
}
|
981 |
+
|
982 |
+
/**
|
983 |
+
* Checks if current logged in user is the author
|
984 |
+
*
|
985 |
+
* @since 190705 cleanup
|
986 |
+
*/
|
987 |
+
public function is_author( $_post_author ) {
|
988 |
+
|
989 |
+
global $current_user;
|
990 |
+
return ! empty( $current_user ) && ( ( $_post_author == $current_user->ID ) || current_user_can( 'manage_options' ) );
|
991 |
+
|
992 |
+
}
|
993 |
+
|
994 |
+
/**
|
995 |
+
* Checks if a given email address is subscribed to a post
|
996 |
+
*
|
997 |
+
* @since 190705 cleanup
|
998 |
+
*/
|
999 |
+
public function is_user_subscribed( $_post_ID = 0, $_email = '', $_status = '' ) {
|
1000 |
+
|
1001 |
+
global $current_user;
|
1002 |
+
|
1003 |
+
// return, no info about email available
|
1004 |
+
if ( ( empty( $current_user->user_email ) && empty( $_COOKIE['comment_author_email_' . COOKIEHASH] ) && empty( $_email ) ) || empty( $_post_ID ) ) {
|
1005 |
+
return false;
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
$operator = ( $_status != '' ) ? 'equals' : 'contains';
|
1009 |
+
|
1010 |
+
// get subscriptions
|
1011 |
+
$subscriptions = $this->get_subscriptions(
|
1012 |
+
array(
|
1013 |
+
'post_id',
|
1014 |
+
'status'
|
1015 |
+
),
|
1016 |
+
array(
|
1017 |
+
'equals',
|
1018 |
+
$operator
|
1019 |
+
), array(
|
1020 |
+
$_post_ID,
|
1021 |
+
$_status
|
1022 |
+
)
|
1023 |
+
);
|
1024 |
+
|
1025 |
+
// if email not supplied, tried to get it
|
1026 |
+
if ( empty( $_email ) ) {
|
1027 |
+
$user_email = ! empty( $current_user->user_email ) ? $current_user->user_email : ( ! empty( $_COOKIE['comment_author_email_' . COOKIEHASH] ) ? stripslashes( esc_attr( $_COOKIE['comment_author_email_' . COOKIEHASH] ) ) : '#undefined#' );
|
1028 |
+
|
1029 |
+
// if supplied, use it
|
1030 |
+
} else {
|
1031 |
+
$user_email = $_email;
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
// go through all subscriptions and return true if the email is found
|
1035 |
+
foreach ( $subscriptions as $a_subscription ) {
|
1036 |
+
if ( $user_email == $a_subscription->email ) {
|
1037 |
+
return true;
|
1038 |
+
}
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
// return false, the email is not subscribed
|
1042 |
+
return false;
|
1043 |
+
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
/**
|
1047 |
+
* Adds a new subscription
|
1048 |
+
*
|
1049 |
+
* @since 190705 cleanup
|
1050 |
+
*/
|
1051 |
+
public function add_subscription( $_post_id = 0, $_email = '', $_status = 'Y' ) {
|
1052 |
+
|
1053 |
+
$has_blacklist_email = $this->utils->blacklisted_emails( $_email );
|
1054 |
+
// Do not proceed on adding the email address in subscription table,
|
1055 |
+
// if the email address is already in blacklist email list.
|
1056 |
+
if ( false === $has_blacklist_email ) {
|
1057 |
+
return;
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
global $wpdb;
|
1061 |
+
|
1062 |
+
// does the post exist?
|
1063 |
+
$target_post = get_post( $_post_id );
|
1064 |
+
if ( ( $_post_id > 0 ) && ! is_object( $target_post ) ) {
|
1065 |
+
return;
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
// return if status incorrect
|
1069 |
+
if ( ! in_array( $_status, array( 'Y', 'YC', 'R', 'RC', 'C', '-C' ) ) || empty( $_status ) ) {
|
1070 |
+
return;
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
// using Wordpress local time
|
1074 |
+
$dt = date_i18n( 'Y-m-d H:i:s' );
|
1075 |
+
|
1076 |
+
// sanitize email
|
1077 |
+
$clean_email = $this->utils->clean_email( $_email );
|
1078 |
+
|
1079 |
+
// insert subscriber into postmeta
|
1080 |
+
$wpdb->query( $wpdb->prepare(
|
1081 |
+
"INSERT IGNORE INTO $wpdb->postmeta (post_id, meta_key, meta_value)
|
1082 |
+
SELECT %d, %s, %s
|
1083 |
+
FROM DUAL
|
1084 |
+
WHERE NOT EXISTS (
|
1085 |
+
SELECT post_id
|
1086 |
+
FROM $wpdb->postmeta
|
1087 |
+
WHERE post_id = %d
|
1088 |
+
AND meta_key = %s
|
1089 |
+
LIMIT 0,1
|
1090 |
+
)", $_post_id, "_stcr@_$clean_email", "$dt|$_status", $_post_id, "_stcr@_$clean_email"
|
1091 |
+
));
|
1092 |
+
|
1093 |
+
// Insert user into subscribe_reloaded_subscribers table
|
1094 |
+
// TODO: Only on this section the user should be added to the subscribers table. On the send confirmation email is repeating this method.
|
1095 |
+
$OK = $this->utils->add_user_subscriber_table( $clean_email );
|
1096 |
+
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
/**
|
1100 |
+
* Deletes one or more subscriptions from the database
|
1101 |
+
*
|
1102 |
+
* @since 190705 cleanup
|
1103 |
+
*/
|
1104 |
+
public function delete_subscriptions( $_post_id = 0, $_email = '' ) {
|
1105 |
+
|
1106 |
+
// related to wp 5.5 delete_post coming with 2nd parameter of WP Post object
|
1107 |
+
if ( is_object( $_email ) ) {
|
1108 |
+
$_email = '';
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
global $wpdb;
|
1112 |
+
|
1113 |
+
$has_subscriptions = false;
|
1114 |
+
|
1115 |
+
// no post ID supplied, return 0
|
1116 |
+
if ( empty( $_post_id ) ) {
|
1117 |
+
return 0;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
// generate search for the DB query
|
1121 |
+
$posts_where = '';
|
1122 |
+
if ( ! is_array( $_post_id ) ) {
|
1123 |
+
$posts_where = $wpdb->prepare( "post_id = %d", intval( $_post_id ) );
|
1124 |
+
} else {
|
1125 |
+
foreach ( $_post_id as $a_post_id ) {
|
1126 |
+
$posts_where .= $wpdb->prepare( "post_id = %d OR ", intval( $a_post_id ) );
|
1127 |
+
}
|
1128 |
+
$posts_where = substr( $posts_where, 0, - 4 );
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
// if email supplied, add it to the search for the DB query
|
1132 |
+
if ( ! empty( $_email ) ) {
|
1133 |
+
$emails_where = '';
|
1134 |
+
if ( ! is_array( $_email ) ) {
|
1135 |
+
$emails_where = $wpdb->prepare( "meta_key = %s", '_stcr@_' . $this->utils->clean_email( $_email ) );
|
1136 |
+
$has_subscriptions = $this->retrieve_user_subscriptions( $_post_id, $_email );
|
1137 |
+
if ( $has_subscriptions === false) {
|
1138 |
+
$this->utils->remove_user_subscriber_table( $_email );
|
1139 |
+
}
|
1140 |
+
} else {
|
1141 |
+
foreach ( $_email as $a_email ) {
|
1142 |
+
$emails_where .= $wpdb->prepare( "meta_key = %s OR ", '_stcr@_' . $this->utils->clean_email( $a_email ) );
|
1143 |
+
// Deletion on every email on the subscribers table.
|
1144 |
+
$has_subscriptions = $this->retrieve_user_subscriptions( $_post_id, $a_email );
|
1145 |
+
if ( $has_subscriptions === false ) {
|
1146 |
+
$this->utils->remove_user_subscriber_table( $a_email );
|
1147 |
+
}
|
1148 |
+
}
|
1149 |
+
|
1150 |
+
$emails_where = substr( $emails_where, 0, - 4 );
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
// remove subscription from DB
|
1154 |
+
return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE ($posts_where) AND ($emails_where)" );
|
1155 |
+
|
1156 |
+
} else {
|
1157 |
+
|
1158 |
+
// remove all subscriptions for specific post from DB
|
1159 |
+
return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE '\_stcr@\_%' AND ($posts_where)" );
|
1160 |
+
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
/**
|
1166 |
+
* The function must search for subscription by a given post id.
|
1167 |
+
*
|
1168 |
+
* @param $_post_id The post ID to search
|
1169 |
+
* @param $_email The user email, use to search the subscriptions.
|
1170 |
+
* @param bool $in If set to true the search will return the subscription information, if false then it
|
1171 |
+
* should retrieve all the subscriptions but not the given.
|
1172 |
+
*
|
1173 |
+
* @return bool|object If $in is true then it could return the subscription or false, false means not found,
|
1174 |
+
* if $in is false the it could return the subscriptions or false, false means not found
|
1175 |
+
*/
|
1176 |
+
public function retrieve_user_subscriptions( $_post_id, $_email, $in = false ) {
|
1177 |
+
|
1178 |
+
global $wpdb;
|
1179 |
+
|
1180 |
+
$meta_key = '_stcr@_';
|
1181 |
+
$in_values = '';
|
1182 |
+
|
1183 |
+
// single post
|
1184 |
+
if( ! is_array( $_post_id ) ){
|
1185 |
+
|
1186 |
+
if ( ! $in ) {
|
1187 |
+
$retrieve_subscriptions = "SELECT * FROM $wpdb->postmeta WHERE post_id <> %d AND meta_key = %s";
|
1188 |
+
} else if ( $in ) {
|
1189 |
+
$retrieve_subscriptions = "SELECT * FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s";
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
$result = $wpdb->get_results( $wpdb->prepare( $retrieve_subscriptions, $_post_id, $meta_key.$_email ), OBJECT );
|
1193 |
+
|
1194 |
+
// array of posts
|
1195 |
+
} else {
|
1196 |
+
|
1197 |
+
$in_values = implode( ',', $_post_id );
|
1198 |
+
|
1199 |
+
if ( ! $in ) {
|
1200 |
+
$retrieve_subscriptions = "SELECT * FROM $wpdb->postmeta WHERE post_id NOT IN ($in_values) AND meta_key = %s";
|
1201 |
+
} else if ( $in ) {
|
1202 |
+
$retrieve_subscriptions = "SELECT * FROM $wpdb->postmeta WHERE post_id IN ($in_values) AND meta_key = %s";
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
$result = $wpdb->get_results($wpdb->prepare( $retrieve_subscriptions, $meta_key.$_email ), OBJECT);
|
1206 |
+
|
1207 |
+
}
|
1208 |
+
|
1209 |
+
return $result === false || $result == 0 || empty( $result ) ? false : $result;
|
1210 |
+
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
/**
|
1214 |
+
* Updates the status of an existing subscription
|
1215 |
+
*
|
1216 |
+
* @since 190705 cleanup
|
1217 |
+
*/
|
1218 |
+
public function update_subscription_status( $_post_id = 0, $_email = '', $_new_status = 'C' ) {
|
1219 |
+
|
1220 |
+
global $wpdb;
|
1221 |
+
|
1222 |
+
// if not a valid status, return
|
1223 |
+
if ( empty( $_new_status ) || ! in_array( $_new_status, array( 'Y', 'R', 'C', '-C' ) ) || empty( $_email ) ) {
|
1224 |
+
return 0;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
// specific post ID supplied
|
1228 |
+
if ( ! empty( $_post_id ) ) {
|
1229 |
+
|
1230 |
+
// generate the WHERE for post ID for the DB query
|
1231 |
+
$posts_where = '';
|
1232 |
+
if ( ! is_array( $_post_id ) ) {
|
1233 |
+
$posts_where = $wpdb->prepare( "post_id = %d", intval( $_post_id ) );
|
1234 |
+
} else {
|
1235 |
+
foreach ( $_post_id as $a_post_id ) {
|
1236 |
+
$posts_where .= $wpdb->prepare( "post_id = %d OR ", intval( $a_post_id ) );
|
1237 |
+
}
|
1238 |
+
$posts_where = substr( $posts_where, 0, - 4 );
|
1239 |
+
}
|
1240 |
+
|
1241 |
+
// all posts
|
1242 |
+
} else {
|
1243 |
+
$posts_where = '1=1';
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
// generate WHERE for email for the DB query
|
1247 |
+
$emails_where = '';
|
1248 |
+
if ( ! is_array( $_email ) ) {
|
1249 |
+
$emails_where = $wpdb->prepare( "meta_key = %s", '_stcr@_' . $this->utils->clean_email( $_email ) );
|
1250 |
+
} else {
|
1251 |
+
foreach ( $_email as $a_email ) {
|
1252 |
+
$emails_where .= $wpdb->prepare( "meta_key = %s OR ", '_stcr@_' . $this->utils->clean_email( $a_email ) );
|
1253 |
+
}
|
1254 |
+
$emails_where = substr( $emails_where, 0, - 4 );
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
$meta_length = ( strpos( $_new_status, 'C' ) !== false ) ? 21 : 20;
|
1258 |
+
$new_status = ( $_new_status == '-C' ) ? '' : $_new_status;
|
1259 |
+
|
1260 |
+
// update DB
|
1261 |
+
return $wpdb->query(
|
1262 |
+
"UPDATE $wpdb->postmeta
|
1263 |
+
SET meta_value = CONCAT(SUBSTRING(meta_value, 1, $meta_length), '$new_status')
|
1264 |
+
WHERE ($posts_where) AND ($emails_where)"
|
1265 |
+
);
|
1266 |
+
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
/**
|
1270 |
+
* Updates the email address of an existing subscription
|
1271 |
+
*
|
1272 |
+
* @since 190705 cleanup
|
1273 |
+
*/
|
1274 |
+
public function update_subscription_email( $_post_id = 0, $_email = '', $_new_email = '' ) {
|
1275 |
+
|
1276 |
+
global $wpdb;
|
1277 |
+
|
1278 |
+
// return if no email supplied
|
1279 |
+
if ( empty( $_email ) || empty( $_new_email ) || strpos( $_new_email, '@' ) == 0 ) {
|
1280 |
+
return;
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
// sanitize old and new email
|
1284 |
+
$clean_values[] = "_stcr@_" . $this->utils->clean_email( $_new_email );
|
1285 |
+
$clean_values[] = "_stcr@_" . $this->utils->clean_email( $_email );
|
1286 |
+
|
1287 |
+
// generate WHERE for DB query
|
1288 |
+
$post_where = '';
|
1289 |
+
if ( ! empty( $_post_id ) ) {
|
1290 |
+
$post_where = ' AND post_id = %d';
|
1291 |
+
$clean_values[] = $_post_id;
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
// update the email in postmeta table
|
1295 |
+
$rowsAffected = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_key = %s WHERE meta_key = %s $post_where", $clean_values ) );
|
1296 |
+
|
1297 |
+
// update the email in subscribe_reloaded_subscribers table
|
1298 |
+
if ( $rowsAffected > 0 || $rowsAffected !== false) {
|
1299 |
+
$salt = time();
|
1300 |
+
$rowsAffected = $wpdb->query(
|
1301 |
+
$wpdb->prepare("UPDATE ". $wpdb->prefix .
|
1302 |
+
"subscribe_reloaded_subscribers SET subscriber_email = %s,
|
1303 |
+
salt = %d,
|
1304 |
+
subscriber_unique_id = %s
|
1305 |
+
WHERE subscriber_email = %s",
|
1306 |
+
$_new_email, $salt, $this->utils->generate_temp_key( $salt . $_new_email ),$_email )
|
1307 |
+
);
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
return false;
|
1311 |
+
|
1312 |
+
}
|
1313 |
+
|
1314 |
+
/**
|
1315 |
+
* Retrieves a list of emails subscribed to a specific post
|
1316 |
+
*
|
1317 |
+
* @since 190705 cleanup
|
1318 |
+
*/
|
1319 |
+
public function get_subscriptions( $_search_field = array( 'email' ), $_operator = array( 'equals' ), $_search_value = array( '' ), $_order_by = 'dt', $_order = 'ASC', $_offset = 0, $_limit_results = 0 ) {
|
1320 |
+
|
1321 |
+
global $wpdb;
|
1322 |
+
|
1323 |
+
// Type adjustments
|
1324 |
+
$search_fields = ( ! is_array( $_search_field ) ) ? array( $_search_field ) : $_search_field;
|
1325 |
+
$operators = ( ! is_array( $_operator ) ) ? array( $_operator ) : $_operator;
|
1326 |
+
$search_values = ( ! is_array( $_search_value ) ) ? array( $_search_value ) : $_search_value;
|
1327 |
+
|
1328 |
+
// Find if exists a 'replies only' subscription for the parent comment
|
1329 |
+
if ( $search_fields[0] == 'parent' ) {
|
1330 |
+
|
1331 |
+
$parent_comment_id = $search_values[0];
|
1332 |
+
$comment_post_id = $search_values[1];
|
1333 |
+
|
1334 |
+
// Get the parent comment author email so we can search for any Replies Only subscriptions
|
1335 |
+
$parent_comment_author_email = "\_stcr@\_" . get_comment_author_email( $parent_comment_id );
|
1336 |
+
|
1337 |
+
// Check if $parent_comment_author_email has any Replies Only (R) subscriptions for $comment_post_id
|
1338 |
+
|
1339 |
+
/*
|
1340 |
+
Heads up: this will return Replies Only subscriptions for a given post, *not* for a given comment.
|
1341 |
+
This plugin does not track subscriptions for specific comments but rather for entire posts, so there
|
1342 |
+
is no way to figure out if a specific parent comment has a subscription (of any type). To make the
|
1343 |
+
Replies Only feature half-work, we check if a parent comment author has *any* Replies Only subscriptions
|
1344 |
+
for a given post. If they do, we assume that they must want to get notified of replies to *any* of their
|
1345 |
+
comments on *that* post.
|
1346 |
+
*/
|
1347 |
+
|
1348 |
+
return $wpdb->get_results(
|
1349 |
+
$wpdb->prepare(
|
1350 |
+
"SELECT pm.meta_id, REPLACE(pm.meta_key, '_stcr@_', '') AS email, pm.post_id, SUBSTRING(pm.meta_value, 1, 19) AS dt, SUBSTRING(pm.meta_value, 21) AS status, srs.subscriber_unique_id AS email_key
|
1351 |
+
FROM $wpdb->postmeta pm
|
1352 |
+
INNER JOIN {$wpdb->prefix}subscribe_reloaded_subscribers srs ON ( REPLACE(pm.meta_key, '_stcr@_', '') = srs.subscriber_email )
|
1353 |
+
WHERE pm.meta_key LIKE %s
|
1354 |
+
AND pm.meta_value LIKE '%%R'
|
1355 |
+
AND pm.post_id = %d", $parent_comment_author_email, $comment_post_id
|
1356 |
+
), OBJECT
|
1357 |
+
);
|
1358 |
+
|
1359 |
+
} else {
|
1360 |
+
|
1361 |
+
// generate WHERE for the DB query
|
1362 |
+
$where_clause = '';
|
1363 |
+
foreach ( $search_fields as $a_idx => $a_field ) {
|
1364 |
+
$where_clause .= ' AND';
|
1365 |
+
$offset_status = ( $a_field == 'status' && $search_values[$a_idx] == 'C' ) ? 22 : 21;
|
1366 |
+
switch ( $a_field ) {
|
1367 |
+
case 'status':
|
1368 |
+
$where_clause .= " SUBSTRING(meta_value, $offset_status)";
|
1369 |
+
break;
|
1370 |
+
case 'post_id':
|
1371 |
+
$where_clause .= ' post_id';
|
1372 |
+
break;
|
1373 |
+
default:
|
1374 |
+
$where_clause .= ' SUBSTRING(meta_key, 8)';
|
1375 |
+
}
|
1376 |
+
switch ( $operators[$a_idx] ) {
|
1377 |
+
case 'equals':
|
1378 |
+
$where_clause .= " = %s";
|
1379 |
+
$where_values[] = $search_values[$a_idx];
|
1380 |
+
break;
|
1381 |
+
case 'does not contain':
|
1382 |
+
$where_clause .= " NOT LIKE %s";
|
1383 |
+
$where_values[] = "%{$search_values[$a_idx]}%";
|
1384 |
+
break;
|
1385 |
+
case 'starts with':
|
1386 |
+
$where_clause .= " LIKE %s";
|
1387 |
+
$where_values[] = "{$search_values[$a_idx]}%";
|
1388 |
+
break;
|
1389 |
+
case 'ends with':
|
1390 |
+
$where_clause .= " LIKE %s";
|
1391 |
+
$where_values[] = "%{$search_values[$a_idx]}";
|
1392 |
+
break;
|
1393 |
+
default: // contains
|
1394 |
+
$where_clause .= " LIKE %s";
|
1395 |
+
$where_values[] = "%{$search_values[$a_idx]}%";
|
1396 |
+
}
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
// generated ORDER BY for the DB query
|
1400 |
+
switch ( $_order_by ) {
|
1401 |
+
case 'status':
|
1402 |
+
$order_by = "status";
|
1403 |
+
break;
|
1404 |
+
case 'email':
|
1405 |
+
$order_by = 'meta_key';
|
1406 |
+
break;
|
1407 |
+
case 'dt':
|
1408 |
+
$order_by = 'dt';
|
1409 |
+
break;
|
1410 |
+
default:
|
1411 |
+
$order_by = 'post_id';
|
1412 |
+
}
|
1413 |
+
$order = ( $_order != 'ASC' && $_order != 'DESC' ) ? 'DESC' : $_order;
|
1414 |
+
|
1415 |
+
// this is the 'official' way to have an offset without a limit
|
1416 |
+
$row_count = ( $_limit_results <= 0 ) ? '18446744073709551610' : $_limit_results;
|
1417 |
+
|
1418 |
+
// run the DB query
|
1419 |
+
return $wpdb->get_results(
|
1420 |
+
$wpdb->prepare(
|
1421 |
+
"SELECT meta_id, REPLACE(meta_key, '_stcr@_', '') AS email, post_id, SUBSTRING(meta_value, 1, 19) AS dt, SUBSTRING(meta_value, 21) AS status, srs.subscriber_unique_id AS email_key
|
1422 |
+
FROM $wpdb->postmeta
|
1423 |
+
INNER JOIN {$wpdb->prefix}subscribe_reloaded_subscribers srs ON ( REPLACE(meta_key, '_stcr@_', '') = srs.subscriber_email )
|
1424 |
+
WHERE meta_key LIKE '\_stcr@\_%%' $where_clause
|
1425 |
+
ORDER BY $order_by $order
|
1426 |
+
LIMIT $_offset,$row_count", $where_values
|
1427 |
+
), OBJECT
|
1428 |
+
);
|
1429 |
+
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
/**
|
1435 |
+
* Sends the notification message to a given user
|
1436 |
+
*
|
1437 |
+
* @since 190705 cleanup
|
1438 |
+
*/
|
1439 |
+
public function notify_user( $_post_ID = 0, $_email = '', $_comment_ID = 0 ) {
|
1440 |
+
|
1441 |
+
// vars
|
1442 |
+
$post = get_post( $_post_ID );
|
1443 |
+
$comment = get_comment( $_comment_ID );
|
1444 |
+
$post_permalink = get_permalink( $_post_ID );
|
1445 |
+
$comment_permalink = get_comment_link( $_comment_ID );
|
1446 |
+
$comment_reply_permalink = get_permalink( $_post_ID ) . '?replytocom=' . $_comment_ID . '#respond';
|
1447 |
+
$info = $this->_get_comment_object( $_comment_ID );
|
1448 |
+
|
1449 |
+
// WPML compatibility
|
1450 |
+
if ( defined('ICL_SITEPRESS_VERSION') && defined('ICL_LANGUAGE_CODE') ) {
|
1451 |
+
global $sitepress;
|
1452 |
+
$language = $sitepress->get_language_for_element( $_post_ID, 'post_' . $post->post_type );
|
1453 |
+
$sitepress->switch_lang($language);
|
1454 |
+
}
|
1455 |
+
|
1456 |
+
// vars
|
1457 |
+
$subject = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_notification_subject', 'There is a new comment on the post [post_title]' ) ), ENT_QUOTES, 'UTF-8' );
|
1458 |
+
$message = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_notification_content', '' ) ), ENT_QUOTES, 'UTF-8' );
|
1459 |
+
$manager_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' );
|
1460 |
+
$one_click_unsubscribe_link = $manager_link;
|
1461 |
+
|
1462 |
+
// qTranslate compatibility
|
1463 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
1464 |
+
$manager_link = qtrans_convertURL( $manager_link );
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
// vars
|
1468 |
+
$clean_email = $this->utils->clean_email( $_email );
|
1469 |
+
$subscriber_salt = $this->utils->generate_temp_key( $clean_email );
|
1470 |
+
$manager_link .= ( ( strpos( $manager_link, '?' ) !== false ) ? '&' : '?' )
|
1471 |
+
. "srek=" . $this->utils->get_subscriber_key( $clean_email )
|
1472 |
+
. "&srk=$subscriber_salt";
|
1473 |
+
$one_click_unsubscribe_link .= ( ( strpos( $one_click_unsubscribe_link, '?' ) !== false ) ? '&' : '?' )
|
1474 |
+
. "srek=" . $this->utils->get_subscriber_key( $clean_email ) . "&srk=$subscriber_salt"
|
1475 |
+
. "&sra=u&srsrc=e" . "&srp=" . $_post_ID;
|
1476 |
+
$comment_content = $comment->comment_content;
|
1477 |
+
|
1478 |
+
// replace tags with their actual values
|
1479 |
+
$subject = str_replace( '[post_title]', $post->post_title, $subject );
|
1480 |
+
$subject = str_replace( '[comment_author]', $comment->comment_author, $subject );
|
1481 |
+
$subject = str_replace( '[blog_name]' , get_bloginfo('name'), $subject );
|
1482 |
+
$message = str_replace( '[post_permalink]', $post_permalink, $message );
|
1483 |
+
$message = str_replace( '[comment_permalink]', $comment_permalink, $message );
|
1484 |
+
$message = str_replace( '[comment_reply_permalink]', $comment_reply_permalink, $message );
|
1485 |
+
$message = str_replace( '[comment_author]', $comment->comment_author, $message );
|
1486 |
+
$message = str_replace( '[comment_content]', $comment_content, $message );
|
1487 |
+
$message = str_replace( '[manager_link]', $manager_link, $message );
|
1488 |
+
$message = str_replace( '[oneclick_link]', $one_click_unsubscribe_link, $message );
|
1489 |
+
$message = str_replace( '[comment_gravatar]', get_avatar($info->comment_author_email, 40), $message );
|
1490 |
+
$message = str_replace( '[comment_date]', date( get_option( 'date_format'), strtotime( $comment->comment_date ) ), $message );
|
1491 |
+
$message = str_replace( '[comment_time]', date( get_option( 'time_format'), strtotime( $comment->comment_date ) ), $message );
|
1492 |
+
|
1493 |
+
// qTranslate support
|
1494 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
1495 |
+
$subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $subject );
|
1496 |
+
$message = str_replace( '[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $post->post_title ), $message );
|
1497 |
+
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $message );
|
1498 |
+
} else {
|
1499 |
+
$message = str_replace( '[post_title]', $post->post_title, $message );
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
$message = apply_filters( 'stcr_notify_user_message', $message, $_post_ID, $clean_email, $_comment_ID );
|
1503 |
+
|
1504 |
+
// email settings
|
1505 |
+
$email_settings = array(
|
1506 |
+
'subject' => $subject,
|
1507 |
+
'message' => $message,
|
1508 |
+
'toEmail' => $clean_email,
|
1509 |
+
'XPostId' => $_post_ID,
|
1510 |
+
'XCommentId' => $_comment_ID
|
1511 |
+
);
|
1512 |
+
|
1513 |
+
// send email
|
1514 |
+
$this->utils->send_email( $email_settings );
|
1515 |
+
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
/**
|
1519 |
+
* Displays the checkbox to allow visitors to subscribe
|
1520 |
+
*
|
1521 |
+
* @since 190705 cleanup
|
1522 |
+
*/
|
1523 |
+
function subscribe_reloaded_show( $submit_field = '' ) {
|
1524 |
+
|
1525 |
+
// echo on action, return on filter
|
1526 |
+
$echo = false;
|
1527 |
+
if ( doing_action( 'comment_form' ) || doing_action( 'comment_form_must_log_in_after' ) ) {
|
1528 |
+
$echo = true;
|
1529 |
+
}
|
1530 |
+
|
1531 |
+
// vars
|
1532 |
+
global $post, $wp_subscribe_reloaded;
|
1533 |
+
$checkbox_subscription_type = null;
|
1534 |
+
$_comment_ID = null;
|
1535 |
+
$post_permalink = get_permalink( $post->ID );
|
1536 |
+
$post_permalink = "post_permalink=" . $post_permalink;
|
1537 |
+
$post_type = get_post_type( $post->ID );
|
1538 |
+
$only_for_logged_in = get_option( 'subscribe_reloaded_only_for_logged_in', 'no' );
|
1539 |
+
$supported_post_types = get_option( 'subscribe_reloaded_post_type_supports' );
|
1540 |
+
if ( in_array( 'stcr_none', $supported_post_types, true ) ) {
|
1541 |
+
$supported_post_types = array_flip( $supported_post_types );
|
1542 |
+
unset( $supported_post_types['stcr_none'] );
|
1543 |
+
}
|
1544 |
+
$supported_post_types = array_flip( $supported_post_types );
|
1545 |
+
|
1546 |
+
// if not enabled for this post type, return default
|
1547 |
+
if ( ! in_array( $post_type, $supported_post_types, true ) ) {
|
1548 |
+
if ( $echo ) {
|
1549 |
+
echo $submit_field;
|
1550 |
+
} else {
|
1551 |
+
return $submit_field;
|
1552 |
+
}
|
1553 |
+
return;
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
// only for logged in users
|
1557 |
+
if ( $only_for_logged_in == 'yes' && ! is_user_logged_in() ) {
|
1558 |
+
if ( $echo ) {
|
1559 |
+
echo $submit_field;
|
1560 |
+
} else {
|
1561 |
+
return $submit_field;
|
1562 |
+
}
|
1563 |
+
return;
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
// enqueue scripts and styles
|
1567 |
+
$wp_subscribe_reloaded->stcr->utils->add_plugin_js_scripts();
|
1568 |
+
wp_enqueue_style( 'stcr-plugin-style' );
|
1569 |
+
|
1570 |
+
// return if subscriptions disabled for this post
|
1571 |
+
$is_disabled = get_post_meta( $post->ID, 'stcr_disable_subscriptions', true );
|
1572 |
+
if ( ! empty( $is_disabled ) ) {
|
1573 |
+
if ( $echo ) {
|
1574 |
+
echo $submit_field;
|
1575 |
+
} else {
|
1576 |
+
return $submit_field;
|
1577 |
+
}
|
1578 |
+
return;
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
// vars
|
1582 |
+
$show_subscription_box = true;
|
1583 |
+
$html_to_show = '';
|
1584 |
+
$user_link = get_bloginfo( 'url' ) . get_option( 'subscribe_reloaded_manager_page', '' );
|
1585 |
+
|
1586 |
+
// qTranslate compatibility
|
1587 |
+
if ( function_exists( 'qtrans_convertURL' ) ) {
|
1588 |
+
$user_link = qtrans_convertURL( $user_link );
|
1589 |
+
}
|
1590 |
+
|
1591 |
+
// link for management page
|
1592 |
+
$manager_link = ( strpos( $user_link, '?' ) !== false ) ?
|
1593 |
+
"$user_link&srp=$post->ID&srk=" . get_option( 'subscribe_reloaded_unique_key' ) :
|
1594 |
+
"$user_link?srp=$post->ID&srk=" . get_option( 'subscribe_reloaded_unique_key' );
|
1595 |
+
|
1596 |
+
// link for user
|
1597 |
+
$user_link = ( strpos( $user_link, '?' ) !== false ) ?
|
1598 |
+
"$user_link&" . $post_permalink :
|
1599 |
+
"$user_link?" . $post_permalink;
|
1600 |
+
|
1601 |
+
// if subscription pending confirmation
|
1602 |
+
if ( $wp_subscribe_reloaded->stcr->is_user_subscribed( $post->ID, '', 'C' ) ) {
|
1603 |
+
$html_to_show = str_replace(
|
1604 |
+
'[manager_link]', $user_link,
|
1605 |
+
html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_subscribed_waiting_label', __( "Your subscription to this post needs to be confirmed. <a href='[manager_link]'>Manage your subscriptions</a>.", 'subscribe-to-comments-reloaded' ) ) ), ENT_QUOTES, 'UTF-8' )
|
1606 |
+
);
|
1607 |
+
$show_subscription_box = false;
|
1608 |
+
|
1609 |
+
// if subscription active
|
1610 |
+
} elseif ( $wp_subscribe_reloaded->stcr->is_user_subscribed( $post->ID, '' ) ) {
|
1611 |
+
$html_to_show = str_replace(
|
1612 |
+
'[manager_link]', $user_link ,
|
1613 |
+
html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_subscribed_label', __( "You are subscribed to this post. <a href='[manager_link]'>Manage</a> your subscriptions.", 'subscribe-to-comments-reloaded' ) ) ), ENT_QUOTES, 'UTF-8' )
|
1614 |
+
);
|
1615 |
+
$show_subscription_box = false;
|
1616 |
+
}
|
1617 |
+
|
1618 |
+
// if current user is author of the post
|
1619 |
+
if ( $wp_subscribe_reloaded->stcr->is_author( $post->post_author ) ) {
|
1620 |
+
if ( get_option( 'subscribe_reloaded_admin_subscribe', 'no' ) == 'no' ) {
|
1621 |
+
$show_subscription_box = false;
|
1622 |
+
}
|
1623 |
+
$html_to_show .= ' ';
|
1624 |
+
$html_to_show .= str_replace(
|
1625 |
+
'[manager_link]', $manager_link,
|
1626 |
+
html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_author_label', __( "You can <a href='[manager_link]'>manage the subscriptions</a> of this post.", 'subscribe-to-comments-reloaded' ) ) ), ENT_QUOTES, 'UTF-8' )
|
1627 |
+
);
|
1628 |
+
}
|
1629 |
+
|
1630 |
+
// show the subscription form
|
1631 |
+
if ( $show_subscription_box ) {
|
1632 |
+
|
1633 |
+
// label
|
1634 |
+
$checkbox_label = str_replace(
|
1635 |
+
'[subscribe_link]', "$manager_link&sra=s&srsrc=f",
|
1636 |
+
html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_checkbox_label', __( "Notify me of followup comments via e-mail. You can also <a href='[subscribe_link]'>subscribe</a> without commenting.", 'subscribe-to-comments-reloaded' ) ) ), ENT_QUOTES, 'UTF-8' )
|
1637 |
+
);
|
1638 |
+
|
1639 |
+
// CSS style
|
1640 |
+
$checkbox_inline_style = get_option( 'subscribe_reloaded_checkbox_inline_style', 'width:30px' );
|
1641 |
+
if ( ! empty( $checkbox_inline_style ) ) {
|
1642 |
+
$checkbox_inline_style = " style='$checkbox_inline_style'";
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
$checkbox_html_wrap = html_entity_decode( stripslashes( get_option( 'subscribe_reloaded_checkbox_html', '' ) ), ENT_QUOTES, 'UTF-8' );
|
1646 |
+
|
1647 |
+
// regular subscriptions form
|
1648 |
+
if ( get_option( 'subscribe_reloaded_enable_advanced_subscriptions', 'no' ) == 'no' ) {
|
1649 |
+
switch ( get_option( 'subscribe_reloaded_checked_by_default_value' ) ) {
|
1650 |
+
case '0':
|
1651 |
+
$checkbox_subscription_type = 'yes';
|
1652 |
+
break;
|
1653 |
+
case '1':
|
1654 |
+
$checkbox_subscription_type = 'replies';
|
1655 |
+
break;
|
1656 |
+
}
|
1657 |
+
$checkbox_field = "<input$checkbox_inline_style type='checkbox' name='subscribe-reloaded' id='subscribe-reloaded' value='$checkbox_subscription_type'" . ( ( get_option( 'subscribe_reloaded_checked_by_default', 'no' ) == 'yes' ) ? " checked='checked'" : '' ) . " />";
|
1658 |
+
|
1659 |
+
// advanced subscriptions form
|
1660 |
+
} else {
|
1661 |
+
$checkbox_field = "<select name='subscribe-reloaded' id='subscribe-reloaded'>
|
1662 |
+
<option value='none' " . ( ( get_option( 'subscribe_reloaded_default_subscription_type' ) === '0' ) ? "selected='selected'" : '' ) . ">" . __( "Don't subscribe", 'subscribe-to-comments-reloaded' ) . "</option>
|
1663 |
+
<option value='yes' " . ( ( get_option( 'subscribe_reloaded_default_subscription_type' ) === '1' ) ? "selected='selected'" : '' ) . ">" . __( "All", 'subscribe-to-comments-reloaded' ) . "</option>
|
1664 |
+
<option value='replies' " . ( ( get_option( 'subscribe_reloaded_default_subscription_type' ) === '2' ) ? "selected='selected'" : '' ) . ">" . __( "Replies to my comments", 'subscribe-to-comments-reloaded' ) . "</option>
|
1665 |
+
</select>";
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
if ( empty( $checkbox_html_wrap ) ) {
|
1669 |
+
$html_to_show = "$checkbox_field <label for='subscribe-reloaded'>$checkbox_label</label>" . $html_to_show;
|
1670 |
+
} else {
|
1671 |
+
$checkbox_html_wrap = str_replace( '[checkbox_field]', $checkbox_field, $checkbox_html_wrap );
|
1672 |
+
$html_to_show = str_replace( '[checkbox_label]', $checkbox_label, $checkbox_html_wrap ) . $html_to_show;
|
1673 |
+
}
|
1674 |
+
|
1675 |
+
}
|
1676 |
+
|
1677 |
+
// qTranslate compatiblity
|
1678 |
+
if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' ) ) {
|
1679 |
+
$html_to_show = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $html_to_show );
|
1680 |
+
}
|
1681 |
+
|
1682 |
+
$output = '';
|
1683 |
+
// Check for the Comment Form location
|
1684 |
+
if( get_option('subscribe_reloaded_stcr_position') == 'yes' ) {
|
1685 |
+
$output .= "<style type='text/css'>.stcr-hidden{display: none !important;}</style>";
|
1686 |
+
$output .= "<div class='stcr-form stcr-hidden'>";
|
1687 |
+
$output .= $html_to_show;
|
1688 |
+
$output .= "</div>";
|
1689 |
+
} else {
|
1690 |
+
$output .= $html_to_show;
|
1691 |
+
}
|
1692 |
+
|
1693 |
+
// echo or return
|
1694 |
+
if ( $echo ) {
|
1695 |
+
echo $output . $submit_field;
|
1696 |
+
} else {
|
1697 |
+
return $output . $submit_field;
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
}
|
1701 |
+
|
1702 |
+
/**
|
1703 |
+
* Set a cookie if the user just subscribed without commenting
|
1704 |
+
*
|
1705 |
+
* @since 190705
|
1706 |
+
*/
|
1707 |
+
public function set_user_cookie() {
|
1708 |
+
|
1709 |
+
$subscribe_to_comments_action = ! empty( $_POST['sra'] ) ? $_POST['sra'] : ( ! empty( $_GET['sra'] ) ? $_GET['sra'] : 0 );
|
1710 |
+
$subscribe_to_comments_post_ID = ! empty( $_POST['srp'] ) ? intval( $_POST['srp'] ) : ( ! empty( $_GET['srp'] ) ? intval( $_GET['srp'] ) : 0 );
|
1711 |
+
|
1712 |
+
if ( ! empty( $subscribe_to_comments_action ) && ! empty( $_POST['subscribe_reloaded_email'] ) &&
|
1713 |
+
( $subscribe_to_comments_action == 's' ) && ( $subscribe_to_comments_post_ID > 0 )
|
1714 |
+
) {
|
1715 |
+
$subscribe_to_comments_clean_email = $this->utils->clean_email( $_POST['subscribe_reloaded_email'] );
|
1716 |
+
if ( get_option( 'subscribe_reloaded_use_cookies', 'yes' ) == 'yes' ) {
|
1717 |
+
setcookie( 'comment_author_email_' . COOKIEHASH, $subscribe_to_comments_clean_email, time() + 1209600, '/' );
|
1718 |
+
}
|
1719 |
+
}
|
1720 |
+
}
|
1721 |
+
|
1722 |
+
/**
|
1723 |
+
* Management page shortcode
|
1724 |
+
*
|
1725 |
+
* @since 190325
|
1726 |
+
*/
|
1727 |
+
public function management_page_sc() {
|
1728 |
+
|
1729 |
+
$data = $this->subscribe_reloaded_manage();
|
1730 |
+
return $data[0]->post_content;
|
1731 |
+
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
/**
|
1735 |
+
* Add custom output before comment content
|
1736 |
+
*
|
1737 |
+
* @since 190801
|
1738 |
+
*/
|
1739 |
+
public function comment_content_prepend( $comment_text, $comment = null ) {
|
1740 |
+
|
1741 |
+
// do not proceed if comment info is not passed
|
1742 |
+
if ( empty( $comment ) || ! isset( $comment->comment_approved ) ) {
|
1743 |
+
return $comment_text;
|
1744 |
+
}
|
1745 |
+
|
1746 |
+
global $wp_subscribe_reloaded;
|
1747 |
+
global $post;
|
1748 |
+
|
1749 |
+
$prepend = '';
|
1750 |
+
|
1751 |
+
// comment held for moderation and email is subscribed to the post
|
1752 |
+
if ( $comment->comment_approved == '0' && $wp_subscribe_reloaded->stcr->is_user_subscribed( $post->ID, $comment->comment_author_email, 'C' ) ) {
|
1753 |
+
$prepend = '<p><em>' . __( 'Check your email to confirm your subscription.', 'subscribe-to-comments-reloaded' ) . '</em></p>';
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
// pass it back
|
1757 |
+
return $prepend . $comment_text;
|
1758 |
+
|
1759 |
+
}
|
1760 |
+
|
1761 |
+
/**
|
1762 |
+
* Move form with JS
|
1763 |
+
*
|
1764 |
+
* @since 200626
|
1765 |
+
*/
|
1766 |
+
public function move_form_with_js() {
|
1767 |
+
|
1768 |
+
$output = '';
|
1769 |
+
|
1770 |
+
if ( get_option('subscribe_reloaded_stcr_position') == 'yes' ) {
|
1771 |
+
$output .= '<script type="text/javascript">document.addEventListener("DOMContentLoaded",function(){if(document.querySelectorAll("div.stcr-form").length){let e=document.querySelectorAll("div.stcr-form")[0],t=document.querySelectorAll("#commentform input[type=submit]")[0];t.parentNode.insertBefore(e,t),e.classList.remove("stcr-hidden")}});</script>';
|
1772 |
+
}
|
1773 |
+
|
1774 |
+
echo $output;
|
1775 |
+
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
}
|