Version Description
Download this release
Release Info
Developer | bmarshall511 |
Plugin | WordPress Zero Spam |
Version | 5.2.0 |
Comparing to | |
See all releases |
Code changes from version 5.1.6 to 5.2.0
- assets/css/admin.css +34 -7
- assets/img/icon-fluent-forms.svg +18 -0
- assets/img/icon-wordpress.svg +12 -0
- assets/img/icon-wpforms.svg +68 -0
- core/admin/class-dashboard.php +8 -1
- core/admin/tables/class-logtable.php +1 -1
- core/class-access.php +0 -4
- core/class-settings.php +2 -2
- includes/class-db.php +1 -1
- includes/class-plugin.php +10 -6
- includes/templates/admin-ips.php +9 -0
- includes/templates/admin-line-chart.php +9 -0
- includes/templates/admin-map.php +46 -23
- includes/templates/admin-pie.php +38 -15
- modules/class-projecthoneypot.php +267 -0
- modules/class-stopforumspam.php +1 -1
- modules/class-zerospam.php +1 -91
- modules/davidwalsh/assets/js/davidwalsh.js +1 -1
- modules/davidwalsh/class-davidwalsh.php +42 -29
- modules/fluentforms/class-fluentforms.php +5 -5
- modules/login/class-login.php +189 -0
- modules/ninjaforms/class-ninjaforms.php +38 -0
- modules/wpforms/class-wpforms.php +80 -53
- readme.txt +29 -5
- wordpress-zero-spam.php +2 -2
assets/css/admin.css
CHANGED
@@ -233,22 +233,49 @@
|
|
233 |
margin-top: 16px;
|
234 |
}
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
.zerospam-type-
|
241 |
-
|
|
|
242 |
background-repeat: no-repeat;
|
243 |
background-size: contain;
|
244 |
content: "";
|
245 |
display: inline-block;
|
246 |
height: 16px;
|
247 |
-
margin-right:
|
248 |
vertical-align: sub;
|
249 |
width: 16px;
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
@media (min-width: 768px) {
|
253 |
.zerospam-callout {
|
254 |
flex-wrap: nowrap;
|
233 |
margin-top: 16px;
|
234 |
}
|
235 |
|
236 |
+
/* Type theming */
|
237 |
+
.zerospam-type-blocked::before,
|
238 |
+
.zerospam-type-login::before,
|
239 |
+
.zerospam-type-registration::before,
|
240 |
+
.zerospam-type-comment::before,
|
241 |
+
.zerospam-type-fluent_form::before,
|
242 |
+
.zerospam-type-wpforms::before {
|
243 |
background-repeat: no-repeat;
|
244 |
background-size: contain;
|
245 |
content: "";
|
246 |
display: inline-block;
|
247 |
height: 16px;
|
248 |
+
margin-right: 5px;
|
249 |
vertical-align: sub;
|
250 |
width: 16px;
|
251 |
}
|
252 |
|
253 |
+
/* Type: blocked */
|
254 |
+
.zerospam-type-blocked {
|
255 |
+
color: var(--zerospam-primary);
|
256 |
+
}
|
257 |
+
|
258 |
+
.zerospam-type-blocked::before {
|
259 |
+
background-image: url('../img/icon.svg');
|
260 |
+
}
|
261 |
+
|
262 |
+
/* Type: login, registration, comment */
|
263 |
+
.zerospam-type-login::before,
|
264 |
+
.zerospam-type-registration::before,
|
265 |
+
.zerospam-type-comment::before {
|
266 |
+
background-image: url('../img/icon-wordpress.svg');
|
267 |
+
}
|
268 |
+
|
269 |
+
/* Type: fluent_form */
|
270 |
+
.zerospam-type-fluent_form::before {
|
271 |
+
background-image: url('../img/icon-fluent-forms.svg');
|
272 |
+
}
|
273 |
+
|
274 |
+
/* Type: wpforms */
|
275 |
+
.zerospam-type-wpforms::before {
|
276 |
+
background-image: url('../img/icon-wpforms.svg');
|
277 |
+
}
|
278 |
+
|
279 |
@media (min-width: 768px) {
|
280 |
.zerospam-callout {
|
281 |
flex-wrap: nowrap;
|
assets/img/icon-fluent-forms.svg
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<svg width="113px" height="113px" viewBox="0 0 113 113" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
+
<title>Fluent Form with Light Background</title>
|
4 |
+
<defs>
|
5 |
+
<linearGradient x1="25.470009%" y1="25.4700976%" x2="94.8491805%" y2="94.8491805%" id="linearGradient-1">
|
6 |
+
<stop stop-color="#05CDFF" offset="0%"></stop>
|
7 |
+
<stop stop-color="#0976FF" offset="100%"></stop>
|
8 |
+
</linearGradient>
|
9 |
+
</defs>
|
10 |
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
11 |
+
<g id="Fluent-Form-with-Light-Background" fill-rule="nonzero">
|
12 |
+
<path d="M112.817,23.1555 L112.817,89.6617 C112.817,102.452 102.056,112.817 88.7736,112.817 L24.0437,112.817 C10.7681,112.817 0,102.452 0,89.6617 L0,23.1555 C0,10.3686 10.7681,0 24.0437,0 L88.7736,0 C102.053,0 112.817,10.3686 112.817,23.1555 Z" id="Path" fill="url(#linearGradient-1)"></path>
|
13 |
+
<path d="M91.1419,48.0698 L36.1029,48.0698 C27.5141,48.0698 20.5482,55.0322 20.5482,63.6246 C20.5482,64.2452 21.0511,64.7481 21.6718,64.7481 L76.7143,64.7481 C85.3031,64.7481 92.2691,57.7857 92.2691,49.1934 C92.2655,48.5727 91.7626,48.0698 91.1419,48.0698 Z" id="Path" fill="#FFFFFF"></path>
|
14 |
+
<path d="M80.9444,72.7019 L46.6533,72.7019 C37.9647,72.7019 30.9238,79.7427 30.9238,88.4314 C30.9238,88.9557 31.3483,89.3766 31.869,89.3766 L66.1565,89.3766 C74.8452,89.3766 81.8860227,82.3358 81.8860227,73.6471 C81.8896,73.1263 81.4651,72.7019 80.9444,72.7019 Z" id="Path" fill="#FFFFFF"></path>
|
15 |
+
<path d="M91.1419,23.4375 L36.1029,23.4375 C27.5141,23.4375 20.5482,30.3999 20.5482,38.9922 C20.5482,39.6128 21.0511,40.1158 21.6718,40.1158 L76.7143,40.1158 C85.3031,40.1158 92.2691,33.1534 92.2691,24.561 C92.2655,23.9404 91.7626,23.4375 91.1419,23.4375 Z" id="Path" fill="#FFFFFF"></path>
|
16 |
+
</g>
|
17 |
+
</g>
|
18 |
+
</svg>
|
assets/img/icon-wordpress.svg
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<svg width="668px" height="668px" viewBox="0 0 668 668" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
+
<title>Group</title>
|
4 |
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
5 |
+
<g id="WordPress-logotype-wmark" transform="translate(-128.000000, -118.000000)" fill="#32373C">
|
6 |
+
<g id="Group" transform="translate(128.666900, 118.666700)">
|
7 |
+
<path d="M333.333,0 C149.238,0 0,149.238 0,333.333 C0,517.428 149.238,666.667 333.333,666.667 C517.428,666.667 666.666,517.428 666.666,333.333 C666.666,149.238 517.428,0 333.333,0 M333.333,20 C375.642,20 416.674,28.282 455.29,44.615 C473.852,52.466 491.757,62.185 508.507,73.5 C525.103,84.712 540.709,97.589 554.893,111.773 C569.077,125.957 581.954,141.564 593.166,158.159 C604.482,174.909 614.2,192.814 622.051,211.376 C638.385,249.992 646.666,291.025 646.666,333.333 C646.666,375.642 638.385,416.674 622.051,455.29 C614.2,473.852 604.482,491.757 593.166,508.507 C581.954,525.103 569.077,540.709 554.893,554.893 C540.709,569.077 525.103,581.954 508.507,593.166 C491.757,604.482 473.852,614.2 455.29,622.051 C416.674,638.385 375.642,646.667 333.333,646.667 C291.025,646.667 249.992,638.385 211.376,622.051 C192.814,614.2 174.909,604.482 158.159,593.166 C141.564,581.954 125.957,569.077 111.773,554.893 C97.589,540.709 84.712,525.103 73.5,508.507 C62.185,491.757 52.466,473.852 44.615,455.29 C28.282,416.674 20,375.642 20,333.333 C20,291.025 28.282,249.992 44.615,211.376 C52.466,192.814 62.185,174.909 73.5,158.159 C84.712,141.564 97.589,125.957 111.773,111.773 C125.957,97.589 141.564,84.712 158.159,73.5 C174.909,62.185 192.814,52.466 211.376,44.615 C249.992,28.282 291.025,20 333.333,20" id="Fill-3"></path>
|
8 |
+
<path d="M577.0923,200.0657 C578.2853,208.9117 578.9593,218.4027 578.9593,228.6267 C578.9593,256.8037 573.6803,288.4907 557.8303,328.1167 L472.9913,573.4137 C555.5743,525.2677 611.1113,435.7987 611.1113,333.3227 C611.1113,285.0287 598.7693,239.6267 577.0923,200.0657 L577.0923,200.0657 Z M338.2133,357.6197 L254.8573,599.7927 C279.7513,607.1167 306.0693,611.1107 333.3333,611.1107 C365.6803,611.1107 396.7123,605.5277 425.5823,595.3617 C424.8393,594.1737 424.1543,592.9117 423.5893,591.5337 L338.2133,357.6197 Z M520.8563,319.3137 C520.8563,284.9737 508.5213,261.2057 497.9573,242.7087 C483.8753,219.8167 470.6703,200.4497 470.6703,177.5587 C470.6703,152.0287 490.0313,128.2607 517.3173,128.2607 C518.5503,128.2607 519.7173,128.4087 520.9143,128.4847 C471.4933,83.2027 405.6493,55.5557 333.3333,55.5557 C236.2843,55.5557 150.9123,105.3507 101.2423,180.7527 C107.7643,180.9597 113.9093,181.0897 119.1193,181.0897 C148.1673,181.0897 193.1543,177.5587 193.1543,177.5587 C208.1203,176.6817 209.8893,198.6807 194.9303,200.4497 C194.9303,200.4497 179.8773,202.2127 163.1413,203.0887 L264.2913,503.9727 L325.0883,321.6627 L281.8133,203.0887 C266.8473,202.2127 252.6793,200.4497 252.6793,200.4497 C237.7053,199.5657 239.4593,176.6817 254.4413,177.5587 C254.4413,177.5587 300.3043,181.0897 327.5973,181.0897 C356.6453,181.0897 401.6393,177.5587 401.6393,177.5587 C416.6133,176.6817 418.3753,198.6807 403.4093,200.4497 C403.4093,200.4497 388.3413,202.2127 371.6193,203.0887 L472.0053,501.6807 L500.6613,410.8797 C513.3923,371.1967 520.8563,343.0817 520.8563,319.3137 L520.8563,319.3137 Z M55.5553,333.3227 C55.5553,443.2677 119.4453,538.2907 212.1153,583.3117 L79.6083,220.2777 C64.1953,254.8207 55.5553,293.0507 55.5553,333.3227 L55.5553,333.3227 Z" id="Fill-5"></path>
|
9 |
+
</g>
|
10 |
+
</g>
|
11 |
+
</g>
|
12 |
+
</svg>
|
assets/img/icon-wpforms.svg
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<svg width="201px" height="156px" viewBox="0 0 201 156" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3 |
+
<title>WPForms-Logo</title>
|
4 |
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
5 |
+
<g id="WPForms-Logo" transform="translate(0.179579, 0.000000)" fill-rule="nonzero">
|
6 |
+
<path d="M22.620421,96.2 C33.720421,97.7 43.420421,95.2 51.320421,88.1 L64.520421,88.8 L57.320421,110 C49.320421,122.7 37.720421,125.4 25.820421,124.6 L22.620421,96.2 L22.620421,96.2 L22.620421,96.2 Z" id="Path" fill="#7EAABA"></path>
|
7 |
+
<path d="M27.520421,101 L29.720421,120.4 C39.620421,120.3 47.520421,117.1 53.420421,108.1 L58.620421,92.9 L52.820421,92.6 C45.420421,98.7 36.820421,101.3 27.520421,101 L27.520421,101 L27.520421,101 Z" id="Path" fill="#D3E8EF"></path>
|
8 |
+
<path d="M27.520421,101 L28.820421,112.5 C42.420421,110.9 53.020421,105.3 58.520421,92.9 L52.720421,92.6 C45.320421,98.7 36.820421,101.3 27.520421,101" id="Path" fill="#FFFFFF"></path>
|
9 |
+
<path d="M25.820421,79.6 C38.220421,79.6 48.320421,89.7 48.320421,102.1 C48.320421,114.5 38.220421,124.6 25.820421,124.6 C13.420421,124.6 3.32042102,114.6 3.32042102,102.1 C3.32042102,89.7 13.420421,79.6 25.820421,79.6" id="Path" fill="#7EAABA"></path>
|
10 |
+
<path d="M25.820421,84 C15.820421,84 7.82042102,92.1 7.82042102,102 C7.82042102,112 15.920421,120 25.820421,120 C35.820421,120 43.820421,111.9 43.820421,102 C43.820421,92 35.720421,84 25.820421,84" id="Path" fill="#D3E8EF"></path>
|
11 |
+
<path d="M25.820421,84 C19.720421,84 14.220421,87 11.020421,91.7 C11.620421,101.1 19.520421,108.6 29.020421,108.6 C35.120421,108.6 40.620421,105.6 43.820421,100.9 C43.220421,91.5 35.420421,84 25.820421,84" id="Path" fill="#FFFFFF"></path>
|
12 |
+
<path d="M23.520421,82.9 C32.820421,82.9 40.320421,90.4 40.320421,99.7 C40.320421,109 32.820421,116.5 23.520421,116.5 C14.220421,116.5 6.72042102,108.9 6.72042102,99.6 C6.72042102,90.4 14.220421,82.9 23.520421,82.9" id="Path" fill="#7EAABA"></path>
|
13 |
+
<path d="M22.320421,78.4 C31.620421,78.4 39.220421,86 39.220421,95.2 C39.220421,104.5 31.620421,112.1 22.320421,112.1 C13.020421,112.1 5.42042102,104.5 5.42042102,95.2 C5.42042102,85.9 13.020421,78.4 22.320421,78.4" id="Path" fill="#7F3E13"></path>
|
14 |
+
<path d="M23.920421,84.8 C16.520421,84.8 10.520421,90.8 10.520421,98.2 C10.520421,105.6 16.520421,111.6 23.920421,111.6 C31.320421,111.6 37.320421,105.6 37.320421,98.2 C37.320421,90.8 31.320421,84.8 23.920421,84.8" id="Path" fill="#B85A1B"></path>
|
15 |
+
<path d="M13.820421,64.8 C14.120421,55.4 28.120421,54.8 28.520421,64.8 C32.620421,57.9 45.520421,61.7 41.520421,72.5 C41.720421,73.4 41.920421,74.2 42.020421,75.1 C49.020421,75.5 51.320421,86.4 41.720421,89.8 C40.920421,92.8 39.620421,95.4 37.920421,97.5 C29.720421,104.6 27.020421,98.8 22.620421,94 C18.320421,94.1 6.62042102,91.1 9.92042102,102.1 C2.42042102,97.3 -2.37957898,87.6 1.22042102,73.4 C-3.77957898,61.9 9.52042102,57.6 13.820421,64.8 L13.820421,64.8 L13.820421,64.8 Z" id="Path" fill="#7F3E13"></path>
|
16 |
+
<path d="M5.72042102,75 C4.02042102,81.9 3.92042102,89.7 8.82042102,95.3 C15.720421,103.2 29.720421,102.8 35.120421,92.9 C38.020421,87.5 37.820421,80.8 36.620421,74.9 C26.320421,72.7 15.920421,73.1 5.72042102,75 L5.72042102,75 L5.72042102,75 Z" id="Path" fill="#B85A1B"></path>
|
17 |
+
<path d="M5.72042102,75 C4.02042102,81.9 3.92042102,89.7 8.82042102,95.3 C12.020421,98.9 16.520421,100.7 21.220421,100.8 L21.220421,73.4 C16.020421,73.4 10.920421,74 5.72042102,75" id="Path" fill="#E1762F"></path>
|
18 |
+
<path d="M12.520421,80.3 C11.520421,84.1 11.520421,88.5 14.320421,91.6 C18.120421,96 25.920421,95.8 28.920421,90.2 C30.520421,87.2 30.420421,83.5 29.720421,80.2 C24.020421,79 18.220421,79.2 12.520421,80.3" id="Path" fill="#7F3E13"></path>
|
19 |
+
<path d="M21.120421,69.7 C23.220421,69.7 25.020421,67.9 25.020421,65.8 C25.020421,63.7 23.220421,61.9 21.120421,61.9 L21.120421,69.7 L21.120421,69.7 L21.120421,69.7 Z M35.220421,64.8 C37.320421,64.8 39.120421,66.6 39.120421,68.7 C39.120421,70.8 37.320421,72.6 35.220421,72.6 C33.120421,72.6 31.320421,70.8 31.320421,68.7 C31.320421,66.5 33.120421,64.8 35.220421,64.8" id="Shape" fill="#B85A1B"></path>
|
20 |
+
<path d="M7.82042102,65.2 C9.92042102,65.2 11.720421,67 11.720421,69.1 C11.720421,71.2 9.92042102,73 7.82042102,73 C5.72042102,73 3.92042102,71.2 3.92042102,69.1 C3.92042102,67 5.62042102,65.2 7.82042102,65.2 M21.120421,69.7 L21.120421,62 C19.020421,62 17.220421,63.8 17.220421,65.9 C17.220421,68 19.020421,69.8 21.120421,69.7 L21.120421,69.7 L21.120421,69.7 Z" id="Shape" fill="#E1762F"></path>
|
21 |
+
<path d="M39.620421,78.9 C41.720421,78.9 43.520421,80.7 43.520421,82.8 C43.520421,84.9 41.720421,86.7 39.620421,86.7 C37.520421,86.7 35.720421,84.9 35.720421,82.8 C35.720421,80.6 37.420421,78.9 39.620421,78.9" id="Path" fill="#B85A1B"></path>
|
22 |
+
<path d="M173.420421,124.9 C172.520421,113.2 167.220421,104.8 156.820421,100.3 L158.920421,92.2 L175.720421,87.7 C190.320421,92.1 196.120421,101.5 198.920421,113.2 L173.420421,124.9 L173.420421,124.9 L173.420421,124.9 Z" id="Path" fill="#7EAABA"></path>
|
23 |
+
<path d="M176.920421,118.5 L193.620421,110.7 C190.720421,100.9 185.820421,94.6 175.520421,92.1 L162.420421,95.6 L161.820421,97.8 C169.920421,102.5 174.820421,109.6 176.920421,118.5 L176.920421,118.5 L176.920421,118.5 Z" id="Path" fill="#FFFFFF"></path>
|
24 |
+
<path d="M157.220421,126.9 C153.420421,115.4 159.620421,103.1 171.120421,99.3 C182.620421,95.5 194.920421,101.7 198.720421,113.2 C202.520421,124.7 196.320421,137 184.820421,140.8 C173.320421,144.6 161.020421,138.4 157.220421,126.9" id="Path" fill="#7EAABA"></path>
|
25 |
+
<path d="M160.820421,125.7 C163.920421,135.2 174.120421,140.3 183.620421,137.2 C193.120421,134.1 198.220421,123.9 195.120421,114.4 C192.020421,104.9 181.820421,99.8 172.320421,102.9 C162.820421,106 157.720421,116.2 160.820421,125.7" id="Path" fill="#D3E8EF"></path>
|
26 |
+
<path d="M195.820421,117.6 C195.720421,116.5 195.420421,115.5 195.120421,114.4 C192.020421,104.9 181.820421,99.8 172.320421,102.9 C169.420421,103.9 166.920421,105.5 164.920421,107.5 C165.020421,108.6 165.320421,109.6 165.620421,110.7 C168.820421,120.2 178.920421,125.3 188.420421,122.2 C191.420421,121.3 193.920421,119.6 195.820421,117.6" id="Path" fill="#FFFFFF"></path>
|
27 |
+
<path d="M153.120421,132.5 C149.520421,121.7 155.420421,110 166.220421,106.5 C177.020421,102.9 188.720421,108.8 192.220421,119.6 C195.820421,130.4 189.920421,142.1 179.120421,145.6 C168.320421,149.2 156.620421,143.3 153.120421,132.5" id="Path" fill="#7F3E13"></path>
|
28 |
+
<path d="M157.320421,131.2 C154.520421,122.7 159.120421,113.5 167.620421,110.7 C176.120421,107.9 185.320421,112.5 188.120421,121 C190.920421,129.5 186.320421,138.7 177.820421,141.5 C169.220421,144.3 160.120421,139.7 157.320421,131.2" id="Path" fill="#B85A1B"></path>
|
29 |
+
<path d="M156.620421,123.5 C157.620421,117.7 161.620421,112.6 167.620421,110.6 C176.120421,107.8 185.320421,112.4 188.120421,120.9 C188.520421,122.2 188.820421,123.6 188.920421,124.9 C178.420421,131.6 164.720421,130.2 156.620421,123.5 L156.620421,123.5 L156.620421,123.5 Z" id="Path" fill="#E1762F"></path>
|
30 |
+
<path d="M81.820421,0 C90.020421,0 96.720421,7.1 96.720421,15.7 C96.720421,24.4 90.120421,31.4 81.820421,31.4 C73.620421,31.4 66.920421,24.3 66.920421,15.7 C66.920421,7.1 73.620421,0 81.820421,0" id="Path" fill="#7F3E13"></path>
|
31 |
+
<path d="M81.820421,4.3 C75.720421,4.3 71.320421,9.7 71.320421,15.7 C71.320421,21.6 75.720421,27.1 81.820421,27.1 C87.920421,27.1 92.320421,21.7 92.320421,15.7 C92.320421,9.9 87.920421,4.3 81.820421,4.3" id="Path" fill="#B85A1B"></path>
|
32 |
+
<path d="M81.820421,8.7 C78.020421,8.7 75.620421,12.2 75.620421,15.8 C75.620421,19.3 78.120421,22.9 81.820421,22.9 C85.620421,22.9 88.020421,19.4 88.020421,15.8 C88.020421,12.3 85.520421,8.7 81.820421,8.7" id="Path" fill="#63300F"></path>
|
33 |
+
<path d="M145.020421,0 C153.220421,0 159.920421,7.1 159.920421,15.7 C159.920421,24.4 153.320421,31.4 145.020421,31.4 C136.820421,31.4 130.120421,24.3 130.120421,15.7 C130.120421,7.1 136.820421,0 145.020421,0" id="Path" fill="#7F3E13"></path>
|
34 |
+
<path d="M145.020421,4.3 C138.920421,4.3 134.520421,9.7 134.520421,15.7 C134.520421,21.6 138.920421,27.1 145.020421,27.1 C151.120421,27.1 155.520421,21.7 155.520421,15.7 C155.520421,9.9 151.120421,4.3 145.020421,4.3" id="Path" fill="#B85A1B"></path>
|
35 |
+
<path d="M145.020421,8.7 C141.220421,8.7 138.820421,12.2 138.820421,15.8 C138.820421,19.3 141.320421,22.9 145.020421,22.9 C148.820421,22.9 151.220421,19.4 151.220421,15.8 C151.220421,12.3 148.720421,8.7 145.020421,8.7" id="Path" fill="#4F2800"></path>
|
36 |
+
<path d="M119.420421,7.4 C122.020421,7.4 124.120421,9.5 124.120421,12.1 C124.120421,14.7 122.020421,16.8 119.420421,16.8 C116.820421,16.8 114.720421,14.7 114.720421,12.1 C114.720421,9.5 116.820421,7.4 119.420421,7.4 M107.420421,7.4 C110.020421,7.4 112.120421,9.5 112.120421,12.1 C112.120421,14.7 110.020421,16.8 107.420421,16.8 C104.820421,16.8 102.720421,14.7 102.720421,12.1 C102.720421,9.5 104.820421,7.4 107.420421,7.4" id="Shape" fill="#7F3E13"></path>
|
37 |
+
<path d="M168.320421,27 L168.320421,56.3 L168.620421,56.4 C172.920421,58.1 175.620421,62 175.620421,66.6 L175.620421,87.6 L113.420421,108.1 L51.220421,88.1 L51.220421,66.6 C51.220421,62 53.920421,58.1 58.220421,56.4 L58.520421,56.3 L58.520421,26.9 C58.520421,6.7 168.320421,6.7 168.320421,27 L168.320421,27 L168.320421,27 Z" id="Path" fill="#7F3E13"></path>
|
38 |
+
<path d="M63.520421,28.1 L63.520421,59.7 L60.920421,60.7 C58.020421,61.8 56.320421,64.5 56.320421,67.5 L56.320421,89.7 L113.520421,108.1 L170.720421,89.3 L170.720421,67.5 C170.720421,64.4 168.920421,61.8 166.120421,60.7 L163.520421,59.7 L163.520421,28.1 C163.420421,13.1 63.620421,13.1 63.520421,28.1 L63.520421,28.1 L63.520421,28.1 Z" id="Path" fill="#B85A1B"></path>
|
39 |
+
<path d="M63.520421,28.1 L63.520421,59.7 L60.920421,60.7 C58.020421,61.8 56.320421,64.5 56.320421,67.5 L56.320421,89.7 L113.520421,108.1 L113.520421,96.1 C93.720421,96.2 73.920421,83.2 79.120421,57.5 L113.520421,57.5 L113.520421,16.9 C88.520421,16.9 63.520421,20.7 63.520421,28.1 L63.520421,28.1 L63.520421,28.1 Z" id="Path" fill="#E1762F"></path>
|
40 |
+
<path d="M76.420421,50.8 L150.720421,50.8 C161.220421,106.6 65.020421,106.2 76.420421,50.8" id="Path" fill="#E5895B"></path>
|
41 |
+
<path d="M80.020421,55.2 C79.020421,63.8 80.820421,72.1 87.220421,78.6 C94.020421,85.4 104.220421,88.3 113.620421,88.2 C122.720421,88.1 132.320421,85.3 139.020421,78.9 C145.720421,72.4 147.820421,64 146.920421,55.2 L80.020421,55.2 L80.020421,55.2 Z" id="Path" fill="#E5895B"></path>
|
42 |
+
<path d="M125.920421,81.2 C130.920421,87.7 145.520421,85 141.120421,71.3 L125.920421,81.2 L125.920421,81.2 Z" id="Path" fill="#FAD395"></path>
|
43 |
+
<path d="M121.320421,79.8 C126.920421,87 145.120421,82.7 140.920421,67.1 L121.320421,79.8 L121.320421,79.8 Z" id="Path" fill="#4F2800"></path>
|
44 |
+
<path d="M138.120421,67.8 C139.220421,67.5 140.420421,68.2 140.720421,69.4 C141.020421,70.6 140.420421,71.8 139.320421,72.1 C138.220421,72.4 137.020421,71.7 136.720421,70.5 C136.420421,69.4 137.020421,68.1 138.120421,67.8 M126.220421,76.1 C127.320421,75.8 128.420421,76.5 128.820421,77.7 C129.120421,78.9 128.520421,80.1 127.420421,80.4 C126.320421,80.7 125.220421,80 124.820421,78.8 C124.520421,77.6 125.120421,76.4 126.220421,76.1" id="Shape" fill="#FFFFFF"></path>
|
45 |
+
<path d="M133.520421,82.6 C137.520421,81.3 140.920421,78.1 141.520421,73 C138.320421,72.5 132.720421,77.3 133.520421,82.6" id="Path" fill="#AD6151"></path>
|
46 |
+
<path d="M84.020421,50.8 L142.920421,50.8 C151.320421,90.7 75.020421,90.3 84.020421,50.8" id="Path" fill="#FAD395"></path>
|
47 |
+
<path d="M113.420421,73.5 C113.820421,71.1 114.720421,68.9 116.220421,66.9 C123.320421,65.8 129.420421,60.4 127.520421,50.8 C122.920421,49.2 118.220421,48.4 113.520421,48.4 L110.620421,57.5 L113.420421,73.5 L113.420421,73.5 L113.420421,73.5 Z" id="Path" fill="#4F2800"></path>
|
48 |
+
<path d="M113.420421,73.5 C113.020421,71.1 112.120421,68.9 110.620421,66.9 C103.520421,65.8 97.420421,60.4 99.320421,50.8 C103.920421,49.2 108.620421,48.4 113.320421,48.4 L113.420421,73.5 L113.420421,73.5 L113.420421,73.5 Z" id="Path" fill="#63300F"></path>
|
49 |
+
<path d="M103.020421,52.2 C110.020421,50.4 116.920421,50.4 123.920421,52.2 C126.820421,59.5 99.820421,59.4 103.020421,52.2" id="Path" fill="#AD6151"></path>
|
50 |
+
<path d="M102.220421,31.9 C106.520421,31.9 110.120421,35.4 110.120421,39.8 C110.120421,44.1 106.620421,47.7 102.220421,47.7 C97.920421,47.7 94.320421,44.2 94.320421,39.8 C94.320421,35.5 97.820421,31.9 102.220421,31.9" id="Path" fill="#FFFFFF"></path>
|
51 |
+
<path d="M102.820421,34.7 C106.020421,34.7 108.720421,37.3 108.720421,40.6 C108.720421,43.8 106.120421,46.5 102.820421,46.5 C99.620421,46.5 96.920421,43.9 96.920421,40.6 C96.920421,37.3 99.520421,34.7 102.820421,34.7" id="Path" fill="#1B1D23"></path>
|
52 |
+
<path d="M124.820421,31.9 C120.520421,31.9 116.920421,35.4 116.920421,39.8 C116.920421,44.1 120.420421,47.7 124.820421,47.7 C129.120421,47.7 132.720421,44.2 132.720421,39.8 C132.720421,35.5 129.220421,31.9 124.820421,31.9" id="Path" fill="#FFFFFF"></path>
|
53 |
+
<path d="M124.320421,34.7 C121.120421,34.7 118.420421,37.3 118.420421,40.6 C118.420421,43.8 121.020421,46.5 124.320421,46.5 C127.520421,46.5 130.220421,43.9 130.220421,40.6 C130.120421,37.3 127.520421,34.7 124.320421,34.7" id="Path" fill="#1B1D23"></path>
|
54 |
+
<path d="M107.920421,29.4 C101.620421,28.2 96.320421,29.3 91.620421,32.3 C89.920421,22.6 106.220421,19.7 107.920421,29.4" id="Path" fill="#63300F"></path>
|
55 |
+
<path d="M117.520421,24.5 C123.820421,23.3 129.120421,24.4 133.820421,27.4 C135.520421,17.7 119.320421,14.9 117.520421,24.5" id="Path" fill="#4F2800"></path>
|
56 |
+
<path d="M175.520421,87.7 L175.520421,148.3 C175.520421,152.3 172.220421,155.7 168.120421,155.7 L58.520421,155.7 C54.520421,155.7 51.120421,152.4 51.120421,148.3 L51.120421,88.3 L113.320421,103.2 L175.520421,87.7 L175.520421,87.7 Z" id="Path" fill="#7EAABA"></path>
|
57 |
+
<path d="M170.620421,94 L113.420421,108.1 L56.220421,94.5 L56.220421,147 C56.220421,149.1 57.820421,150.7 59.920421,150.7 L167.020421,150.7 C169.120421,150.7 170.720421,149.1 170.720421,147 L170.720421,94 L170.620421,94 Z" id="Path" fill="#D3E8EF"></path>
|
58 |
+
<path d="M113.420421,108.2 L56.320421,94.5 L56.320421,147 C56.320421,149.1 57.920421,150.7 60.020421,150.7 L113.520421,150.7 L113.520421,108.2 L113.420421,108.2 Z" id="Path" fill="#FFFFFF"></path>
|
59 |
+
<path d="M113.420421,136.3 L161.420421,136.3 L161.420421,139.5 L161.420421,142.7 L113.420421,142.7 L113.420421,136.3 L113.420421,136.3 Z M113.420421,123 L161.420421,123 L161.420421,126.2 L161.420421,129.4 L113.420421,129.4 L113.420421,123 L113.420421,123 Z" id="Shape" fill="#036AAB"></path>
|
60 |
+
<path d="M113.420421,142.8 L113.420421,136.3 L65.420421,136.3 L65.420421,139.5 L65.420421,142.7 L113.420421,142.7 L113.420421,142.8 Z M65.420421,123 L113.420421,123 L113.420421,129.5 L65.420421,129.5 L65.420421,123 L65.420421,123 Z" id="Shape" fill="#0399ED"></path>
|
61 |
+
<polygon id="Path" fill="#FFFFFF" points="84.920421 118.8 90.920421 118.8 90.920421 148.2 84.920421 148.2"></polygon>
|
62 |
+
<path d="M68.020421,92.2 C83.220421,95.8 98.320421,99.5 113.420421,103.1 L97.220421,118.4 C86.720421,112.2 76.320421,105.4 68.020421,92.2" id="Path" fill="#7EAABA"></path>
|
63 |
+
<path d="M80.820421,100.4 C85.420421,105 90.620421,108.6 96.520421,112.2 L103.320421,105.7 C95.920421,104 88.320421,102.1 80.820421,100.4" id="Path" fill="#FFFFFF"></path>
|
64 |
+
<path d="M158.820421,92.2 C143.620421,95.8 128.520421,99.5 113.420421,103.1 L129.620421,118.4 C140.120421,112.2 150.520421,105.4 158.820421,92.2" id="Path" fill="#7EAABA"></path>
|
65 |
+
<path d="M146.020421,100.4 C141.420421,105 136.220421,108.6 130.320421,112.2 L123.520421,105.7 C131.020421,104 138.520421,102.1 146.020421,100.4" id="Path" fill="#FFFFFF"></path>
|
66 |
+
</g>
|
67 |
+
</g>
|
68 |
+
</svg>
|
core/admin/class-dashboard.php
CHANGED
@@ -229,7 +229,14 @@ class Dashboard {
|
|
229 |
echo '<div class="zerospam-modules">';
|
230 |
|
231 |
echo '<div class="zerospam-module zerospam-module-map">';
|
232 |
-
echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
require ZEROSPAM_PATH . 'includes/templates/admin-map.php';
|
234 |
echo '</div>';
|
235 |
|
229 |
echo '<div class="zerospam-modules">';
|
230 |
|
231 |
echo '<div class="zerospam-module zerospam-module-map">';
|
232 |
+
echo sprintf(
|
233 |
+
wp_kses(
|
234 |
+
__( '<h3>Detections World Map</h3>', 'zerospam' ),
|
235 |
+
array(
|
236 |
+
'h3' => array(),
|
237 |
+
)
|
238 |
+
)
|
239 |
+
);
|
240 |
require ZEROSPAM_PATH . 'includes/templates/admin-map.php';
|
241 |
echo '</div>';
|
242 |
|
core/admin/tables/class-logtable.php
CHANGED
@@ -67,7 +67,7 @@ class LogTable extends WP_List_Table {
|
|
67 |
return '<a href="' . ZEROSPAM_URL . 'ip-lookup/' . urlencode( $item[ $column_name ] ) .'" target="_blank" rel="noopener noreferrer">' . $item[ $column_name ] . '</a>';
|
68 |
break;
|
69 |
case 'date_recorded':
|
70 |
-
return
|
71 |
break;
|
72 |
case 'details':
|
73 |
ob_start();
|
67 |
return '<a href="' . ZEROSPAM_URL . 'ip-lookup/' . urlencode( $item[ $column_name ] ) .'" target="_blank" rel="noopener noreferrer">' . $item[ $column_name ] . '</a>';
|
68 |
break;
|
69 |
case 'date_recorded':
|
70 |
+
return gmdate( 'm/d/y g:ia' , strtotime( $item[ $column_name ] ) );
|
71 |
break;
|
72 |
case 'details':
|
73 |
ob_start();
|
core/class-access.php
CHANGED
@@ -64,10 +64,6 @@ class Access {
|
|
64 |
$settings = ZeroSpam\Core\Settings::get_settings();
|
65 |
|
66 |
if ( ! empty( $access['details'] ) && is_array( $access['details'] ) ) {
|
67 |
-
if ( ! empty( $settings['share_data']['value'] ) && 'enabled' === $settings['share_data']['value'] ) {
|
68 |
-
do_action( 'zerospam_share_blocked', $access );
|
69 |
-
}
|
70 |
-
|
71 |
foreach ( $access['details'] as $key => $detail ) {
|
72 |
if ( ! empty( $detail['blocked'] ) ) {
|
73 |
if ( empty( $detail['details']['failed'] ) ) {
|
64 |
$settings = ZeroSpam\Core\Settings::get_settings();
|
65 |
|
66 |
if ( ! empty( $access['details'] ) && is_array( $access['details'] ) ) {
|
|
|
|
|
|
|
|
|
67 |
foreach ( $access['details'] as $key => $detail ) {
|
68 |
if ( ! empty( $detail['blocked'] ) ) {
|
69 |
if ( empty( $detail['details']['failed'] ) ) {
|
core/class-settings.php
CHANGED
@@ -269,7 +269,7 @@ class Settings {
|
|
269 |
'enabled' => __( 'Enabled', 'zerospam' ),
|
270 |
),
|
271 |
'value' => ! empty( $options['log_blocked_ips'] ) ? $options['log_blocked_ips'] : false,
|
272 |
-
'recommended' =>
|
273 |
);
|
274 |
|
275 |
self::$settings['max_logs'] = array(
|
@@ -302,7 +302,7 @@ class Settings {
|
|
302 |
'field_class' => 'regular-text code',
|
303 |
'placeholder' => '',
|
304 |
'value' => ! empty( $options['blocked_email_domains'] ) ? $options['blocked_email_domains'] : false,
|
305 |
-
'recommended' => implode( "\n", $recommended_blocked_email_domains ),
|
306 |
);
|
307 |
|
308 |
self::$settings['update_blocked_email_domains'] = array(
|
269 |
'enabled' => __( 'Enabled', 'zerospam' ),
|
270 |
),
|
271 |
'value' => ! empty( $options['log_blocked_ips'] ) ? $options['log_blocked_ips'] : false,
|
272 |
+
'recommended' => 'enabled',
|
273 |
);
|
274 |
|
275 |
self::$settings['max_logs'] = array(
|
302 |
'field_class' => 'regular-text code',
|
303 |
'placeholder' => '',
|
304 |
'value' => ! empty( $options['blocked_email_domains'] ) ? $options['blocked_email_domains'] : false,
|
305 |
+
'recommended' => $recommended_blocked_email_domains ? implode( "\n", $recommended_blocked_email_domains ) : '',
|
306 |
);
|
307 |
|
308 |
self::$settings['update_blocked_email_domains'] = array(
|
includes/class-db.php
CHANGED
@@ -161,7 +161,7 @@ class DB {
|
|
161 |
|
162 |
$page_url = ZeroSpam\Core\Utilities::current_url();
|
163 |
$extension = substr( $page_url, strrpos( $page_url, '.' ) + 1 );
|
164 |
-
$ignore = array( 'map', 'js', 'css' );
|
165 |
if ( in_array( $extension, $ignore, true ) ) {
|
166 |
// Ignore assets.
|
167 |
return false;
|
161 |
|
162 |
$page_url = ZeroSpam\Core\Utilities::current_url();
|
163 |
$extension = substr( $page_url, strrpos( $page_url, '.' ) + 1 );
|
164 |
+
$ignore = array( 'map', 'js', 'css', 'ico' );
|
165 |
if ( in_array( $extension, $ignore, true ) ) {
|
166 |
// Ignore assets.
|
167 |
return false;
|
includes/class-plugin.php
CHANGED
@@ -11,9 +11,6 @@ use ZeroSpam\Includes\DB;
|
|
11 |
use ZeroSpam\Core\Access;
|
12 |
use ZeroSpam\Core\User;
|
13 |
use ZeroSpam\Core\Admin\Admin;
|
14 |
-
use ZeroSpam\Modules\StopForumSpam;
|
15 |
-
use ZeroSpam\Modules\ipstack;
|
16 |
-
use ZeroSpam\Modules\IPinfoModule;
|
17 |
use ZeroSpam\Modules\Google;
|
18 |
use ZeroSpam\Modules\Zero_Spam;
|
19 |
use ZeroSpam\Modules\Registration\Registration;
|
@@ -109,6 +106,8 @@ class Plugin {
|
|
109 |
new Comments();
|
110 |
new DavidWalsh();
|
111 |
|
|
|
|
|
112 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
113 |
|
114 |
if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
|
@@ -130,9 +129,14 @@ class Plugin {
|
|
130 |
new FluentForms();
|
131 |
}
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
if (
|
138 |
! is_admin() &&
|
11 |
use ZeroSpam\Core\Access;
|
12 |
use ZeroSpam\Core\User;
|
13 |
use ZeroSpam\Core\Admin\Admin;
|
|
|
|
|
|
|
14 |
use ZeroSpam\Modules\Google;
|
15 |
use ZeroSpam\Modules\Zero_Spam;
|
16 |
use ZeroSpam\Modules\Registration\Registration;
|
106 |
new Comments();
|
107 |
new DavidWalsh();
|
108 |
|
109 |
+
new \ZeroSpam\Modules\Login\Login();
|
110 |
+
|
111 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
112 |
|
113 |
if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
|
129 |
new FluentForms();
|
130 |
}
|
131 |
|
132 |
+
/*if ( is_plugin_active( 'ninja-forms/ninja-forms.php' ) ) {
|
133 |
+
new \ZeroSpam\Modules\NinjaForms\NinjaForms();
|
134 |
+
}*/
|
135 |
+
|
136 |
+
new \ZeroSpam\Modules\StopForumSpam();
|
137 |
+
new \ZeroSpam\Modules\ProjectHoneypot();
|
138 |
+
new \ZeroSpam\Modules\ipstack();
|
139 |
+
new \ZeroSpam\Modules\IPinfoModule();
|
140 |
|
141 |
if (
|
142 |
! is_admin() &&
|
includes/templates/admin-ips.php
CHANGED
@@ -6,6 +6,15 @@
|
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
return;
|
10 |
}
|
11 |
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
9 |
+
echo sprintf(
|
10 |
+
wp_kses(
|
11 |
+
__( 'Nothing to report.', 'zerospam' ),
|
12 |
+
array(
|
13 |
+
'strong' => array(),
|
14 |
+
)
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
return;
|
19 |
}
|
20 |
|
includes/templates/admin-line-chart.php
CHANGED
@@ -6,6 +6,15 @@
|
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
return;
|
10 |
}
|
11 |
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
9 |
+
echo sprintf(
|
10 |
+
wp_kses(
|
11 |
+
__( 'Nothing to report.', 'zerospam' ),
|
12 |
+
array(
|
13 |
+
'strong' => array(),
|
14 |
+
)
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
return;
|
19 |
}
|
20 |
|
includes/templates/admin-map.php
CHANGED
@@ -6,32 +6,18 @@
|
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
return;
|
10 |
}
|
11 |
|
12 |
-
wp_enqueue_script(
|
13 |
-
'zerospam-jvectormap',
|
14 |
-
plugins_url( 'assets/js/jquery-jvectormap-2.0.5.min.js', ZEROSPAM ),
|
15 |
-
array( 'jquery' ),
|
16 |
-
'2.0.5',
|
17 |
-
false
|
18 |
-
);
|
19 |
-
|
20 |
-
wp_enqueue_script(
|
21 |
-
'zerospam-jvectormap-world',
|
22 |
-
plugins_url( 'assets/js/jquery-jvectormap-world-mill.js', ZEROSPAM ),
|
23 |
-
array( 'zerospam-jvectormap' ),
|
24 |
-
'2.0.5',
|
25 |
-
false
|
26 |
-
);
|
27 |
-
|
28 |
-
wp_enqueue_style(
|
29 |
-
'zerospam-jvectormap-world',
|
30 |
-
plugins_url( 'assets/css/jquery-jvectormap-2.0.5.css', ZEROSPAM ),
|
31 |
-
array(),
|
32 |
-
'2.0.5'
|
33 |
-
);
|
34 |
-
|
35 |
$regions_data = array();
|
36 |
$coords = array();
|
37 |
$locations = array();
|
@@ -71,6 +57,43 @@ foreach ( $entries as $key => $entry ) {
|
|
71 |
}
|
72 |
}
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
?>
|
75 |
|
76 |
<div id="world-map" style="width: 100%; height: 490px"></div>
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
9 |
+
echo sprintf(
|
10 |
+
wp_kses(
|
11 |
+
__( '<strong>Good news!</strong> There haven\'t been any detections of malicious or spammy IPs yet.', 'zerospam' ),
|
12 |
+
array(
|
13 |
+
'strong' => array(),
|
14 |
+
)
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
return;
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
$regions_data = array();
|
22 |
$coords = array();
|
23 |
$locations = array();
|
57 |
}
|
58 |
}
|
59 |
}
|
60 |
+
|
61 |
+
if ( empty( $locations ) ) :
|
62 |
+
echo sprintf(
|
63 |
+
wp_kses(
|
64 |
+
/* translators: %s: url */
|
65 |
+
__( 'Current detections have no geolocation information available. Enable ipstack and/or IPinfo on the <a href="%1$s">settings page</a>.', 'zerospam' ),
|
66 |
+
array(
|
67 |
+
'a' => array( 'href' => array() ),
|
68 |
+
)
|
69 |
+
),
|
70 |
+
esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) ),
|
71 |
+
);
|
72 |
+
return;
|
73 |
+
endif;
|
74 |
+
|
75 |
+
wp_enqueue_script(
|
76 |
+
'zerospam-jvectormap',
|
77 |
+
plugins_url( 'assets/js/jquery-jvectormap-2.0.5.min.js', ZEROSPAM ),
|
78 |
+
array( 'jquery' ),
|
79 |
+
'2.0.5',
|
80 |
+
false
|
81 |
+
);
|
82 |
+
|
83 |
+
wp_enqueue_script(
|
84 |
+
'zerospam-jvectormap-world',
|
85 |
+
plugins_url( 'assets/js/jquery-jvectormap-world-mill.js', ZEROSPAM ),
|
86 |
+
array( 'zerospam-jvectormap' ),
|
87 |
+
'2.0.5',
|
88 |
+
false
|
89 |
+
);
|
90 |
+
|
91 |
+
wp_enqueue_style(
|
92 |
+
'zerospam-jvectormap-world',
|
93 |
+
plugins_url( 'assets/css/jquery-jvectormap-2.0.5.css', ZEROSPAM ),
|
94 |
+
array(),
|
95 |
+
'2.0.5'
|
96 |
+
);
|
97 |
?>
|
98 |
|
99 |
<div id="world-map" style="width: 100%; height: 490px"></div>
|
includes/templates/admin-pie.php
CHANGED
@@ -6,24 +6,18 @@
|
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
return;
|
10 |
}
|
11 |
|
12 |
-
wp_enqueue_script(
|
13 |
-
'zerospam-chart',
|
14 |
-
plugins_url( 'assets/js/Chart.bundle.min.js', ZEROSPAM ),
|
15 |
-
array( 'jquery' ),
|
16 |
-
'2.9.4',
|
17 |
-
false
|
18 |
-
);
|
19 |
-
|
20 |
-
wp_enqueue_style(
|
21 |
-
'zerospam-chart',
|
22 |
-
plugins_url( 'assets/css/Chart.min.css', ZEROSPAM ),
|
23 |
-
array(),
|
24 |
-
'2.9.4'
|
25 |
-
);
|
26 |
-
|
27 |
$limit = 10;
|
28 |
|
29 |
$predefined_colors = array(
|
@@ -55,6 +49,35 @@ foreach ( $entries as $key => $entry ) :
|
|
55 |
endif;
|
56 |
endforeach;
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
if ( $countries ) :
|
59 |
arsort( $countries );
|
60 |
endif;
|
6 |
*/
|
7 |
|
8 |
if ( empty( $entries ) ) {
|
9 |
+
echo sprintf(
|
10 |
+
wp_kses(
|
11 |
+
__( 'Nothing to report yet.', 'zerospam' ),
|
12 |
+
array(
|
13 |
+
'strong' => array(),
|
14 |
+
)
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
return;
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
$limit = 10;
|
22 |
|
23 |
$predefined_colors = array(
|
49 |
endif;
|
50 |
endforeach;
|
51 |
|
52 |
+
if ( empty( $countries ) ) :
|
53 |
+
echo sprintf(
|
54 |
+
wp_kses(
|
55 |
+
/* translators: %s: url */
|
56 |
+
__( 'No geolocation information available, enable ipstack and/or IPinfo on the <a href="%1$s">settings page</a>.', 'zerospam' ),
|
57 |
+
array(
|
58 |
+
'a' => array( 'href' => array() ),
|
59 |
+
)
|
60 |
+
),
|
61 |
+
esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) ),
|
62 |
+
);
|
63 |
+
return;
|
64 |
+
endif;
|
65 |
+
|
66 |
+
wp_enqueue_script(
|
67 |
+
'zerospam-chart',
|
68 |
+
plugins_url( 'assets/js/Chart.bundle.min.js', ZEROSPAM ),
|
69 |
+
array( 'jquery' ),
|
70 |
+
'2.9.4',
|
71 |
+
false
|
72 |
+
);
|
73 |
+
|
74 |
+
wp_enqueue_style(
|
75 |
+
'zerospam-chart',
|
76 |
+
plugins_url( 'assets/css/Chart.min.css', ZEROSPAM ),
|
77 |
+
array(),
|
78 |
+
'2.9.4'
|
79 |
+
);
|
80 |
+
|
81 |
if ( $countries ) :
|
82 |
arsort( $countries );
|
83 |
endif;
|
modules/class-projecthoneypot.php
ADDED
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Project Honeypot httpBL class.
|
4 |
+
*
|
5 |
+
* @package ZeroSpam
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace ZeroSpam\Modules;
|
9 |
+
|
10 |
+
// Security Note: Blocks direct access to the plugin PHP files.
|
11 |
+
defined( 'ABSPATH' ) || die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Project Honeypot httpBL
|
15 |
+
*/
|
16 |
+
class ProjectHoneypot {
|
17 |
+
/**
|
18 |
+
* Constructor.
|
19 |
+
*/
|
20 |
+
public function __construct() {
|
21 |
+
add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
|
22 |
+
add_filter( 'zerospam_settings', array( $this, 'settings' ) );
|
23 |
+
|
24 |
+
if ( \ZeroSpam\Core\Access::process() ) {
|
25 |
+
add_filter( 'zerospam_access_checks', array( $this, 'access_check' ), 10, 3 );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Project Honeypot access check
|
31 |
+
*
|
32 |
+
* @param array $access_checks Current access checks array.
|
33 |
+
* @param string $user_ip IP address to check.
|
34 |
+
* @param array $settings Plugin settings.
|
35 |
+
*/
|
36 |
+
public function access_check( $access_checks, $user_ip, $settings ) {
|
37 |
+
$access_checks['project_honeypot'] = array(
|
38 |
+
'blocked' => false,
|
39 |
+
);
|
40 |
+
|
41 |
+
if ( empty( $settings['project_honeypot']['value'] ) || 'enabled' !== $settings['project_honeypot']['value'] ) {
|
42 |
+
return $access_checks;
|
43 |
+
}
|
44 |
+
|
45 |
+
$response = self::query( $user_ip );
|
46 |
+
if ( $response ) {
|
47 |
+
if (
|
48 |
+
! empty( $response['threat_score'] ) &&
|
49 |
+
! empty( $settings['project_honeypot_score_min']['value'] ) &&
|
50 |
+
floatval( $response['threat_score'] ) >= floatval( $settings['project_honeypot_score_min']['value'] )
|
51 |
+
) {
|
52 |
+
$access_checks['project_honeypot']['blocked'] = true;
|
53 |
+
$access_checks['project_honeypot']['type'] = 'blocked';
|
54 |
+
$access_checks['project_honeypot']['details'] = $response;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
return $access_checks;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Query the Project Honeypot API
|
63 |
+
*
|
64 |
+
* @param string $ip IP address to query.
|
65 |
+
*/
|
66 |
+
public function query( $ip ) {
|
67 |
+
$settings = \ZeroSpam\Core\Settings::get_settings();
|
68 |
+
|
69 |
+
// Check that an access key has been provided.
|
70 |
+
if ( empty( $settings['project_honeypot_access_key']['value'] ) || ! $ip ) {
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
|
74 |
+
$cache_key = \ZeroSpam\Core\Utilities::cache_key(
|
75 |
+
array(
|
76 |
+
'project_honeypot',
|
77 |
+
$ip,
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
$response = wp_cache_get( $cache_key );
|
82 |
+
if ( false === $response ) {
|
83 |
+
$timeout = 5;
|
84 |
+
if ( ! empty( $settings['project_honeypot_timeout']['value'] ) ) {
|
85 |
+
$timeout = intval( $settings['project_honeypot_timeout']['value'] );
|
86 |
+
}
|
87 |
+
|
88 |
+
$octets = explode( '.', $ip );
|
89 |
+
krsort( $octets );
|
90 |
+
|
91 |
+
$reversed_ip = implode( '.', $octets );
|
92 |
+
|
93 |
+
$endpoint = $settings['project_honeypot_access_key']['value'] . '.' . $reversed_ip . '.dnsbl.httpbl.org';
|
94 |
+
$dns_array = dns_get_record( $endpoint, DNS_A );
|
95 |
+
|
96 |
+
if ( ! isset( $dns_array[0]['ip'] ) ) {
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
|
100 |
+
$results = explode( '.', $dns_array[0]['ip'] );
|
101 |
+
if ( '127' !== $results[0] ) {
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
|
105 |
+
$response = array(
|
106 |
+
'last_activity' => $results[1],
|
107 |
+
'threat_score' => $results[2],
|
108 |
+
'categories' => $results[3],
|
109 |
+
);
|
110 |
+
|
111 |
+
switch ( $response['categories'] ) {
|
112 |
+
case 0:
|
113 |
+
$categories = array( 'Search Engine' );
|
114 |
+
break;
|
115 |
+
case 1:
|
116 |
+
$categories = array( 'Suspicious' );
|
117 |
+
break;
|
118 |
+
case 2:
|
119 |
+
$categories = array( 'Harvester' );
|
120 |
+
break;
|
121 |
+
case 3:
|
122 |
+
$categories = array( 'Suspicious', 'Harvester' );
|
123 |
+
break;
|
124 |
+
case 4:
|
125 |
+
$categories = array( 'Comment Spammer' );
|
126 |
+
break;
|
127 |
+
case 5:
|
128 |
+
$categories = array( 'Suspicious', 'Comment Spammer' );
|
129 |
+
break;
|
130 |
+
case 6:
|
131 |
+
$categories = array( 'Harvester', 'Comment Spammer' );
|
132 |
+
break;
|
133 |
+
case 7:
|
134 |
+
$categories = array( 'Suspicious', 'Harvester', 'Comment Spammer' );
|
135 |
+
break;
|
136 |
+
default:
|
137 |
+
$categories = array( 'Reserved for Future Use' );
|
138 |
+
break;
|
139 |
+
}
|
140 |
+
|
141 |
+
$response['categories'] = $categories;
|
142 |
+
|
143 |
+
$expiration = 14 * DAY_IN_SECONDS;
|
144 |
+
if ( ! empty( $settings['project_honeypot_cache']['value'] ) ) {
|
145 |
+
$expiration = $settings['project_honeypot_cache']['value'] * DAY_IN_SECONDS;
|
146 |
+
}
|
147 |
+
wp_cache_set( $cache_key, $response, 'zerospam', $expiration );
|
148 |
+
}
|
149 |
+
|
150 |
+
return $response;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Project Honeypot sections
|
155 |
+
*
|
156 |
+
* @param array $sections Array of available setting sections.
|
157 |
+
*/
|
158 |
+
public function sections( $sections ) {
|
159 |
+
$sections['project_honeypot'] = array(
|
160 |
+
'title' => __( 'Project Honeypot Integration', 'zerospam' ),
|
161 |
+
);
|
162 |
+
|
163 |
+
return $sections;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Project Honeypot settings
|
168 |
+
*
|
169 |
+
* @param array $settings Array of available settings.
|
170 |
+
*/
|
171 |
+
public function settings( $settings ) {
|
172 |
+
$options = get_option( 'wpzerospam' );
|
173 |
+
|
174 |
+
$settings['project_honeypot'] = array(
|
175 |
+
'title' => __( 'Project Honeypot', 'zerospam' ),
|
176 |
+
'section' => 'project_honeypot',
|
177 |
+
'type' => 'checkbox',
|
178 |
+
'options' => array(
|
179 |
+
'enabled' => __( 'Enabled', 'zerospam' ),
|
180 |
+
),
|
181 |
+
'desc' => sprintf(
|
182 |
+
wp_kses(
|
183 |
+
/* translators: %s: url */
|
184 |
+
__( 'Checks user IPs against <a href="%s" target="_blank" rel="noopener noreferrer">Project Honeypot</a>\'s blacklist.', 'zerospam' ),
|
185 |
+
array(
|
186 |
+
'strong' => array(),
|
187 |
+
'a' => array(
|
188 |
+
'target' => array(),
|
189 |
+
'href' => array(),
|
190 |
+
'rel' => array(),
|
191 |
+
),
|
192 |
+
)
|
193 |
+
),
|
194 |
+
esc_url( 'https://www.projecthoneypot.org/index.php' )
|
195 |
+
),
|
196 |
+
'value' => ! empty( $options['project_honeypot'] ) ? $options['project_honeypot'] : false,
|
197 |
+
'recommended' => 'enabled',
|
198 |
+
);
|
199 |
+
|
200 |
+
$settings['project_honeypot_access_key'] = array(
|
201 |
+
'title' => __( 'Project Honeypot Access Key', 'zerospam' ),
|
202 |
+
'desc' => sprintf(
|
203 |
+
wp_kses(
|
204 |
+
/* translators: %s: url */
|
205 |
+
__( 'Enter your <a href="%1$s" target="_blank" rel="noopener noreferrer">Project Honeypot</a> access key. Don\'t have an access key? <a href="%2$s" target="_blank" rel="noopener noreferrer"><strong>Get one for free!</strong></a>', 'zerospam' ),
|
206 |
+
array(
|
207 |
+
'strong' => array(),
|
208 |
+
'a' => array(
|
209 |
+
'target' => array(),
|
210 |
+
'href' => array(),
|
211 |
+
'rel' => array(),
|
212 |
+
),
|
213 |
+
)
|
214 |
+
),
|
215 |
+
esc_url( 'https://www.projecthoneypot.org/' ),
|
216 |
+
esc_url( 'https://www.projecthoneypot.org/create_account.php' )
|
217 |
+
),
|
218 |
+
'section' => 'project_honeypot',
|
219 |
+
'type' => 'text',
|
220 |
+
'field_class' => 'regular-text',
|
221 |
+
'placeholder' => __( 'Enter your Project Honeypot access key.', 'zerospam' ),
|
222 |
+
'value' => ! empty( $options['project_honeypot_access_key'] ) ? $options['project_honeypot_access_key'] : false,
|
223 |
+
);
|
224 |
+
|
225 |
+
$settings['project_honeypot_cache'] = array(
|
226 |
+
'title' => __( 'Project Honeypot Cache Expiration', 'zerospam' ),
|
227 |
+
'section' => 'project_honeypot',
|
228 |
+
'type' => 'number',
|
229 |
+
'field_class' => 'small-text',
|
230 |
+
'suffix' => __( 'day(s)', 'zerospam' ),
|
231 |
+
'placeholder' => __( WEEK_IN_SECONDS, 'zerospam' ),
|
232 |
+
'min' => 0,
|
233 |
+
'desc' => __( 'Recommended setting is 14 days. Setting to high could result in outdated information, too low could cause a decrease in performance.', 'zerospam' ),
|
234 |
+
'value' => ! empty( $options['project_honeypot_cache'] ) ? $options['project_honeypot_cache'] : 14,
|
235 |
+
'recommended' => 14,
|
236 |
+
);
|
237 |
+
|
238 |
+
$settings['project_honeypot_score_min'] = array(
|
239 |
+
'title' => __( 'Project Honeypot Threat Score Minimum', 'zerospam' ),
|
240 |
+
'section' => 'project_honeypot',
|
241 |
+
'type' => 'number',
|
242 |
+
'field_class' => 'small-text',
|
243 |
+
'placeholder' => __( '50', 'zerospam' ),
|
244 |
+
'min' => 0,
|
245 |
+
'max' => 255,
|
246 |
+
'step' => 1,
|
247 |
+
'desc' => sprintf(
|
248 |
+
wp_kses(
|
249 |
+
/* translators: %s: url */
|
250 |
+
__( 'Recommended setting is 50. Minimum <a href="%s" target="_blank" rel="noopener noreferrer">threat score</a> an IP must meet before being blocked. Setting this too low could cause users to be blocked that shouldn\'t be.', 'zerospam' ),
|
251 |
+
array(
|
252 |
+
'a' => array(
|
253 |
+
'target' => array(),
|
254 |
+
'href' => array(),
|
255 |
+
'rel' => array(),
|
256 |
+
),
|
257 |
+
)
|
258 |
+
),
|
259 |
+
esc_url( 'https://www.projecthoneypot.org/threat_info.php?utm_source=wordpresszerospam&utm_medium=admin_link&utm_campaign=wordpresszerospam' )
|
260 |
+
),
|
261 |
+
'value' => ! empty( $options['project_honeypot_score_min'] ) ? $options['project_honeypot_score_min'] : 50,
|
262 |
+
'recommended' => 50,
|
263 |
+
);
|
264 |
+
|
265 |
+
return $settings;
|
266 |
+
}
|
267 |
+
}
|
modules/class-stopforumspam.php
CHANGED
@@ -130,7 +130,7 @@ class StopForumSpam {
|
|
130 |
),
|
131 |
)
|
132 |
),
|
133 |
-
esc_url( 'https://www.stopforumspam.com/usage
|
134 |
),
|
135 |
'value' => ! empty( $options['stop_forum_spam_confidence_min'] ) ? $options['stop_forum_spam_confidence_min'] : 50,
|
136 |
'recommended' => 50,
|
130 |
),
|
131 |
)
|
132 |
),
|
133 |
+
esc_url( 'https://www.stopforumspam.com/usage?utm_source=wordpresszerospam&utm_medium=admin_link&utm_campaign=wordpresszerospam' )
|
134 |
),
|
135 |
'value' => ! empty( $options['stop_forum_spam_confidence_min'] ) ? $options['stop_forum_spam_confidence_min'] : 50,
|
136 |
'recommended' => 50,
|
modules/class-zerospam.php
CHANGED
@@ -20,7 +20,7 @@ class Zero_Spam {
|
|
20 |
/**
|
21 |
* The zerospam.org API endpoint
|
22 |
*/
|
23 |
-
const API_ENDPOINT = ZEROSPAM_URL . 'wp-json/zerospam/
|
24 |
|
25 |
/**
|
26 |
* Constructor
|
@@ -29,9 +29,6 @@ class Zero_Spam {
|
|
29 |
add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
|
30 |
add_filter( 'zerospam_settings', array( $this, 'settings' ) );
|
31 |
|
32 |
-
// Fires when a user is blocked from accessing the site.
|
33 |
-
add_action( 'zerospam_share_blocked', array( $this, 'share_blocked' ), 10, 1 );
|
34 |
-
|
35 |
// Fires when a user submission has been detected as spam.
|
36 |
add_action( 'zerospam_share_detection', array( $this, 'share_detection' ), 10, 1 );
|
37 |
}
|
@@ -212,91 +209,4 @@ class Zero_Spam {
|
|
212 |
|
213 |
wp_remote_post( $endpoint, $args );
|
214 |
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Share blocked details with zerospam.org
|
218 |
-
*
|
219 |
-
* @param array $access Contains all access details.
|
220 |
-
*/
|
221 |
-
public function share_blocked( $access ) {
|
222 |
-
$endpoint = self::API_ENDPOINT . 'add-blocked/';
|
223 |
-
|
224 |
-
// Only send details if the user was blocked.
|
225 |
-
if ( empty( $access['blocked'] ) ) {
|
226 |
-
return false;
|
227 |
-
}
|
228 |
-
|
229 |
-
$api_data = array( 'checks' => array() );
|
230 |
-
$ip = ! empty( $access['ip'] ) ? $access['ip'] : false;
|
231 |
-
$details = ! empty( $access['details'] ) ? $access['details'] : false;
|
232 |
-
|
233 |
-
// Require an IP address.
|
234 |
-
if ( ! $ip ) {
|
235 |
-
return false;
|
236 |
-
}
|
237 |
-
|
238 |
-
$api_data['user_ip'] = $ip;
|
239 |
-
|
240 |
-
// Attempt to get the geolocation information.
|
241 |
-
$api_data['location'] = \ZeroSpam\Core\Utilities::geolocation( $ip );
|
242 |
-
|
243 |
-
// Loop through the individual access checks to determine what should be sent.
|
244 |
-
$ignore_failed_reasons = array(
|
245 |
-
'blocked_country_code',
|
246 |
-
'blocked_region_code',
|
247 |
-
'blocked_city',
|
248 |
-
'blocked_zip',
|
249 |
-
);
|
250 |
-
|
251 |
-
foreach ( $details as $access_check_key => $check_details ) {
|
252 |
-
// Check if the user failed the access check.
|
253 |
-
if ( ! empty( $check_details['blocked'] ) ) {
|
254 |
-
// Check if came from blocked table.
|
255 |
-
if ( 'blocked' === $access_check_key ) {
|
256 |
-
// Check if one of the 'failed' reasons should be shared.
|
257 |
-
if (
|
258 |
-
! empty( $check_details['details'] ) &&
|
259 |
-
! empty( $check_details['details']['failed'] ) &&
|
260 |
-
in_array( $check_details['details']['failed'], $ignore_failed_reasons, true )
|
261 |
-
) {
|
262 |
-
// Doesn't need to be sent.
|
263 |
-
continue;
|
264 |
-
} else {
|
265 |
-
// Send it.
|
266 |
-
$api_data['checks'][ $access_check_key ] = array(
|
267 |
-
'type' => $check_details['type'],
|
268 |
-
);
|
269 |
-
|
270 |
-
// Add additional details if available.
|
271 |
-
if ( ! empty( $check_details['details'] && is_array( $check_details['details'] ) ) ) {
|
272 |
-
//$api_data['checks'][ $access_check_key ]['details']
|
273 |
-
}
|
274 |
-
}
|
275 |
-
} else {
|
276 |
-
// Not from the blocked table, send it.
|
277 |
-
$api_data['checks'][ $access_check_key ] = array(
|
278 |
-
'type' => $check_details['type'],
|
279 |
-
);
|
280 |
-
|
281 |
-
// Add additional details if available.
|
282 |
-
if ( ! empty( $check_details['details'] && is_array( $check_details['details'] ) ) ) {
|
283 |
-
//$api_data['checks'][ $access_check_key ]['details']
|
284 |
-
}
|
285 |
-
}
|
286 |
-
}
|
287 |
-
}
|
288 |
-
|
289 |
-
// Only query the API if there's data to be sent.
|
290 |
-
if ( ! empty( $api_data['checks'] ) ) {
|
291 |
-
$global_data = self::global_api_data();
|
292 |
-
$api_data = array_merge( $api_data, $global_data );
|
293 |
-
|
294 |
-
// Send the data to zerospam.org.
|
295 |
-
$args = array(
|
296 |
-
'body' => $api_data,
|
297 |
-
);
|
298 |
-
|
299 |
-
wp_remote_post( $endpoint, $args );
|
300 |
-
}
|
301 |
-
}
|
302 |
}
|
20 |
/**
|
21 |
* The zerospam.org API endpoint
|
22 |
*/
|
23 |
+
const API_ENDPOINT = ZEROSPAM_URL . 'wp-json/zerospam/v2/';
|
24 |
|
25 |
/**
|
26 |
* Constructor
|
29 |
add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
|
30 |
add_filter( 'zerospam_settings', array( $this, 'settings' ) );
|
31 |
|
|
|
|
|
|
|
32 |
// Fires when a user submission has been detected as spam.
|
33 |
add_action( 'zerospam_share_detection', array( $this, 'share_detection' ), 10, 1 );
|
34 |
}
|
209 |
|
210 |
wp_remote_post( $endpoint, $args );
|
211 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
}
|
modules/davidwalsh/assets/js/davidwalsh.js
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
};
|
34 |
|
35 |
$(function() {
|
36 |
-
var selectors = '#commentform, #registerform, .wpforms-form, .wpcf7-form, .frm-fluent-form';
|
37 |
if (typeof ZeroSpamDavidWalsh.selectors != "undefined" && ZeroSpamDavidWalsh.selectors ) {
|
38 |
selectors += ',' + ZeroSpamDavidWalsh.selectors
|
39 |
}
|
33 |
};
|
34 |
|
35 |
$(function() {
|
36 |
+
var selectors = '#commentform, #registerform, .wpforms-form, .wpcf7-form, .frm-fluent-form, #loginform';
|
37 |
if (typeof ZeroSpamDavidWalsh.selectors != "undefined" && ZeroSpamDavidWalsh.selectors ) {
|
38 |
selectors += ',' + ZeroSpamDavidWalsh.selectors
|
39 |
}
|
modules/davidwalsh/class-davidwalsh.php
CHANGED
@@ -31,14 +31,16 @@ class DavidWalsh {
|
|
31 |
// See https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/.
|
32 |
add_action( 'zerospam_wpcf7_enqueue_scripts', array( $this, 'enqueue_script' ) );
|
33 |
add_action( 'zerospam_register_form', array( $this, 'enqueue_script' ) );
|
34 |
-
add_action( '
|
35 |
-
add_action( '
|
|
|
36 |
|
37 |
add_filter( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ), 10, 1 );
|
38 |
add_filter( 'zerospam_registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
|
39 |
add_filter( 'zerospam_preprocess_cf7_submission', array( $this, 'preprocess_cf7_submission' ), 10, 2 );
|
40 |
-
|
41 |
add_filter( 'zerospam_preprocess_fluentform_submission', array( $this, 'preprocess_fluentform_submission' ), 10, 4 );
|
|
|
42 |
}
|
43 |
}
|
44 |
|
@@ -49,6 +51,25 @@ class DavidWalsh {
|
|
49 |
wp_enqueue_script( 'zerospam-davidwalsh' );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
/**
|
53 |
* Preprocesses a Fluent Form submission.
|
54 |
*
|
@@ -68,6 +89,24 @@ class DavidWalsh {
|
|
68 |
return $errors;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* Preprocess CF7 submission.
|
73 |
*/
|
@@ -97,32 +136,6 @@ class DavidWalsh {
|
|
97 |
return $result;
|
98 |
}
|
99 |
|
100 |
-
/**
|
101 |
-
* Preprocess WPForms submission
|
102 |
-
*/
|
103 |
-
public function preprocess_wpforms_submission( $form_data ) {
|
104 |
-
if ( empty( $_REQUEST['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $_REQUEST['zerospam_david_walsh_key'] ) {
|
105 |
-
$message = \ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
|
106 |
-
wpforms()->process->errors[ $form_data['id'] ]['header'] = $message;
|
107 |
-
|
108 |
-
$details = array(
|
109 |
-
'form_data' => $form_data,
|
110 |
-
'failed' => 'david_walsh',
|
111 |
-
);
|
112 |
-
|
113 |
-
// Log if enabled.
|
114 |
-
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_wpforms' ) ) {
|
115 |
-
\ZeroSpam\Includes\DB::log( 'wpforms', $details );
|
116 |
-
}
|
117 |
-
|
118 |
-
// Share the detection if enabled.
|
119 |
-
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
|
120 |
-
$details['type'] = 'wpforms';
|
121 |
-
do_action( 'zerospam_share_detection', $details );
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
/**
|
127 |
* Preprocess registrations
|
128 |
*
|
31 |
// See https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/.
|
32 |
add_action( 'zerospam_wpcf7_enqueue_scripts', array( $this, 'enqueue_script' ) );
|
33 |
add_action( 'zerospam_register_form', array( $this, 'enqueue_script' ) );
|
34 |
+
add_action( 'zerospam_wpforms_scripts', array( $this, 'enqueue_script' ) );
|
35 |
+
add_action( 'zerospam_fluentforms_scripts', array( $this, 'enqueue_script' ) );
|
36 |
+
add_action( 'zerospam_login_scripts', array( $this, 'enqueue_script' ) );
|
37 |
|
38 |
add_filter( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ), 10, 1 );
|
39 |
add_filter( 'zerospam_registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
|
40 |
add_filter( 'zerospam_preprocess_cf7_submission', array( $this, 'preprocess_cf7_submission' ), 10, 2 );
|
41 |
+
add_filter( 'zerospam_preprocess_wpforms_submission', array( $this, 'preprocess_wpforms_submission' ), 10, 3 );
|
42 |
add_filter( 'zerospam_preprocess_fluentform_submission', array( $this, 'preprocess_fluentform_submission' ), 10, 4 );
|
43 |
+
add_filter( 'zerospam_preprocess_login_attempt', array( $this, 'preprocess_login_attempt' ), 10, 4 );
|
44 |
}
|
45 |
}
|
46 |
|
51 |
wp_enqueue_script( 'zerospam-davidwalsh' );
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Preprocesses a login attempt.
|
56 |
+
*
|
57 |
+
* @param array $errors Array of submission errors.
|
58 |
+
* @param WP_User|WP_Error $user WP_User or WP_Error object if a previous callback failed authentication.
|
59 |
+
* @param string $password Password to check against the user.
|
60 |
+
* @param array $post Form post array.
|
61 |
+
*/
|
62 |
+
public function preprocess_login_attempt( $errors, $user, $password, $post ) {
|
63 |
+
if ( empty( $post['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $post['zerospam_david_walsh_key'] ) {
|
64 |
+
// Failed the David Walsh check.
|
65 |
+
$error_message = \ZeroSpam\Core\Utilities::detection_message( 'login_spam_message' );
|
66 |
+
|
67 |
+
$errors['zerospam_david_walsh'] = $error_message;
|
68 |
+
}
|
69 |
+
|
70 |
+
return $errors;
|
71 |
+
}
|
72 |
+
|
73 |
/**
|
74 |
* Preprocesses a Fluent Form submission.
|
75 |
*
|
89 |
return $errors;
|
90 |
}
|
91 |
|
92 |
+
/**
|
93 |
+
* Preprocess a WPForms submission.
|
94 |
+
*
|
95 |
+
* @param array $errors Array of submission errors.
|
96 |
+
* @param array $form_data Submitted form values.
|
97 |
+
* @param array $post Form post array.
|
98 |
+
*/
|
99 |
+
public function preprocess_wpforms_submission( $errors, $form_data, $post ) {
|
100 |
+
if ( empty( $post['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $post['zerospam_david_walsh_key'] ) {
|
101 |
+
// Failed the David Walsh check.
|
102 |
+
$error_message = \ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
|
103 |
+
|
104 |
+
$errors['zerospam_david_walsh'] = $error_message;
|
105 |
+
}
|
106 |
+
|
107 |
+
return $errors;
|
108 |
+
}
|
109 |
+
|
110 |
/**
|
111 |
* Preprocess CF7 submission.
|
112 |
*/
|
136 |
return $result;
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
/**
|
140 |
* Preprocess registrations
|
141 |
*
|
modules/fluentforms/class-fluentforms.php
CHANGED
@@ -23,8 +23,8 @@ class FluentForms {
|
|
23 |
add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
|
24 |
|
25 |
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'verify_fluentforms' ) && \ZeroSpam\Core\Access::process() ) {
|
26 |
-
//
|
27 |
-
add_action( 'fluentform_load_form_assets', array( $this, '
|
28 |
|
29 |
// Adds Zero Spam's honeypot field.
|
30 |
add_filter( 'fluentform_rendering_form', array( $this, 'render_form' ), 10, 1 );
|
@@ -40,8 +40,8 @@ class FluentForms {
|
|
40 |
/**
|
41 |
* Fires before a form is rendered.
|
42 |
*/
|
43 |
-
public function
|
44 |
-
do_action( '
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -189,7 +189,7 @@ class FluentForms {
|
|
189 |
* @param array $types Array of available detection types.
|
190 |
*/
|
191 |
public function types( $types ) {
|
192 |
-
$types['
|
193 |
|
194 |
return $types;
|
195 |
}
|
23 |
add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
|
24 |
|
25 |
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'verify_fluentforms' ) && \ZeroSpam\Core\Access::process() ) {
|
26 |
+
// Load scripts.
|
27 |
+
add_action( 'fluentform_load_form_assets', array( $this, 'scripts' ), 10 );
|
28 |
|
29 |
// Adds Zero Spam's honeypot field.
|
30 |
add_filter( 'fluentform_rendering_form', array( $this, 'render_form' ), 10, 1 );
|
40 |
/**
|
41 |
* Fires before a form is rendered.
|
42 |
*/
|
43 |
+
public function scripts() {
|
44 |
+
do_action( 'zerospam_fluentforms_scripts' );
|
45 |
}
|
46 |
|
47 |
/**
|
189 |
* @param array $types Array of available detection types.
|
190 |
*/
|
191 |
public function types( $types ) {
|
192 |
+
$types['fluent_form'] = __( 'Fluent Form', 'zerospam' );
|
193 |
|
194 |
return $types;
|
195 |
}
|
modules/login/class-login.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Login class
|
4 |
+
*
|
5 |
+
* @package ZeroSpam
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace ZeroSpam\Modules\Login;
|
9 |
+
|
10 |
+
// Security Note: Blocks direct access to the plugin PHP files.
|
11 |
+
defined( 'ABSPATH' ) || die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Login
|
15 |
+
*/
|
16 |
+
class Login {
|
17 |
+
/**
|
18 |
+
* Add-on constructor
|
19 |
+
*/
|
20 |
+
public function __construct() {
|
21 |
+
add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
|
22 |
+
add_filter( 'zerospam_settings', array( $this, 'settings' ) );
|
23 |
+
add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
|
24 |
+
|
25 |
+
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'verify_login' ) && \ZeroSpam\Core\Access::process() ) {
|
26 |
+
// Adds Zero Spam's honeypot field.
|
27 |
+
add_action( 'login_form', array( $this, 'add_honeypot' ), 10 );
|
28 |
+
|
29 |
+
// Processes the form.
|
30 |
+
add_filter( 'wp_authenticate_user', array( $this, 'process_form' ), 10, 2 );
|
31 |
+
|
32 |
+
// Load scripts.
|
33 |
+
add_action( 'login_enqueue_scripts', array( $this, 'scripts' ), 10 );
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Load the add-on scripts.
|
39 |
+
*/
|
40 |
+
public function scripts() {
|
41 |
+
do_action( 'zerospam_login_scripts' );
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Adds Zero Spam's honeypot field.
|
46 |
+
*/
|
47 |
+
public function add_honeypot() {
|
48 |
+
// @codingStandardsIgnoreLine
|
49 |
+
echo \ZeroSpam\Core\Utilities::honeypot_field();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Processes a login attempt.
|
54 |
+
*
|
55 |
+
* @param WP_User|WP_Error $user WP_User or WP_Error object if a previous callback failed authentication.
|
56 |
+
* @param string $password Password to check against the user.
|
57 |
+
*/
|
58 |
+
public function process_form( $user, $password ) {
|
59 |
+
// Check Zero Spam's honeypot field.
|
60 |
+
$honeypot_field_name = \ZeroSpam\Core\Utilities::get_honeypot();
|
61 |
+
|
62 |
+
// Get the error message.
|
63 |
+
$error_message = \ZeroSpam\Core\Utilities::detection_message( 'login_spam_message' );
|
64 |
+
|
65 |
+
// Create the details array for logging & sharing data.
|
66 |
+
$details = array(
|
67 |
+
'user' => $user,
|
68 |
+
'type' => 'login',
|
69 |
+
);
|
70 |
+
|
71 |
+
// Begin validation checks.
|
72 |
+
$validation_errors = array();
|
73 |
+
|
74 |
+
// @codingStandardsIgnoreLine
|
75 |
+
if ( isset( $_POST[ $honeypot_field_name ] ) && ! empty( $_POST[ $honeypot_field_name ] ) ) {
|
76 |
+
// Failed the honeypot check.
|
77 |
+
$details['failed'] = 'honeypot';
|
78 |
+
|
79 |
+
$validation_errors[] = 'honeypot';
|
80 |
+
}
|
81 |
+
|
82 |
+
// Fire hook for additional validation (ex. David Walsh script).
|
83 |
+
// @codingStandardsIgnoreLine
|
84 |
+
$errors = apply_filters( 'zerospam_preprocess_login_attempt', array(), $user, $password, $_POST );
|
85 |
+
|
86 |
+
if ( ! empty( $errors ) ) {
|
87 |
+
foreach ( $errors as $key => $message ) {
|
88 |
+
$validation_errors[] = str_replace( 'zerospam_', '', $key );
|
89 |
+
|
90 |
+
$details['failed'] = str_replace( 'zerospam_', '', $key );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( ! empty( $validation_errors ) ) {
|
95 |
+
// Failed validations, log & send details if enabled.
|
96 |
+
foreach ( $validation_errors as $key => $fail ) {
|
97 |
+
$details['failed'] = $fail;
|
98 |
+
|
99 |
+
// Log the detection if enabled.
|
100 |
+
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_logins' ) ) {
|
101 |
+
\ZeroSpam\Includes\DB::log( 'login', $details );
|
102 |
+
}
|
103 |
+
|
104 |
+
// Share the detection if enabled.
|
105 |
+
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
|
106 |
+
do_action( 'zerospam_share_detection', $details );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
return new \WP_Error( 'failed_zerospam', $error_message );
|
111 |
+
}
|
112 |
+
|
113 |
+
return $user;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Add to the types array
|
118 |
+
*
|
119 |
+
* @param array $types Array of available detection types.
|
120 |
+
*/
|
121 |
+
public function types( $types ) {
|
122 |
+
$types['login'] = __( 'Login Attempt', 'zerospam' );
|
123 |
+
|
124 |
+
return $types;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Admin section
|
129 |
+
*
|
130 |
+
* @param array $sections Array of available setting sections.
|
131 |
+
*/
|
132 |
+
public function sections( $sections ) {
|
133 |
+
$sections['login'] = array(
|
134 |
+
'title' => __( 'User Login Integration', 'zerospam' ),
|
135 |
+
);
|
136 |
+
|
137 |
+
return $sections;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Admin settings
|
142 |
+
*
|
143 |
+
* @param array $settings Array of available settings.
|
144 |
+
*/
|
145 |
+
public function settings( $settings ) {
|
146 |
+
$options = get_option( 'wpzerospam' );
|
147 |
+
|
148 |
+
$settings['verify_login'] = array(
|
149 |
+
'title' => __( 'Protect Login Attempts', 'zerospam' ),
|
150 |
+
'section' => 'login',
|
151 |
+
'type' => 'checkbox',
|
152 |
+
'options' => array(
|
153 |
+
'enabled' => __( 'Monitor login attempts for malicious or automated spambots.', 'zerospam' ),
|
154 |
+
),
|
155 |
+
'value' => ! empty( $options['verify_login'] ) ? $options['verify_login'] : false,
|
156 |
+
'recommended' => 'enabled',
|
157 |
+
);
|
158 |
+
|
159 |
+
$message = __( 'You have been flagged as spam/malicious by WordPress Zero Spam.', 'zerospam' );
|
160 |
+
|
161 |
+
$settings['login_spam_message'] = array(
|
162 |
+
'title' => __( 'Spam/Malicious Message', 'zerospam' ),
|
163 |
+
'desc' => __( 'When login protection is enabled, the message displayed to the user when a submission has been detected as spam/malicious.', 'zerospam' ),
|
164 |
+
'section' => 'login',
|
165 |
+
'type' => 'text',
|
166 |
+
'field_class' => 'large-text',
|
167 |
+
'placeholder' => $message,
|
168 |
+
'value' => ! empty( $options['login_spam_message'] ) ? $options['login_spam_message'] : $message,
|
169 |
+
'recommended' => $message,
|
170 |
+
);
|
171 |
+
|
172 |
+
$settings['log_blocked_logins'] = array(
|
173 |
+
'title' => __( 'Log Blocked Login Attempts', 'zerospam' ),
|
174 |
+
'section' => 'login',
|
175 |
+
'type' => 'checkbox',
|
176 |
+
'desc' => wp_kses(
|
177 |
+
__( 'Enables logging blocked login attempts. <strong>Recommended for enhanced protection.</strong>', 'zerospam' ),
|
178 |
+
array( 'strong' => array() )
|
179 |
+
),
|
180 |
+
'options' => array(
|
181 |
+
'enabled' => __( 'Enabled', 'zerospam' ),
|
182 |
+
),
|
183 |
+
'value' => ! empty( $options['log_blocked_logins'] ) ? $options['log_blocked_logins'] : false,
|
184 |
+
'recommended' => 'enabled',
|
185 |
+
);
|
186 |
+
|
187 |
+
return $settings;
|
188 |
+
}
|
189 |
+
}
|
modules/ninjaforms/class-ninjaforms.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ninja Forms class
|
4 |
+
*
|
5 |
+
* @package ZeroSpam
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace ZeroSpam\Modules\NinjaForms;
|
9 |
+
|
10 |
+
// Security Note: Blocks direct access to the plugin PHP files.
|
11 |
+
defined( 'ABSPATH' ) || die();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Ninja Forms
|
15 |
+
*/
|
16 |
+
class NinjaForms {
|
17 |
+
/**
|
18 |
+
* Add-on constructor.
|
19 |
+
*/
|
20 |
+
public function __construct() {
|
21 |
+
// add_filter( 'ninja_forms_register_fields', array($this, 'register_fields'));
|
22 |
+
|
23 |
+
// Preprocess Ninja Form submissions.
|
24 |
+
//add_filter( 'ninja_forms_submit_data', array( $this, 'preprocess_form' ), 10, 1 );
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
public function add_honeypot( $form_id, $is_preview ) {
|
29 |
+
return \ZeroSpam\Core\Utilities::honeypot_field();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function preprocess_form( $form_data ) {
|
33 |
+
print_r($form_data);
|
34 |
+
die();
|
35 |
+
|
36 |
+
return $form_data;
|
37 |
+
}
|
38 |
+
}
|
modules/wpforms/class-wpforms.php
CHANGED
@@ -7,8 +7,6 @@
|
|
7 |
|
8 |
namespace ZeroSpam\Modules\WPForms;
|
9 |
|
10 |
-
use ZeroSpam;
|
11 |
-
|
12 |
// Security Note: Blocks direct access to the plugin PHP files.
|
13 |
defined( 'ABSPATH' ) || die();
|
14 |
|
@@ -24,13 +22,89 @@ class WPForms {
|
|
24 |
add_filter( 'zerospam_settings', array( $this, 'settings' ) );
|
25 |
add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
|
26 |
|
27 |
-
if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_wpforms' ) && ZeroSpam\Core\Access::process() ) {
|
28 |
-
|
29 |
add_action( 'wpforms_frontend_output', array( $this, 'honeypot' ), 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
30 |
add_action( 'wpforms_process', array( $this, 'preprocess_submission' ), 10, 3 );
|
31 |
}
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* Add to the types array
|
36 |
*
|
@@ -45,8 +119,8 @@ class WPForms {
|
|
45 |
/**
|
46 |
* Fires before a form is displayed on the site’s frontend, only if the form exists and contains fields.
|
47 |
*/
|
48 |
-
public function
|
49 |
-
do_action( '
|
50 |
}
|
51 |
|
52 |
/**
|
@@ -111,51 +185,4 @@ class WPForms {
|
|
111 |
|
112 |
return $settings;
|
113 |
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Add a 'honeypot' field to the form
|
117 |
-
*
|
118 |
-
* @param array $form_data Form data and settings.
|
119 |
-
*/
|
120 |
-
public function honeypot( $form_data ) {
|
121 |
-
// @codingStandardsIgnoreLine
|
122 |
-
echo ZeroSpam\Core\Utilities::honeypot_field();
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Preprocess submission
|
127 |
-
*
|
128 |
-
* @param array $fields Sanitized entry field values/properties.
|
129 |
-
* @param array $entry Original $_POST global.
|
130 |
-
* @param array $form_data Form settings/data.
|
131 |
-
*/
|
132 |
-
public function preprocess_submission( $fields, $entry, $form_data ) {
|
133 |
-
$settings = ZeroSpam\Core\Settings::get_settings();
|
134 |
-
|
135 |
-
// Check honeypot.
|
136 |
-
// @codingStandardsIgnoreLine
|
137 |
-
if ( ! empty( $_REQUEST[ ZeroSpam\Core\Utilities::get_honeypot() ] ) ) {
|
138 |
-
$message = ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
|
139 |
-
wpforms()->process->errors[ $form_data['id'] ]['header'] = $message;
|
140 |
-
|
141 |
-
$details = $fields;
|
142 |
-
$details = array_merge( $details, $entry );
|
143 |
-
$details = array_merge( $details, $form_data );
|
144 |
-
|
145 |
-
$details['failed'] = 'honeypot';
|
146 |
-
|
147 |
-
// Log if enabled.
|
148 |
-
if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_wpforms' ) ) {
|
149 |
-
ZeroSpam\Includes\DB::log( 'wpforms', $details );
|
150 |
-
}
|
151 |
-
|
152 |
-
// Share the detection if enabled.
|
153 |
-
if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
|
154 |
-
$details['type'] = 'wpforms';
|
155 |
-
do_action( 'zerospam_share_detection', $details );
|
156 |
-
}
|
157 |
-
}
|
158 |
-
|
159 |
-
do_action( 'zerospam_preprocess_wpforms_submission', $form_data );
|
160 |
-
}
|
161 |
}
|
7 |
|
8 |
namespace ZeroSpam\Modules\WPForms;
|
9 |
|
|
|
|
|
10 |
// Security Note: Blocks direct access to the plugin PHP files.
|
11 |
defined( 'ABSPATH' ) || die();
|
12 |
|
22 |
add_filter( 'zerospam_settings', array( $this, 'settings' ) );
|
23 |
add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
|
24 |
|
25 |
+
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'verify_wpforms' ) && \ZeroSpam\Core\Access::process() ) {
|
26 |
+
// Adds Zero Spam's honeypot field.
|
27 |
add_action( 'wpforms_frontend_output', array( $this, 'honeypot' ), 10, 1 );
|
28 |
+
|
29 |
+
// Load scripts.
|
30 |
+
add_action( 'wpforms_frontend_output', array( $this, 'scripts' ) );
|
31 |
+
|
32 |
+
// Processes the form.
|
33 |
add_action( 'wpforms_process', array( $this, 'preprocess_submission' ), 10, 3 );
|
34 |
}
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* Adds Zero Spam's honeypot field.
|
39 |
+
*/
|
40 |
+
public function honeypot() {
|
41 |
+
// @codingStandardsIgnoreLine
|
42 |
+
echo \ZeroSpam\Core\Utilities::honeypot_field();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Preprocess submission
|
47 |
+
*
|
48 |
+
* @param array $fields Sanitized entry field values/properties.
|
49 |
+
* @param array $entry Original $_POST global.
|
50 |
+
* @param array $form_data Form settings/data.
|
51 |
+
*/
|
52 |
+
public function preprocess_submission( $fields, $entry, $form_data ) {
|
53 |
+
// Get the error message.
|
54 |
+
$error_message = \ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
|
55 |
+
|
56 |
+
// Create the details array for logging & sharing data.
|
57 |
+
$details = $fields;
|
58 |
+
$details = array_merge( $details, $entry );
|
59 |
+
$details = array_merge( $details, $form_data );
|
60 |
+
|
61 |
+
$details['type'] = 'wpforms';
|
62 |
+
|
63 |
+
// Begin validation checks.
|
64 |
+
$validation_errors = array();
|
65 |
+
|
66 |
+
// Check Zero Spam's honeypot field.
|
67 |
+
$honeypot_field_name = \ZeroSpam\Core\Utilities::get_honeypot();
|
68 |
+
// @codingStandardsIgnoreLine
|
69 |
+
if ( isset( $_REQUEST[ $honeypot_field_name ] ) && ! empty( $_REQUEST[ $honeypot_field_name ] ) ) {
|
70 |
+
// Failed the honeypot check.
|
71 |
+
$details['failed'] = 'honeypot';
|
72 |
+
|
73 |
+
$validation_errors[] = 'honeypot';
|
74 |
+
}
|
75 |
+
|
76 |
+
// Fire hook for additional validation (ex. David Walsh script).
|
77 |
+
// @codingStandardsIgnoreLine
|
78 |
+
$errors = apply_filters( 'zerospam_preprocess_wpforms_submission', array(), $form_data, $_REQUEST );
|
79 |
+
|
80 |
+
if ( ! empty( $errors ) ) {
|
81 |
+
foreach ( $errors as $key => $message ) {
|
82 |
+
$validation_errors[] = str_replace( 'zerospam_', '', $key );
|
83 |
+
|
84 |
+
$details['failed'] = str_replace( 'zerospam_', '', $key );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( ! empty( $validation_errors ) ) {
|
89 |
+
// Failed validations, log & send details if enabled.
|
90 |
+
foreach ( $validation_errors as $key => $fail ) {
|
91 |
+
$details['failed'] = $fail;
|
92 |
+
|
93 |
+
// Log the detection if enabled.
|
94 |
+
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_wpforms' ) ) {
|
95 |
+
\ZeroSpam\Includes\DB::log( 'wpforms', $details );
|
96 |
+
}
|
97 |
+
|
98 |
+
// Share the detection if enabled.
|
99 |
+
if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
|
100 |
+
do_action( 'zerospam_share_detection', $details );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
wpforms()->process->errors[ $form_data['id'] ]['header'] = $error_message;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
/**
|
109 |
* Add to the types array
|
110 |
*
|
119 |
/**
|
120 |
* Fires before a form is displayed on the site’s frontend, only if the form exists and contains fields.
|
121 |
*/
|
122 |
+
public function scripts() {
|
123 |
+
do_action( 'zerospam_wpforms_scripts' );
|
124 |
}
|
125 |
|
126 |
/**
|
185 |
|
186 |
return $settings;
|
187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== WordPress Zero Spam ===
|
2 |
Contributors: bmarshall511,
|
3 |
-
Tags:
|
4 |
Donate link: https://www.zerospam.org/subscribe/
|
5 |
Requires at least: 5.2
|
6 |
-
Tested up to: 5.8.
|
7 |
Requires PHP: 7.3
|
8 |
-
Stable tag: 5.
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
@@ -23,7 +23,7 @@ Quit forcing people to answer questions or confusing captchas to prove they're n
|
|
23 |
|
24 |
* No captcha, spam isn't a users' problem
|
25 |
* No moderation queues, spam isn't a administrators' problem
|
26 |
-
*
|
27 |
* Automatically & manually block IPs temporarily or permanently
|
28 |
* Geolocate IP addresses to see where offenders are coming from
|
29 |
* Block entire countries, regions, zip/postal codes & cities
|
@@ -33,7 +33,7 @@ Quit forcing people to answer questions or confusing captchas to prove they're n
|
|
33 |
|
34 |
= WordPress Zero Spam also protects =
|
35 |
|
36 |
-
* WordPress core comments &
|
37 |
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) submissions
|
38 |
* [WPForms](https://wordpress.org/plugins/wpforms-lite/) submissions
|
39 |
* [Formidable Form Builder](https://wordpress.org/plugins/formidable/) submissions
|
@@ -74,6 +74,16 @@ For more information & developer documentation, see the [plugin’s website](htt
|
|
74 |
* `wp zerospam settings` — Displays all plugin settings.
|
75 |
* `wp zerospam set --[SETTING_KEY]=[VALUE]` — Updates a plugin setting.
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
== Screenshots ==
|
78 |
|
79 |
1. WordPress Zero Spam dashboard
|
@@ -84,6 +94,20 @@ For more information & developer documentation, see the [plugin’s website](htt
|
|
84 |
|
85 |
== Changelog ==
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
= v5.1.6 =
|
88 |
|
89 |
* feat(fluent forms): resolves #276, fluent forms is now supported
|
1 |
=== WordPress Zero Spam ===
|
2 |
Contributors: bmarshall511,
|
3 |
+
Tags: protection, firewall, security, spam, spam blocker
|
4 |
Donate link: https://www.zerospam.org/subscribe/
|
5 |
Requires at least: 5.2
|
6 |
+
Tested up to: 5.8.2
|
7 |
Requires PHP: 7.3
|
8 |
+
Stable tag: 5.2.0
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
23 |
|
24 |
* No captcha, spam isn't a users' problem
|
25 |
* No moderation queues, spam isn't a administrators' problem
|
26 |
+
* [Zero Spam](https://www.zerospam.org), [Stop Forum Spam](https://www.stopforumspam.com/) & [Project Honeypot](https://www.projecthoneypot.org/) integration
|
27 |
* Automatically & manually block IPs temporarily or permanently
|
28 |
* Geolocate IP addresses to see where offenders are coming from
|
29 |
* Block entire countries, regions, zip/postal codes & cities
|
33 |
|
34 |
= WordPress Zero Spam also protects =
|
35 |
|
36 |
+
* WordPress core comments, user registrations & login attempts
|
37 |
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) submissions
|
38 |
* [WPForms](https://wordpress.org/plugins/wpforms-lite/) submissions
|
39 |
* [Formidable Form Builder](https://wordpress.org/plugins/formidable/) submissions
|
74 |
* `wp zerospam settings` — Displays all plugin settings.
|
75 |
* `wp zerospam set --[SETTING_KEY]=[VALUE]` — Updates a plugin setting.
|
76 |
|
77 |
+
= Are you getting a `ftp_fget` PHP warning? =
|
78 |
+
|
79 |
+
Some hosts have issues with they way they access files. If you're seeing a `ftp_fget` PHP notice, setting the `FS_METHOD` constant to `direct` in `wp-config.php` above the line `/* That's all, stop editing! Happy Pressing. */` should solve the problem:
|
80 |
+
|
81 |
+
```
|
82 |
+
define('FS_METHOD', 'direct');
|
83 |
+
```
|
84 |
+
|
85 |
+
If hosting with Pantheon, see their [known issues page](https://pantheon.io/docs/plugins-known-issues#define-fs_method) for more information and what to do to resolve it with their `$_ENV['PANTHEON_ENVIRONMENT']` variable check.
|
86 |
+
|
87 |
== Screenshots ==
|
88 |
|
89 |
1. WordPress Zero Spam dashboard
|
94 |
|
95 |
== Changelog ==
|
96 |
|
97 |
+
= v5.2.0 =
|
98 |
+
|
99 |
+
* feat(login): now protects user login attempts
|
100 |
+
* feat(project honeypot): resolves #201, project honeypot ip checks now integrated
|
101 |
+
* perf(sharing): blocked ips are no longer shared with zerospam.org
|
102 |
+
* perf(database): doesn't log .ico requests anymore that normally resulted in 2 entries per detection
|
103 |
+
* style(admin): misc admin interface improvements
|
104 |
+
* refactor(misc): cleaning up code & wordpress coding standards updates
|
105 |
+
* refactor(zero spam api): updated version on the zero spam api endpoint
|
106 |
+
|
107 |
+
= v5.1.7 =
|
108 |
+
|
109 |
+
* fix(php notice): fix for some hosts firing a php notice when unable to retrieve the list of recommended blocked email domains
|
110 |
+
|
111 |
= v5.1.6 =
|
112 |
|
113 |
* feat(fluent forms): resolves #276, fluent forms is now supported
|
wordpress-zero-spam.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* Plugin Name: WordPress Zero Spam
|
14 |
* Plugin URI: https://www.highfivery.com/projects/zero-spam/
|
15 |
* Description: Tired of all the worthless and bloated WordPress anti-spam plugins? The WordPress Zero Spam plugin makes blocking spam & malicious activity a cinch. <strong>Just install, activate, configure, and say goodbye to spam.</strong>
|
16 |
-
* Version: 5.
|
17 |
* Requires at least: 5.2
|
18 |
* Requires PHP: 7.3
|
19 |
* Author: Highfivery LLC
|
@@ -31,7 +31,7 @@ defined( 'ABSPATH' ) || die();
|
|
31 |
define( 'ZEROSPAM', __FILE__ );
|
32 |
define( 'ZEROSPAM_PATH', plugin_dir_path( ZEROSPAM ) );
|
33 |
define( 'ZEROSPAM_PLUGIN_BASE', plugin_basename( ZEROSPAM ) );
|
34 |
-
define( 'ZEROSPAM_VERSION', '5.
|
35 |
|
36 |
if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
|
37 |
define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );
|
13 |
* Plugin Name: WordPress Zero Spam
|
14 |
* Plugin URI: https://www.highfivery.com/projects/zero-spam/
|
15 |
* Description: Tired of all the worthless and bloated WordPress anti-spam plugins? The WordPress Zero Spam plugin makes blocking spam & malicious activity a cinch. <strong>Just install, activate, configure, and say goodbye to spam.</strong>
|
16 |
+
* Version: 5.2.0
|
17 |
* Requires at least: 5.2
|
18 |
* Requires PHP: 7.3
|
19 |
* Author: Highfivery LLC
|
31 |
define( 'ZEROSPAM', __FILE__ );
|
32 |
define( 'ZEROSPAM_PATH', plugin_dir_path( ZEROSPAM ) );
|
33 |
define( 'ZEROSPAM_PLUGIN_BASE', plugin_basename( ZEROSPAM ) );
|
34 |
+
define( 'ZEROSPAM_VERSION', '5.2.0' );
|
35 |
|
36 |
if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
|
37 |
define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );
|