Version Description
- Misc. code clean-up
- Added support for the Fluent Forms plugin
Download this release
Release Info
Developer | bmarshall511 |
Plugin | WordPress Zero Spam |
Version | 4.4.0 |
Comparing to | |
See all releases |
Code changes from version 4.3.10 to 4.4.0
- assets/js/wpzerospam.js +26 -27
- inc/admin.php +17 -0
- inc/helpers.php +15 -2
- integrations/{buddypress.php → buddypress/buddypress.php} +17 -0
- integrations/buddypress/js/buddypress.js +43 -0
- integrations/{comments.php → comments/comments.php} +1 -1
- assets/js/integrations/wpzerospam-integration-comments.js → integrations/comments/js/comments.js +4 -2
- integrations/{contact-form-7.php → contact-form-7/contact-form-7.php} +1 -1
- assets/js/integrations/wpzerospam-integration-cf7.js → integrations/contact-form-7/js/cf7.js +1 -2
- integrations/fluentform/fluentform.php +50 -0
- integrations/fluentform/js/fluentform.js +41 -0
- integrations/{gravity-forms.php → gravity-forms/gravity-forms.php} +17 -0
- integrations/gravity-forms/js/gravity-forms.js +37 -0
- integrations/{ninja-forms.php → ninja-forms/ninja-forms.php} +0 -0
- assets/js/integrations/wpzerospam-integration-registrations.js → integrations/registrations/js/registrations.js +1 -2
- integrations/{registration.php → registrations/registrations.php} +1 -1
- assets/js/integrations/wpzerospam-integration-wpforms.js → integrations/wpforms/js/wpforms.js +1 -2
- integrations/{wpforms.php → wpforms/wpforms.php} +1 -1
- readme.txt +7 -1
- wordpress-zero-spam.php +18 -14
assets/js/wpzerospam.js
CHANGED
@@ -1,38 +1,37 @@
|
|
1 |
var WordPressZeroSpam = {
|
2 |
init: function() {
|
3 |
-
|
4 |
-
|
5 |
-
forms += ", .wpforms-form";
|
6 |
-
forms += ", .gform_wrapper form";
|
7 |
|
8 |
-
|
9 |
-
forms += ", #ast-commentform";
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
jQuery( "<input>" )
|
15 |
.attr( "type", "hidden" )
|
16 |
.attr( "name", "wpzerospam_key" )
|
17 |
.attr( "value", wpzerospam.key )
|
18 |
-
.appendTo(
|
19 |
-
}
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
.attr( "type", "hidden" )
|
26 |
-
.attr( "name", "wpzerospam_key" )
|
27 |
-
.attr( "value", wpzerospam.key )
|
28 |
-
.appendTo( forms );
|
29 |
-
} else {
|
30 |
-
jQuery( '[name="wpzerospam_key"]', jQuery( this ) ).value( wpzerospam.key );
|
31 |
-
}
|
32 |
-
|
33 |
-
return true;
|
34 |
-
});
|
35 |
-
}
|
36 |
}
|
37 |
};
|
38 |
|
1 |
var WordPressZeroSpam = {
|
2 |
init: function() {
|
3 |
+
// Make sure the WordPress Zero Spam key is available.
|
4 |
+
if ( typeof wpzerospam.key == "undefined" ) { return; }
|
|
|
|
|
5 |
|
6 |
+
$form = jQuery( '.wpzerospam' );
|
|
|
7 |
|
8 |
+
// If the form can't be found & should be, send a message to the console.
|
9 |
+
if ( ! $form.length ) {
|
10 |
+
console.log(
|
11 |
+
'WordPress Zero Spam was unable to locate any custom forms (.wpzerospam)'
|
12 |
+
);
|
13 |
+
return true;
|
14 |
+
}
|
15 |
+
|
16 |
+
console.log(
|
17 |
+
'WordPress Zero Spam located ' + $form.length + ' custom form(s) (.wpzerospam)'
|
18 |
+
);
|
19 |
+
|
20 |
+
$form.attr( 'data-wpzerospam', 'protected' );
|
21 |
+
|
22 |
+
jQuery( '.wpzerospam' ).on( "submit", function() {
|
23 |
+
if ( ! jQuery( '[name="wpzerospam_key"]', jQuery( this ) ).length ) {
|
24 |
jQuery( "<input>" )
|
25 |
.attr( "type", "hidden" )
|
26 |
.attr( "name", "wpzerospam_key" )
|
27 |
.attr( "value", wpzerospam.key )
|
28 |
+
.appendTo( '.wpzerospam' );
|
29 |
+
} else {
|
30 |
+
jQuery( '[name="wpzerospam_key"]', jQuery( this ) ).value( wpzerospam.key );
|
31 |
+
}
|
32 |
+
|
33 |
+
return true;
|
34 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
};
|
37 |
|
inc/admin.php
CHANGED
@@ -301,6 +301,10 @@ function wpzerospam_validate_options( $input ) {
|
|
301 |
if ( empty( $input['verify_wpforms'] ) ) {
|
302 |
$input['verify_wpforms'] = 'disabled';
|
303 |
}
|
|
|
|
|
|
|
|
|
304 |
return $input;
|
305 |
}
|
306 |
|
@@ -534,6 +538,19 @@ function wpzerospam_admin_init() {
|
|
534 |
]
|
535 |
]);
|
536 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
}
|
538 |
add_action( 'admin_init', 'wpzerospam_admin_init' );
|
539 |
|
301 |
if ( empty( $input['verify_wpforms'] ) ) {
|
302 |
$input['verify_wpforms'] = 'disabled';
|
303 |
}
|
304 |
+
|
305 |
+
if ( empty( $input['verify_fluentform'] ) ) {
|
306 |
+
$input['verify_fluentform'] = 'disabled';
|
307 |
+
}
|
308 |
return $input;
|
309 |
}
|
310 |
|
538 |
]
|
539 |
]);
|
540 |
}
|
541 |
+
|
542 |
+
// Fluent Form spam check
|
543 |
+
if ( is_plugin_active( 'fluentform/fluentform.php' ) ) {
|
544 |
+
add_settings_field( 'verify_fluentform', __( 'Verify Fluent Form Submissions', 'wpzerospam' ), 'wpzerospam_field_cb', 'wpzerospam', 'wpzerospam_spam_checks', [
|
545 |
+
'label_for' => 'verify_fluentform',
|
546 |
+
'type' => 'checkbox',
|
547 |
+
'multi' => false,
|
548 |
+
'desc' => 'Enables spam detection for Fluent Form submissions.',
|
549 |
+
'options' => [
|
550 |
+
'enabled' => __( 'Enabled', 'wpzerospam' )
|
551 |
+
]
|
552 |
+
]);
|
553 |
+
}
|
554 |
}
|
555 |
add_action( 'admin_init', 'wpzerospam_admin_init' );
|
556 |
|
inc/helpers.php
CHANGED
@@ -100,7 +100,15 @@ if ( ! function_exists( 'wpzerospam_spam_detected' ) ) {
|
|
100 |
* Checks the post submission for a valid key
|
101 |
*/
|
102 |
if ( ! function_exists( 'wpzerospam_key_check' ) ) {
|
103 |
-
function wpzerospam_key_check() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
if ( ! empty( $_POST['wpzerospam_key'] ) && $_POST['wpzerospam_key'] == wpzerospam_get_key() ) {
|
105 |
return true;
|
106 |
}
|
@@ -328,12 +336,13 @@ if ( ! function_exists( 'wpzerospam_plugin_integration_enabled' ) ) {
|
|
328 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
329 |
}
|
330 |
|
331 |
-
$options =
|
332 |
|
333 |
$integrations = [
|
334 |
'ninja_forms' => 'ninja-forms/ninja-forms.php',
|
335 |
'cf7' => 'contact-form-7/wp-contact-form-7.php',
|
336 |
'gforms' => 'gravityforms/gravityforms.php',
|
|
|
337 |
'wpforms' => [ 'wpforms/wpforms.php', 'wpforms-lite/wpforms.php' ]
|
338 |
];
|
339 |
|
@@ -415,6 +424,10 @@ if ( ! function_exists( 'wpzerospam_options' ) ) {
|
|
415 |
$options['verify_wpforms'] = 'enabled';
|
416 |
}
|
417 |
|
|
|
|
|
|
|
|
|
418 |
return $options;
|
419 |
}
|
420 |
}
|
100 |
* Checks the post submission for a valid key
|
101 |
*/
|
102 |
if ( ! function_exists( 'wpzerospam_key_check' ) ) {
|
103 |
+
function wpzerospam_key_check( $data = false ) {
|
104 |
+
if (
|
105 |
+
$data &&
|
106 |
+
! empty( $data['wpzerospam_key'] ) &&
|
107 |
+
$data['wpzerospam_key'] == wpzerospam_get_key()
|
108 |
+
) {
|
109 |
+
return true;
|
110 |
+
}
|
111 |
+
|
112 |
if ( ! empty( $_POST['wpzerospam_key'] ) && $_POST['wpzerospam_key'] == wpzerospam_get_key() ) {
|
113 |
return true;
|
114 |
}
|
336 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
337 |
}
|
338 |
|
339 |
+
$options = wpzerospam_options();
|
340 |
|
341 |
$integrations = [
|
342 |
'ninja_forms' => 'ninja-forms/ninja-forms.php',
|
343 |
'cf7' => 'contact-form-7/wp-contact-form-7.php',
|
344 |
'gforms' => 'gravityforms/gravityforms.php',
|
345 |
+
'fluentform' => 'fluentform/fluentform.php',
|
346 |
'wpforms' => [ 'wpforms/wpforms.php', 'wpforms-lite/wpforms.php' ]
|
347 |
];
|
348 |
|
424 |
$options['verify_wpforms'] = 'enabled';
|
425 |
}
|
426 |
|
427 |
+
if ( empty( $options['verify_fluentform'] ) ) {
|
428 |
+
$options['verify_fluentform'] = 'enabled';
|
429 |
+
}
|
430 |
+
|
431 |
return $options;
|
432 |
}
|
433 |
}
|
integrations/{buddypress.php → buddypress/buddypress.php}
RENAMED
@@ -21,3 +21,20 @@ if ( ! function_exists( 'wpzerospam_bp_signup_validate' ) ) {
|
|
21 |
}
|
22 |
}
|
23 |
add_action( 'bp_signup_validate', 'wpzerospam_bp_signup_validate' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
}
|
23 |
add_action( 'bp_signup_validate', 'wpzerospam_bp_signup_validate' );
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Enqueue the BuddyPress form JS
|
27 |
+
*/
|
28 |
+
if ( ! function_exists( 'wpzerospam_buddy_press' ) ) {
|
29 |
+
function wpzerospam_buddy_press() {
|
30 |
+
wp_enqueue_script(
|
31 |
+
'wpzerospam-integration-buddy-press',
|
32 |
+
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
33 |
+
'/integrations/buddypress/js/buddypress.js',
|
34 |
+
[ 'wpzerospam' ],
|
35 |
+
WORDPRESS_ZERO_SPAM_VERSION,
|
36 |
+
true
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
add_action( 'wpcf7_enqueue_scripts', 'wpzerospam_buddy_press' );
|
integrations/buddypress/js/buddypress.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress Zero Spam addon for handling core BuddyPress submissions.
|
3 |
+
*/
|
4 |
+
WordPressZeroSpamIntegrations.buddyPress = {
|
5 |
+
init: function() {
|
6 |
+
// Make sure the WordPress Zero Spam key is available.
|
7 |
+
if ( typeof wpzerospam.key == "undefined" ) { return; }
|
8 |
+
|
9 |
+
var $form = jQuery( '#buddypress #signup_form' );
|
10 |
+
|
11 |
+
// If the form can't be found & should be, send a message to the console.
|
12 |
+
if ( ! $form.length ) {
|
13 |
+
console.log(
|
14 |
+
'WordPress Zero Spam was unable to locate any BuddyPress forms (#buddypress #signup_form)'
|
15 |
+
);
|
16 |
+
return true;
|
17 |
+
}
|
18 |
+
|
19 |
+
console.log(
|
20 |
+
'WordPress Zero Spam located ' + $form.length + ' BuddyPress form(s) (#buddypress #signup_form)'
|
21 |
+
);
|
22 |
+
|
23 |
+
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
+
|
25 |
+
$form.on( "submit", function() {
|
26 |
+
if ( ! jQuery( '[name="wpzerospam_key"]', jQuery( this ) ).length ) {
|
27 |
+
jQuery( "<input>" )
|
28 |
+
.attr( "type", "hidden" )
|
29 |
+
.attr( "name", "wpzerospam_key" )
|
30 |
+
.attr( "value", wpzerospam.key )
|
31 |
+
.appendTo( $form );
|
32 |
+
} else {
|
33 |
+
jQuery( '[name="wpzerospam_key"]', jQuery( this ) ).value( wpzerospam.key );
|
34 |
+
}
|
35 |
+
|
36 |
+
return true;
|
37 |
+
});
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
jQuery(function() {
|
42 |
+
WordPressZeroSpamIntegrations.cf7.init();
|
43 |
+
});
|
integrations/{comments.php → comments/comments.php}
RENAMED
@@ -41,7 +41,7 @@ if ( ! function_exists( 'wpzerospam_comment_form' ) ) {
|
|
41 |
wp_enqueue_script(
|
42 |
'wpzerospam-integration-comments',
|
43 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
44 |
-
'/
|
45 |
[ 'wpzerospam' ],
|
46 |
WORDPRESS_ZERO_SPAM_VERSION,
|
47 |
true
|
41 |
wp_enqueue_script(
|
42 |
'wpzerospam-integration-comments',
|
43 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
44 |
+
'/integrations/comments/js/comments.js',
|
45 |
[ 'wpzerospam' ],
|
46 |
WORDPRESS_ZERO_SPAM_VERSION,
|
47 |
true
|
assets/js/integrations/wpzerospam-integration-comments.js → integrations/comments/js/comments.js
RENAMED
@@ -6,12 +6,14 @@ WordPressZeroSpamIntegrations.comments = {
|
|
6 |
// Make sure the WordPress Zero Spam key is available.
|
7 |
if ( typeof wpzerospam.key == "undefined" ) { return; }
|
8 |
|
9 |
-
|
|
|
|
|
10 |
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
-
'WordPress Zero Spam was unable to locate
|
15 |
);
|
16 |
return true;
|
17 |
}
|
6 |
// Make sure the WordPress Zero Spam key is available.
|
7 |
if ( typeof wpzerospam.key == "undefined" ) { return; }
|
8 |
|
9 |
+
// #ast-commentform - Astra theme support (changes the comment if to #ast-commentform)
|
10 |
+
// @TODO - Find a better way to support the Astra theme by checking if it's enabled.
|
11 |
+
var $form = jQuery( '#commentform, #ast-commentform' );
|
12 |
|
13 |
// If the form can't be found & should be, send a message to the console.
|
14 |
if ( ! $form.length ) {
|
15 |
console.log(
|
16 |
+
'WordPress Zero Spam was unable to locate any comment forms (#commentform)'
|
17 |
);
|
18 |
return true;
|
19 |
}
|
integrations/{contact-form-7.php → contact-form-7/contact-form-7.php}
RENAMED
@@ -30,7 +30,7 @@ if ( ! function_exists( 'wpzerospam_cf7' ) ) {
|
|
30 |
wp_enqueue_script(
|
31 |
'wpzerospam-integration-cf7',
|
32 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
33 |
-
'/
|
34 |
[ 'wpzerospam' ],
|
35 |
WORDPRESS_ZERO_SPAM_VERSION,
|
36 |
true
|
30 |
wp_enqueue_script(
|
31 |
'wpzerospam-integration-cf7',
|
32 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
33 |
+
'/integrations/contact-form-7/js/cf7.js',
|
34 |
[ 'wpzerospam' ],
|
35 |
WORDPRESS_ZERO_SPAM_VERSION,
|
36 |
true
|
assets/js/integrations/wpzerospam-integration-cf7.js → integrations/contact-form-7/js/cf7.js
RENAMED
@@ -11,7 +11,7 @@ WordPressZeroSpamIntegrations.cf7 = {
|
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
-
'WordPress Zero Spam was unable to locate
|
15 |
);
|
16 |
return true;
|
17 |
}
|
@@ -22,7 +22,6 @@ WordPressZeroSpamIntegrations.cf7 = {
|
|
22 |
|
23 |
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
|
25 |
-
// Triggered when the comment form is submitted
|
26 |
jQuery( ".wpcf7-submit", $form ).click( function() {
|
27 |
// Make sure the WordPress Zero Spam key isn't already on the form, if
|
28 |
// not, add it.
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
+
'WordPress Zero Spam was unable to locate any CF7 forms (.wpcf7-form)'
|
15 |
);
|
16 |
return true;
|
17 |
}
|
22 |
|
23 |
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
|
|
|
25 |
jQuery( ".wpcf7-submit", $form ).click( function() {
|
26 |
// Make sure the WordPress Zero Spam key isn't already on the form, if
|
27 |
// not, add it.
|
integrations/fluentform/fluentform.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles checking submitted Fluent Forms for spam
|
4 |
+
*
|
5 |
+
* @package WordPressZeroSpam
|
6 |
+
* @since 4.4.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Validation for Fluent Form submissions
|
11 |
+
*/
|
12 |
+
if ( ! function_exists( 'wpzerospam_fluentform_validate' ) ) {
|
13 |
+
function wpzerospam_fluentform_validate( $insertData, $data, $form ) {
|
14 |
+
if ( is_user_logged_in() || wpzerospam_key_check( $data ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
do_action( 'wpzerospam_cf7_spam' );
|
19 |
+
|
20 |
+
$data = [
|
21 |
+
'insertData' => $insertData,
|
22 |
+
'data' => $data,
|
23 |
+
'form' => $form
|
24 |
+
];
|
25 |
+
|
26 |
+
wpzerospam_spam_detected( 'fluentform', $result, false );
|
27 |
+
|
28 |
+
$options = wpzerospam_options();
|
29 |
+
echo $options['spam_message'];
|
30 |
+
die();
|
31 |
+
}
|
32 |
+
}
|
33 |
+
add_action( 'fluentform_before_insert_submission', 'wpzerospam_fluentform_validate', 10, 3 );
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Enqueue the Fluent Form JS
|
37 |
+
*/
|
38 |
+
if ( ! function_exists( 'wpzerospam_fluentform' ) ) {
|
39 |
+
function wpzerospam_fluentform() {
|
40 |
+
wp_enqueue_script(
|
41 |
+
'wpzerospam-integration-fluentform',
|
42 |
+
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
43 |
+
'/integrations/fluentform/js/fluentform.js',
|
44 |
+
[ 'wpzerospam' ],
|
45 |
+
WORDPRESS_ZERO_SPAM_VERSION,
|
46 |
+
true
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
add_action( 'fluentform_before_form_render', 'wpzerospam_fluentform' );
|
integrations/fluentform/js/fluentform.js
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress Zero Spam addon for handling core Fluent Form submissions.
|
3 |
+
*/
|
4 |
+
WordPressZeroSpamIntegrations.fluentform = {
|
5 |
+
init: function() {
|
6 |
+
// Make sure the WordPress Zero Spam key is available.
|
7 |
+
if ( typeof wpzerospam.key == "undefined" ) { return; }
|
8 |
+
|
9 |
+
var $form = jQuery( '.frm-fluent-form' );
|
10 |
+
|
11 |
+
// If the form can't be found & should be, send a message to the console.
|
12 |
+
if ( ! $form.length ) {
|
13 |
+
console.log(
|
14 |
+
'WordPress Zero Spam was unable to locate any Fluent Forms (.frm-fluent-form)'
|
15 |
+
);
|
16 |
+
return true;
|
17 |
+
}
|
18 |
+
|
19 |
+
console.log(
|
20 |
+
'WordPress Zero Spam located ' + $form.length + ' Fluent Form(s) (.frm-fluent-form)'
|
21 |
+
);
|
22 |
+
|
23 |
+
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
+
|
25 |
+
jQuery( $form ).submit( function() {console.log('sdsd');
|
26 |
+
if ( ! jQuery( '[name="wpzerospam_key"]', $form ).length ) {
|
27 |
+
jQuery( "<input>" )
|
28 |
+
.attr( "type", "hidden" )
|
29 |
+
.attr( "name", "wpzerospam_key" )
|
30 |
+
.attr( "value", wpzerospam.key )
|
31 |
+
.appendTo( $form );
|
32 |
+
} else {
|
33 |
+
jQuery( '[name="wpzerospam_key"]', $form ).value( wpzerospam.key );
|
34 |
+
}
|
35 |
+
});
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
jQuery(function() {
|
40 |
+
WordPressZeroSpamIntegrations.fluentform.init();
|
41 |
+
});
|
integrations/{gravity-forms.php → gravity-forms/gravity-forms.php}
RENAMED
@@ -21,3 +21,20 @@ if ( ! function_exists( 'wpzerospam_gform_validate' ) ) {
|
|
21 |
}
|
22 |
}
|
23 |
add_action( 'gform_pre_submission', 'wpzerospam_gform_validate' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
}
|
23 |
add_action( 'gform_pre_submission', 'wpzerospam_gform_validate' );
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Enqueue the Gravity Forms JS
|
27 |
+
*/
|
28 |
+
if ( ! function_exists( 'wpzerospam_gravity_forms' ) ) {
|
29 |
+
function wpzerospam_gravity_forms() {
|
30 |
+
wp_enqueue_script(
|
31 |
+
'wpzerospam-integration-gravity-forms',
|
32 |
+
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
33 |
+
'/integrations/gravity-forms/js/gravity-forms.js',
|
34 |
+
[ 'wpzerospam' ],
|
35 |
+
WORDPRESS_ZERO_SPAM_VERSION,
|
36 |
+
true
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
add_action( 'wpcf7_enqueue_scripts', 'wpzerospam_gravity_forms' );
|
integrations/gravity-forms/js/gravity-forms.js
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress Zero Spam addon for handling Gravity Form submissions.
|
3 |
+
*/
|
4 |
+
WordPressZeroSpamIntegrations.gravityForms = {
|
5 |
+
init: function() {
|
6 |
+
// Make sure the WordPress Zero Spam key is available.
|
7 |
+
if ( typeof wpzerospam.key == "undefined" ) { return; }
|
8 |
+
|
9 |
+
var $form = jQuery( '.gform_wrapper form' );
|
10 |
+
|
11 |
+
// If the form can't be found & should be, send a message to the console.
|
12 |
+
if ( ! $form.length ) {
|
13 |
+
console.log(
|
14 |
+
'WordPress Zero Spam was unable to locate any Gravity Forms (.gform_wrapper form)'
|
15 |
+
);
|
16 |
+
return true;
|
17 |
+
}
|
18 |
+
|
19 |
+
console.log(
|
20 |
+
'WordPress Zero Spam located ' + $form.length + ' Gravity Forms (.gform_wrapper form)'
|
21 |
+
);
|
22 |
+
|
23 |
+
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
+
|
25 |
+
jQuery( document ).on( "gform_post_render", function() {
|
26 |
+
jQuery( "<input>" )
|
27 |
+
.attr( "type", "hidden" )
|
28 |
+
.attr( "name", "wpzerospam_key" )
|
29 |
+
.attr( "value", wpzerospam.key )
|
30 |
+
.appendTo( $form );
|
31 |
+
});
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
jQuery(function() {
|
36 |
+
WordPressZeroSpamIntegrations.gravityForms.init();
|
37 |
+
});
|
integrations/{ninja-forms.php → ninja-forms/ninja-forms.php}
RENAMED
File without changes
|
assets/js/integrations/wpzerospam-integration-registrations.js → integrations/registrations/js/registrations.js
RENAMED
@@ -11,7 +11,7 @@ WordPressZeroSpamIntegrations.registrations = {
|
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
-
'WordPress Zero Spam was unable to locate
|
15 |
);
|
16 |
return true;
|
17 |
}
|
@@ -22,7 +22,6 @@ WordPressZeroSpamIntegrations.registrations = {
|
|
22 |
|
23 |
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
|
25 |
-
// Triggered when the comment form is submitted
|
26 |
$form.on( "submit", function() {
|
27 |
// Make sure the WordPress Zero Spam key isn't already on the form, if
|
28 |
// not, add it.
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
+
'WordPress Zero Spam was unable to locate any registration forms (#registerform)'
|
15 |
);
|
16 |
return true;
|
17 |
}
|
22 |
|
23 |
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
|
|
|
25 |
$form.on( "submit", function() {
|
26 |
// Make sure the WordPress Zero Spam key isn't already on the form, if
|
27 |
// not, add it.
|
integrations/{registration.php → registrations/registrations.php}
RENAMED
@@ -44,7 +44,7 @@ if ( ! function_exists( 'wpzerospam_registration_form' ) ) {
|
|
44 |
wp_enqueue_script(
|
45 |
'wpzerospam-integration-registrations',
|
46 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
47 |
-
'/
|
48 |
[ 'wpzerospam' ],
|
49 |
WORDPRESS_ZERO_SPAM_VERSION,
|
50 |
true
|
44 |
wp_enqueue_script(
|
45 |
'wpzerospam-integration-registrations',
|
46 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
47 |
+
'/integrations/registrations/js/registrations.js',
|
48 |
[ 'wpzerospam' ],
|
49 |
WORDPRESS_ZERO_SPAM_VERSION,
|
50 |
true
|
assets/js/integrations/wpzerospam-integration-wpforms.js → integrations/wpforms/js/wpforms.js
RENAMED
@@ -11,7 +11,7 @@ WordPressZeroSpamIntegrations.wpforms = {
|
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
-
'WordPress Zero Spam was unable to locate
|
15 |
);
|
16 |
return true;
|
17 |
}
|
@@ -22,7 +22,6 @@ WordPressZeroSpamIntegrations.wpforms = {
|
|
22 |
|
23 |
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
|
25 |
-
// Triggered when the comment form is submitted
|
26 |
$form.on( "submit", function() {
|
27 |
// Make sure the WordPress Zero Spam key isn't already on the form, if
|
28 |
// not, add it.
|
11 |
// If the form can't be found & should be, send a message to the console.
|
12 |
if ( ! $form.length ) {
|
13 |
console.log(
|
14 |
+
'WordPress Zero Spam was unable to locate any WP Forms (.wpforms-form)'
|
15 |
);
|
16 |
return true;
|
17 |
}
|
22 |
|
23 |
$form.attr( 'data-wpzerospam', 'protected' );
|
24 |
|
|
|
25 |
$form.on( "submit", function() {
|
26 |
// Make sure the WordPress Zero Spam key isn't already on the form, if
|
27 |
// not, add it.
|
integrations/{wpforms.php → wpforms/wpforms.php}
RENAMED
@@ -36,7 +36,7 @@ if ( ! function_exists( 'wpzerospam_wpforms' ) ) {
|
|
36 |
wp_enqueue_script(
|
37 |
'wpzerospam-integration-wpforms',
|
38 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
39 |
-
'/
|
40 |
[ 'wpzerospam' ],
|
41 |
WORDPRESS_ZERO_SPAM_VERSION,
|
42 |
true
|
36 |
wp_enqueue_script(
|
37 |
'wpzerospam-integration-wpforms',
|
38 |
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
39 |
+
'/integrations/wpforms/js/wpforms.js',
|
40 |
[ 'wpzerospam' ],
|
41 |
WORDPRESS_ZERO_SPAM_VERSION,
|
42 |
true
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://benmarshall.me/donate/?utm_source=wordpress_zero_spam&utm_m
|
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.4.2
|
7 |
Requires PHP: 7.1
|
8 |
-
Stable tag: 4.
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
@@ -41,6 +41,7 @@ WordPress Zero Spam was initially built based on the work by [David Walsh](http:
|
|
41 |
* [Ninja Forms](https://wordpress.org/plugins/ninja-forms/) submissions
|
42 |
* [BuddyPress](https://wordpress.org/plugins/buddypress/) registrations
|
43 |
* [Contact Form by WPForms](https://wordpress.org/plugins/wpforms-lite/) submissions
|
|
|
44 |
|
45 |
<small>This plugin does not support with Jetpack Comments. For more information, see [https://wordpress.org/support/topic/incompatible-with-jetpack-comments](https://wordpress.org/support/topic/incompatible-with-jetpack-comments).</small>
|
46 |
|
@@ -92,6 +93,11 @@ Yes, that's what does the magic and keeps spam bots out.
|
|
92 |
|
93 |
== Changelog ==
|
94 |
|
|
|
|
|
|
|
|
|
|
|
95 |
= 4.3.10 =
|
96 |
|
97 |
* Updated get_plugin_data calls to use a constant. See [#196](https://github.com/bmarshall511/wordpress-zero-spam/issues/196)
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.4.2
|
7 |
Requires PHP: 7.1
|
8 |
+
Stable tag: 4.4.0
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
41 |
* [Ninja Forms](https://wordpress.org/plugins/ninja-forms/) submissions
|
42 |
* [BuddyPress](https://wordpress.org/plugins/buddypress/) registrations
|
43 |
* [Contact Form by WPForms](https://wordpress.org/plugins/wpforms-lite/) submissions
|
44 |
+
* [WP Fluent Forms](https://wordpress.org/plugins/fluentform/) submissions
|
45 |
|
46 |
<small>This plugin does not support with Jetpack Comments. For more information, see [https://wordpress.org/support/topic/incompatible-with-jetpack-comments](https://wordpress.org/support/topic/incompatible-with-jetpack-comments).</small>
|
47 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 4.4.0 =
|
97 |
+
|
98 |
+
* Misc. code clean-up
|
99 |
+
* Added support for the Fluent Forms plugin
|
100 |
+
|
101 |
= 4.3.10 =
|
102 |
|
103 |
* Updated get_plugin_data calls to use a constant. See [#196](https://github.com/bmarshall511/wordpress-zero-spam/issues/196)
|
wordpress-zero-spam.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* Plugin Name: WordPress Zero Spam
|
14 |
* Plugin URI: https://benmarshall.me/wordpress-zero-spam
|
15 |
* Description: Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch. <strong>Just install, activate and say goodbye to spam.</strong> Based on work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
|
16 |
-
* Version: 4.
|
17 |
* Requires at least: 5.2
|
18 |
* Requires PHP: 7.2
|
19 |
* Author: Ben Marshall
|
@@ -31,13 +31,18 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|
31 |
// Define plugin constants
|
32 |
define( 'WORDPRESS_ZERO_SPAM', __FILE__ );
|
33 |
define( 'WORDPRESS_ZERO_SPAM_DB_VERSION', '0.1' );
|
34 |
-
define( 'WORDPRESS_ZERO_SPAM_VERSION', '4.
|
35 |
|
36 |
/**
|
37 |
* Helpers
|
38 |
*/
|
39 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/helpers.php';
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Install plugin tables
|
43 |
*/
|
@@ -94,11 +99,6 @@ function wpzerospam_db_check() {
|
|
94 |
}
|
95 |
add_action( 'plugins_loaded', 'wpzerospam_db_check' );
|
96 |
|
97 |
-
/**
|
98 |
-
* Plugin updates
|
99 |
-
*/
|
100 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/updates.php';
|
101 |
-
|
102 |
/**
|
103 |
* Plugin scripts
|
104 |
*/
|
@@ -112,27 +112,31 @@ require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/admin.php';
|
|
112 |
/**
|
113 |
* Below are the includes for individual spam check integrations
|
114 |
*/
|
115 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/comments.php';
|
116 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/
|
117 |
|
118 |
if ( wpzerospam_plugin_integration_enabled( 'cf7' ) ) {
|
119 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/contact-form-7.php';
|
120 |
}
|
121 |
|
122 |
if ( wpzerospam_plugin_integration_enabled( 'gforms' ) ) {
|
123 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/gravity-forms.php';
|
124 |
}
|
125 |
|
126 |
if ( wpzerospam_plugin_integration_enabled( 'ninja_forms' ) ) {
|
127 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/ninja-forms.php';
|
128 |
}
|
129 |
|
130 |
if ( wpzerospam_plugin_integration_enabled( 'bp_registrations' ) ) {
|
131 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/buddypress.php';
|
132 |
}
|
133 |
|
134 |
if ( wpzerospam_plugin_integration_enabled( 'wpforms' ) ) {
|
135 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/wpforms.php';
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
|
138 |
/**
|
13 |
* Plugin Name: WordPress Zero Spam
|
14 |
* Plugin URI: https://benmarshall.me/wordpress-zero-spam
|
15 |
* Description: Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch. <strong>Just install, activate and say goodbye to spam.</strong> Based on work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
|
16 |
+
* Version: 4.4.0
|
17 |
* Requires at least: 5.2
|
18 |
* Requires PHP: 7.2
|
19 |
* Author: Ben Marshall
|
31 |
// Define plugin constants
|
32 |
define( 'WORDPRESS_ZERO_SPAM', __FILE__ );
|
33 |
define( 'WORDPRESS_ZERO_SPAM_DB_VERSION', '0.1' );
|
34 |
+
define( 'WORDPRESS_ZERO_SPAM_VERSION', '4.4.0' );
|
35 |
|
36 |
/**
|
37 |
* Helpers
|
38 |
*/
|
39 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/helpers.php';
|
40 |
|
41 |
+
/**
|
42 |
+
* Plugin updates
|
43 |
+
*/
|
44 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/updates.php';
|
45 |
+
|
46 |
/**
|
47 |
* Install plugin tables
|
48 |
*/
|
99 |
}
|
100 |
add_action( 'plugins_loaded', 'wpzerospam_db_check' );
|
101 |
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Plugin scripts
|
104 |
*/
|
112 |
/**
|
113 |
* Below are the includes for individual spam check integrations
|
114 |
*/
|
115 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/comments/comments.php';
|
116 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/registrations/registrations.php';
|
117 |
|
118 |
if ( wpzerospam_plugin_integration_enabled( 'cf7' ) ) {
|
119 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/contact-form-7/contact-form-7.php';
|
120 |
}
|
121 |
|
122 |
if ( wpzerospam_plugin_integration_enabled( 'gforms' ) ) {
|
123 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/gravity-forms/gravity-forms.php';
|
124 |
}
|
125 |
|
126 |
if ( wpzerospam_plugin_integration_enabled( 'ninja_forms' ) ) {
|
127 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/ninja-forms/ninja-forms.php';
|
128 |
}
|
129 |
|
130 |
if ( wpzerospam_plugin_integration_enabled( 'bp_registrations' ) ) {
|
131 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/buddypress/buddypress.php';
|
132 |
}
|
133 |
|
134 |
if ( wpzerospam_plugin_integration_enabled( 'wpforms' ) ) {
|
135 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/wpforms/wpforms.php';
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( wpzerospam_plugin_integration_enabled( 'fluentform' ) ) {
|
139 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/integrations/fluentform/fluentform.php';
|
140 |
}
|
141 |
|
142 |
/**
|