Version Description
- Fix for
Notice: Undefined index: verify_ninja_form
. See #195
Download this release
Release Info
Developer | bmarshall511 |
Plugin | WordPress Zero Spam |
Version | 4.3.9 |
Comparing to | |
See all releases |
Code changes from version 4.3.8 to 4.3.9
- addons/buddypress.php +1 -7
- addons/comments.php +17 -14
- addons/contact-form-7.php +14 -20
- addons/gravity-forms.php +1 -7
- addons/ninja-forms.php +5 -10
- addons/registration.php +20 -13
- addons/wpforms.php +1 -7
- inc/admin.php +7 -14
- inc/helpers.php +60 -9
- readme.txt +5 -1
- wordpress-zero-spam.php +22 -7
addons/buddypress.php
CHANGED
@@ -11,13 +11,7 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_bp_signup_validate' ) ) {
|
13 |
function wpzerospam_bp_signup_validate() {
|
14 |
-
|
15 |
-
|
16 |
-
if (
|
17 |
-
'enabled' != $options['verify_bp_registrations'] ||
|
18 |
-
is_user_logged_in() ||
|
19 |
-
wpzerospam_key_check()
|
20 |
-
) {
|
21 |
return;
|
22 |
}
|
23 |
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_bp_signup_validate' ) ) {
|
13 |
function wpzerospam_bp_signup_validate() {
|
14 |
+
if ( is_user_logged_in() || wpzerospam_key_check() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return;
|
16 |
}
|
17 |
|
addons/comments.php
CHANGED
@@ -11,8 +11,7 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_preprocess_comment' ) ) {
|
13 |
function wpzerospam_preprocess_comment( $commentdata ) {
|
14 |
-
$options =
|
15 |
-
|
16 |
if ( 'enabled' != $options['verify_comments'] ) { return $commentdata; }
|
17 |
|
18 |
if (
|
@@ -35,20 +34,24 @@ add_action( 'preprocess_comment', 'wpzerospam_preprocess_comment' );
|
|
35 |
*/
|
36 |
if ( ! function_exists( 'wpzerospam_comment_form' ) ) {
|
37 |
function wpzerospam_comment_form() {
|
38 |
-
$options =
|
|
|
39 |
|
40 |
-
//
|
41 |
-
if (
|
42 |
-
|
43 |
-
wp_enqueue_script(
|
44 |
-
'wpzerospam-addon-comments',
|
45 |
-
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
46 |
-
'/assets/js/addons/wpzerospam-addon-comments.js',
|
47 |
-
[ 'wpzerospam' ],
|
48 |
-
$plugin['Version'],
|
49 |
-
true
|
50 |
-
);
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
}
|
54 |
add_action( 'comment_form', 'wpzerospam_comment_form' );
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_preprocess_comment' ) ) {
|
13 |
function wpzerospam_preprocess_comment( $commentdata ) {
|
14 |
+
$options = get_option( 'wpzerospam' );
|
|
|
15 |
if ( 'enabled' != $options['verify_comments'] ) { return $commentdata; }
|
16 |
|
17 |
if (
|
34 |
*/
|
35 |
if ( ! function_exists( 'wpzerospam_comment_form' ) ) {
|
36 |
function wpzerospam_comment_form() {
|
37 |
+
$options = get_option( 'wpzerospam' );
|
38 |
+
if ( 'enabled' != $options['verify_comments'] ) { return; }
|
39 |
|
40 |
+
// Retrieve the current plugin data (used to get the scripts version)
|
41 |
+
if( ! function_exists('get_plugin_data') ) {
|
42 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
+
$plugin = get_plugin_data( WORDPRESS_ZERO_SPAM );
|
45 |
+
|
46 |
+
// WordPress Zero Spam comment addon
|
47 |
+
wp_enqueue_script(
|
48 |
+
'wpzerospam-addon-comments',
|
49 |
+
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
50 |
+
'/assets/js/addons/wpzerospam-addon-comments.js',
|
51 |
+
[ 'wpzerospam' ],
|
52 |
+
$plugin['Version'],
|
53 |
+
true
|
54 |
+
);
|
55 |
}
|
56 |
}
|
57 |
add_action( 'comment_form', 'wpzerospam_comment_form' );
|
addons/contact-form-7.php
CHANGED
@@ -11,13 +11,7 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_wpcf7_validate' ) ) {
|
13 |
function wpzerospam_wpcf7_validate( $result ) {
|
14 |
-
|
15 |
-
|
16 |
-
if (
|
17 |
-
'enabled' != $options['verify_cf7'] ||
|
18 |
-
is_user_logged_in() ||
|
19 |
-
wpzerospam_key_check()
|
20 |
-
) {
|
21 |
return $result;
|
22 |
}
|
23 |
|
@@ -33,20 +27,20 @@ add_action( 'wpcf7_validate', 'wpzerospam_wpcf7_validate' );
|
|
33 |
*/
|
34 |
if ( ! function_exists( 'wpzerospam_cf7' ) ) {
|
35 |
function wpzerospam_cf7() {
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
if ( 'enabled' == $options['verify_cf7'] ) {
|
40 |
-
// WordPress Zero Spam registration addon
|
41 |
-
wp_enqueue_script(
|
42 |
-
'wpzerospam-addon-cf7',
|
43 |
-
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
44 |
-
'/assets/js/addons/wpzerospam-addon-cf7.js',
|
45 |
-
[ 'wpzerospam' ],
|
46 |
-
$plugin['Version'],
|
47 |
-
true
|
48 |
-
);
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
}
|
52 |
add_action( 'wpcf7_enqueue_scripts', 'wpzerospam_cf7' );
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_wpcf7_validate' ) ) {
|
13 |
function wpzerospam_wpcf7_validate( $result ) {
|
14 |
+
if ( is_user_logged_in() || wpzerospam_key_check() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return $result;
|
16 |
}
|
17 |
|
27 |
*/
|
28 |
if ( ! function_exists( 'wpzerospam_cf7' ) ) {
|
29 |
function wpzerospam_cf7() {
|
30 |
+
// Retrieve the current plugin data (used to get the scripts version)
|
31 |
+
if( ! function_exists('get_plugin_data') ) {
|
32 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
+
$plugin = get_plugin_data( WORDPRESS_ZERO_SPAM );
|
35 |
+
|
36 |
+
wp_enqueue_script(
|
37 |
+
'wpzerospam-addon-cf7',
|
38 |
+
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
39 |
+
'/assets/js/addons/wpzerospam-addon-cf7.js',
|
40 |
+
[ 'wpzerospam' ],
|
41 |
+
$plugin['Version'],
|
42 |
+
true
|
43 |
+
);
|
44 |
}
|
45 |
}
|
46 |
add_action( 'wpcf7_enqueue_scripts', 'wpzerospam_cf7' );
|
addons/gravity-forms.php
CHANGED
@@ -11,13 +11,7 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_gform_validate' ) ) {
|
13 |
function wpzerospam_gform_validate( $form ) {
|
14 |
-
|
15 |
-
|
16 |
-
if (
|
17 |
-
'enabled' != $options['verify_gform'] ||
|
18 |
-
is_user_logged_in() ||
|
19 |
-
wpzerospam_key_check()
|
20 |
-
) {
|
21 |
return;
|
22 |
}
|
23 |
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_gform_validate' ) ) {
|
13 |
function wpzerospam_gform_validate( $form ) {
|
14 |
+
if ( is_user_logged_in() || wpzerospam_key_check() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return;
|
16 |
}
|
17 |
|
addons/ninja-forms.php
CHANGED
@@ -11,11 +11,8 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_ninja_forms_validate' ) ) {
|
13 |
function wpzerospam_ninja_forms_validate( $form_data ) {
|
14 |
-
|
15 |
-
if (
|
16 |
-
'enabled' != $options['verify_ninja_forms'] ||
|
17 |
-
is_user_logged_in()
|
18 |
-
) {
|
19 |
return $form_data;
|
20 |
}
|
21 |
|
@@ -24,6 +21,8 @@ if ( ! function_exists( 'wpzerospam_ninja_forms_validate' ) ) {
|
|
24 |
empty( $form_data['extra']['wpzerospam_key'] ) ||
|
25 |
wpzerospam_get_key() != $form_data['extra']['wpzerospam_key']
|
26 |
) {
|
|
|
|
|
27 |
do_action( 'wpzerospam_ninja_forms_spam' );
|
28 |
|
29 |
wpzerospam_spam_detected( 'ninja_forms', $form_data, false );
|
@@ -54,11 +53,7 @@ if( ! class_exists( 'WordPressZeroSpam_NF_ExtraData' ) ) {
|
|
54 |
var $script_added = false;
|
55 |
|
56 |
public function __construct() {
|
57 |
-
$
|
58 |
-
|
59 |
-
if ( 'enabled' == $options['verify_ninja_forms'] ) {
|
60 |
-
add_action('ninja_forms_before_form_display', [ $this, 'addHooks' ]);
|
61 |
-
}
|
62 |
}
|
63 |
|
64 |
public function addHooks( $form_id ) {
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_ninja_forms_validate' ) ) {
|
13 |
function wpzerospam_ninja_forms_validate( $form_data ) {
|
14 |
+
|
15 |
+
if ( is_user_logged_in() ) {
|
|
|
|
|
|
|
16 |
return $form_data;
|
17 |
}
|
18 |
|
21 |
empty( $form_data['extra']['wpzerospam_key'] ) ||
|
22 |
wpzerospam_get_key() != $form_data['extra']['wpzerospam_key']
|
23 |
) {
|
24 |
+
$options = wpzerospam_options();
|
25 |
+
|
26 |
do_action( 'wpzerospam_ninja_forms_spam' );
|
27 |
|
28 |
wpzerospam_spam_detected( 'ninja_forms', $form_data, false );
|
53 |
var $script_added = false;
|
54 |
|
55 |
public function __construct() {
|
56 |
+
add_action('ninja_forms_before_form_display', [ $this, 'addHooks' ]);
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
public function addHooks( $form_id ) {
|
addons/registration.php
CHANGED
@@ -11,6 +11,9 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_preprocess_registration' ) ) {
|
13 |
function wpzerospam_preprocess_registration( $errors, $sanitized_user_login, $user_email ) {
|
|
|
|
|
|
|
14 |
if ( ! wpzerospam_key_check() ) {
|
15 |
// Spam registration detected
|
16 |
do_action( 'wpzerospam_registration_spam', $errors, $sanitized_user_login, $user_email );
|
@@ -34,20 +37,24 @@ add_filter( 'registration_errors', 'wpzerospam_preprocess_registration', 10, 3 )
|
|
34 |
*/
|
35 |
if ( ! function_exists( 'wpzerospam_registration_form' ) ) {
|
36 |
function wpzerospam_registration_form() {
|
37 |
-
$options =
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
'wpzerospam-addon-registrations',
|
44 |
-
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
45 |
-
'/assets/js/addons/wpzerospam-addon-registrations.js',
|
46 |
-
[ 'wpzerospam' ],
|
47 |
-
$plugin['Version'],
|
48 |
-
true
|
49 |
-
);
|
50 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
}
|
53 |
add_action( 'login_enqueue_scripts', 'wpzerospam_registration_form' );
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_preprocess_registration' ) ) {
|
13 |
function wpzerospam_preprocess_registration( $errors, $sanitized_user_login, $user_email ) {
|
14 |
+
$options = get_option( 'wpzerospam' );
|
15 |
+
if ( 'enabled' != $options['verify_registrations'] ) { return $errors; }
|
16 |
+
|
17 |
if ( ! wpzerospam_key_check() ) {
|
18 |
// Spam registration detected
|
19 |
do_action( 'wpzerospam_registration_spam', $errors, $sanitized_user_login, $user_email );
|
37 |
*/
|
38 |
if ( ! function_exists( 'wpzerospam_registration_form' ) ) {
|
39 |
function wpzerospam_registration_form() {
|
40 |
+
$options = get_option( 'wpzerospam' );
|
41 |
+
if ( 'enabled' != $options['verify_registrations'] ) { return; }
|
42 |
+
|
43 |
+
// Retrieve the current plugin data (used to get the scripts version)
|
44 |
+
if( ! function_exists('get_plugin_data') ) {
|
45 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
+
$plugin = get_plugin_data( WORDPRESS_ZERO_SPAM );
|
48 |
+
|
49 |
+
// WordPress Zero Spam registration addon
|
50 |
+
wp_enqueue_script(
|
51 |
+
'wpzerospam-addon-registrations',
|
52 |
+
plugin_dir_url( WORDPRESS_ZERO_SPAM ) .
|
53 |
+
'/assets/js/addons/wpzerospam-addon-registrations.js',
|
54 |
+
[ 'wpzerospam' ],
|
55 |
+
$plugin['Version'],
|
56 |
+
true
|
57 |
+
);
|
58 |
}
|
59 |
}
|
60 |
add_action( 'login_enqueue_scripts', 'wpzerospam_registration_form' );
|
addons/wpforms.php
CHANGED
@@ -11,13 +11,7 @@
|
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_wpforms_process_honeypot' ) ) {
|
13 |
function wpzerospam_wpforms_process_honeypot( $honeypot, $fields, $entry, $form_data ) {
|
14 |
-
|
15 |
-
|
16 |
-
if (
|
17 |
-
'enabled' != $options['verify_wpforms'] ||
|
18 |
-
is_user_logged_in() ||
|
19 |
-
wpzerospam_key_check()
|
20 |
-
) {
|
21 |
return $honeypot;
|
22 |
}
|
23 |
|
11 |
*/
|
12 |
if ( ! function_exists( 'wpzerospam_wpforms_process_honeypot' ) ) {
|
13 |
function wpzerospam_wpforms_process_honeypot( $honeypot, $fields, $entry, $form_data ) {
|
14 |
+
if ( is_user_logged_in() || wpzerospam_key_check() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
return $honeypot;
|
16 |
}
|
17 |
|
inc/admin.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Admin functionality
|
4 |
*
|
5 |
* @package WordPressZeroSpam
|
6 |
* @since 4.0.0
|
7 |
*/
|
8 |
|
9 |
function wpzerospam_admin_menu() {
|
10 |
-
|
11 |
__( 'WordPress Zero Spam Dashboard', 'wpzerospam' ),
|
12 |
__( 'WP Zero Spam', 'wpzerospam' ),
|
13 |
'manage_options',
|
@@ -266,10 +266,6 @@ function wpzerospam_options_page() {
|
|
266 |
}
|
267 |
|
268 |
function wpzerospam_validate_options( $input ) {
|
269 |
-
if( ! function_exists( 'is_plugin_active' ) ) {
|
270 |
-
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
271 |
-
}
|
272 |
-
|
273 |
if ( empty( $input['log_spam'] ) ) { $input['log_spam'] = 'disabled'; }
|
274 |
if ( empty( $input['verify_comments'] ) ) { $input['verify_comments'] = 'disabled'; }
|
275 |
if ( empty( $input['verify_registrations'] ) ) { $input['verify_registrations'] = 'disabled'; }
|
@@ -278,26 +274,23 @@ function wpzerospam_validate_options( $input ) {
|
|
278 |
if ( empty( $input['auto_block_period'] ) ) { $input['auto_block_period'] = 0; }
|
279 |
|
280 |
|
281 |
-
if (
|
282 |
$input['verify_cf7'] = 'disabled';
|
283 |
}
|
284 |
|
285 |
-
if (
|
286 |
$input['verify_gform'] = 'disabled';
|
287 |
}
|
288 |
|
289 |
-
if (
|
290 |
$input['verify_ninja_forms'] = 'disabled';
|
291 |
}
|
292 |
|
293 |
-
if (
|
294 |
$input['verify_bp_registrations'] = 'disabled';
|
295 |
}
|
296 |
|
297 |
-
if (
|
298 |
-
( is_plugin_active( 'wpforms/wpforms.php' ) || is_plugin_active( 'wpforms-lite/wpforms.php') ) &&
|
299 |
-
empty( $input['verify_wpforms'] )
|
300 |
-
) {
|
301 |
$input['verify_wpforms'] = 'disabled';
|
302 |
}
|
303 |
return $input;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Admin interface & functionality
|
4 |
*
|
5 |
* @package WordPressZeroSpam
|
6 |
* @since 4.0.0
|
7 |
*/
|
8 |
|
9 |
function wpzerospam_admin_menu() {
|
10 |
+
add_menu_page(
|
11 |
__( 'WordPress Zero Spam Dashboard', 'wpzerospam' ),
|
12 |
__( 'WP Zero Spam', 'wpzerospam' ),
|
13 |
'manage_options',
|
266 |
}
|
267 |
|
268 |
function wpzerospam_validate_options( $input ) {
|
|
|
|
|
|
|
|
|
269 |
if ( empty( $input['log_spam'] ) ) { $input['log_spam'] = 'disabled'; }
|
270 |
if ( empty( $input['verify_comments'] ) ) { $input['verify_comments'] = 'disabled'; }
|
271 |
if ( empty( $input['verify_registrations'] ) ) { $input['verify_registrations'] = 'disabled'; }
|
274 |
if ( empty( $input['auto_block_period'] ) ) { $input['auto_block_period'] = 0; }
|
275 |
|
276 |
|
277 |
+
if ( empty( $input['verify_cf7'] ) ) {
|
278 |
$input['verify_cf7'] = 'disabled';
|
279 |
}
|
280 |
|
281 |
+
if ( empty( $input['verify_gform'] ) ) {
|
282 |
$input['verify_gform'] = 'disabled';
|
283 |
}
|
284 |
|
285 |
+
if ( empty( $input['verify_ninja_forms'] ) ) {
|
286 |
$input['verify_ninja_forms'] = 'disabled';
|
287 |
}
|
288 |
|
289 |
+
if ( empty( $input['verify_bp_registrations'] ) ) {
|
290 |
$input['verify_bp_registrations'] = 'disabled';
|
291 |
}
|
292 |
|
293 |
+
if ( empty( $input['verify_wpforms'] ) ) {
|
|
|
|
|
|
|
294 |
$input['verify_wpforms'] = 'disabled';
|
295 |
}
|
296 |
return $input;
|
inc/helpers.php
CHANGED
@@ -307,7 +307,7 @@ if ( ! function_exists( 'wpzerospam_attempt_blocked' ) ) {
|
|
307 |
]);
|
308 |
}
|
309 |
|
310 |
-
wpzerospam_log_spam( 'blocked'
|
311 |
|
312 |
if ( 'redirect' == $options['block_handler'] ) {
|
313 |
wp_redirect( esc_url( $options['blocked_redirect_url'] ) );
|
@@ -320,16 +320,67 @@ if ( ! function_exists( 'wpzerospam_attempt_blocked' ) ) {
|
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
-
*
|
324 |
*/
|
325 |
-
if ( ! function_exists( '
|
326 |
-
function
|
327 |
if( ! function_exists( 'is_plugin_active' ) ) {
|
328 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
329 |
}
|
330 |
|
331 |
$options = get_option( 'wpzerospam' );
|
332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
if ( empty( $options['share_data'] ) ) { $options['share_data'] = 'enabled'; }
|
334 |
if ( empty( $options['auto_block_ips'] ) ) { $options['auto_block_ips'] = 'disabled'; }
|
335 |
if ( empty( $options['auto_block_period'] ) ) { $options['auto_block_period'] = 30; }
|
@@ -344,23 +395,23 @@ if ( ! function_exists( 'wpzerospam_options' ) ) {
|
|
344 |
if ( empty( $options['verify_registrations'] ) ) { $options['verify_registrations'] = 'enabled'; }
|
345 |
if ( empty( $options['log_blocked_ips'] ) ) { $options['log_blocked_ips'] = 'disabled'; }
|
346 |
|
347 |
-
if ( empty( $options['verify_cf7'] )
|
348 |
$options['verify_cf7'] = 'enabled';
|
349 |
}
|
350 |
|
351 |
-
if ( empty( $options['verify_gforms'] )
|
352 |
$options['verify_gforms'] = 'enabled';
|
353 |
}
|
354 |
|
355 |
-
if ( empty( $options['verify_ninja_forms'] )
|
356 |
$options['verify_ninja_forms'] = 'enabled';
|
357 |
}
|
358 |
|
359 |
-
if ( empty( $options['verify_bp_registrations'] )
|
360 |
$options['verify_bp_registrations'] = 'enabled';
|
361 |
}
|
362 |
|
363 |
-
if ( empty( $options['verify_wpforms'] )
|
364 |
$options['verify_wpforms'] = 'enabled';
|
365 |
}
|
366 |
|
307 |
]);
|
308 |
}
|
309 |
|
310 |
+
wpzerospam_log_spam( 'blocked' );
|
311 |
|
312 |
if ( 'redirect' == $options['block_handler'] ) {
|
313 |
wp_redirect( esc_url( $options['blocked_redirect_url'] ) );
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
+
* Checks if a specific plugin integration is turned on & plugin active.
|
324 |
*/
|
325 |
+
if ( ! function_exists( 'wpzerospam_plugin_integration_enabled' ) ) {
|
326 |
+
function wpzerospam_plugin_integration_enabled( $plugin ) {
|
327 |
if( ! function_exists( 'is_plugin_active' ) ) {
|
328 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
329 |
}
|
330 |
|
331 |
$options = get_option( 'wpzerospam' );
|
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 |
+
|
340 |
+
// Handle BuddyPress check a little differently for presence of a function
|
341 |
+
if ( 'bp_registrations' == $plugin ) {
|
342 |
+
if (
|
343 |
+
! empty( $options['verify_bp_registrations'] ) &&
|
344 |
+
'enabled' == $options['verify_bp_registrations']
|
345 |
+
) {
|
346 |
+
return true;
|
347 |
+
} else {
|
348 |
+
return false;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
// Handling all other plugin checks
|
353 |
+
if (
|
354 |
+
! empty( $options['verify_' . $plugin] ) &&
|
355 |
+
'enabled' == $options['verify_' . $plugin ] &&
|
356 |
+
! empty( $integrations[ $plugin ] )
|
357 |
+
) {
|
358 |
+
if ( is_array( $integrations[ $plugin ] ) ) {
|
359 |
+
// Check at least one of the defined plugins are active
|
360 |
+
foreach( $integrations[ $plugin ] as $key => $value ) {
|
361 |
+
if ( is_plugin_active( $value ) ) {
|
362 |
+
return true;
|
363 |
+
}
|
364 |
+
}
|
365 |
+
} else {
|
366 |
+
// Check if one plugin is active
|
367 |
+
if ( is_plugin_active( $integrations[ $plugin ] ) ) {
|
368 |
+
return true;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
return false;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Returns the plugin settings.
|
379 |
+
*/
|
380 |
+
if ( ! function_exists( 'wpzerospam_options' ) ) {
|
381 |
+
function wpzerospam_options() {
|
382 |
+
$options = get_option( 'wpzerospam' );
|
383 |
+
|
384 |
if ( empty( $options['share_data'] ) ) { $options['share_data'] = 'enabled'; }
|
385 |
if ( empty( $options['auto_block_ips'] ) ) { $options['auto_block_ips'] = 'disabled'; }
|
386 |
if ( empty( $options['auto_block_period'] ) ) { $options['auto_block_period'] = 30; }
|
395 |
if ( empty( $options['verify_registrations'] ) ) { $options['verify_registrations'] = 'enabled'; }
|
396 |
if ( empty( $options['log_blocked_ips'] ) ) { $options['log_blocked_ips'] = 'disabled'; }
|
397 |
|
398 |
+
if ( empty( $options['verify_cf7'] ) ) {
|
399 |
$options['verify_cf7'] = 'enabled';
|
400 |
}
|
401 |
|
402 |
+
if ( empty( $options['verify_gforms'] ) ) {
|
403 |
$options['verify_gforms'] = 'enabled';
|
404 |
}
|
405 |
|
406 |
+
if ( empty( $options['verify_ninja_forms'] ) ) {
|
407 |
$options['verify_ninja_forms'] = 'enabled';
|
408 |
}
|
409 |
|
410 |
+
if ( empty( $options['verify_bp_registrations'] ) ) {
|
411 |
$options['verify_bp_registrations'] = 'enabled';
|
412 |
}
|
413 |
|
414 |
+
if ( empty( $options['verify_wpforms'] ) ) {
|
415 |
$options['verify_wpforms'] = 'enabled';
|
416 |
}
|
417 |
|
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.3.
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
@@ -92,6 +92,10 @@ Yes, that's what does the magic and keeps spam bots out.
|
|
92 |
|
93 |
== Changelog ==
|
94 |
|
|
|
|
|
|
|
|
|
95 |
= 4.3.8 =
|
96 |
|
97 |
* Fix for `Call to undefined function wpzerospam_tables()` error
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.4.2
|
7 |
Requires PHP: 7.1
|
8 |
+
Stable tag: 4.3.9
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
92 |
|
93 |
== Changelog ==
|
94 |
|
95 |
+
= 4.3.9 =
|
96 |
+
|
97 |
+
* Fix for `Notice: Undefined index: verify_ninja_form`. See [#195](https://github.com/bmarshall511/wordpress-zero-spam/issues/195)
|
98 |
+
|
99 |
= 4.3.8 =
|
100 |
|
101 |
* Fix for `Call to undefined function wpzerospam_tables()` error
|
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.3.
|
17 |
* Requires at least: 5.2
|
18 |
* Requires PHP: 7.2
|
19 |
* Author: Ben Marshall
|
@@ -104,7 +104,7 @@ require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/updates.php';
|
|
104 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/scripts.php';
|
105 |
|
106 |
/**
|
107 |
-
* Admin interface
|
108 |
*/
|
109 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/admin.php';
|
110 |
|
@@ -113,11 +113,26 @@ require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/admin.php';
|
|
113 |
*/
|
114 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/comments.php';
|
115 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/registration.php';
|
116 |
-
|
117 |
-
|
118 |
-
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
/**
|
123 |
* Plugin redirect functionality
|
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.3.9
|
17 |
* Requires at least: 5.2
|
18 |
* Requires PHP: 7.2
|
19 |
* Author: Ben Marshall
|
104 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/scripts.php';
|
105 |
|
106 |
/**
|
107 |
+
* Admin interface & functionality
|
108 |
*/
|
109 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/inc/admin.php';
|
110 |
|
113 |
*/
|
114 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/comments.php';
|
115 |
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/registration.php';
|
116 |
+
|
117 |
+
if ( wpzerospam_plugin_integration_enabled( 'cf7' ) ) {
|
118 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/contact-form-7.php';
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( wpzerospam_plugin_integration_enabled( 'gforms' ) ) {
|
122 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/gravity-forms.php';
|
123 |
+
}
|
124 |
+
|
125 |
+
if ( wpzerospam_plugin_integration_enabled( 'ninja_forms' ) ) {
|
126 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/ninja-forms.php';
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( wpzerospam_plugin_integration_enabled( 'bp_registrations' ) ) {
|
130 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/buddypress.php';
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( wpzerospam_plugin_integration_enabled( 'wpforms' ) ) {
|
134 |
+
require plugin_dir_path( WORDPRESS_ZERO_SPAM ) . '/addons/wpforms.php';
|
135 |
+
}
|
136 |
|
137 |
/**
|
138 |
* Plugin redirect functionality
|