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 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / modules / disallowed-list.php
contact-form-7 / modules Last commit date
akismet 1 year ago constant-contact 1 year ago recaptcha 1 year ago sendinblue 1 year ago stripe 1 year ago acceptance.php 1 year ago checkbox.php 1 year ago count.php 1 year ago date.php 1 year ago disallowed-list.php 1 year ago doi-helper.php 4 years ago file.php 1 year ago flamingo.php 1 year ago hidden.php 7 years ago listo.php 2 years ago number.php 1 year ago quiz.php 1 year ago really-simple-captcha.php 1 year ago reflection.php 3 years ago response.php 6 years ago select.php 1 year ago submit.php 1 year ago text.php 1 year ago textarea.php 1 year ago
disallowed-list.php
92 lines
1 <?php
2
3 add_filter( 'wpcf7_spam', 'wpcf7_disallowed_list', 10, 2 );
4
5 function wpcf7_disallowed_list( $spam, $submission ) {
6 if ( $spam ) {
7 return $spam;
8 }
9
10 $target = wpcf7_array_flatten( $submission->get_posted_data() );
11 $target[] = $submission->get_meta( 'remote_ip' );
12 $target[] = $submission->get_meta( 'user_agent' );
13 $target = implode( "\n", $target );
14
15 $word = wpcf7_check_disallowed_list( $target );
16
17 $word = wpcf7_apply_filters_deprecated(
18 'wpcf7_submission_is_blacklisted',
19 array( $word, $submission ),
20 '5.3',
21 'wpcf7_submission_has_disallowed_words'
22 );
23
24 $word = apply_filters(
25 'wpcf7_submission_has_disallowed_words',
26 $word,
27 $submission
28 );
29
30 if ( $word ) {
31 if ( is_bool( $word ) ) {
32 $reason = __( "Disallowed words are used.", 'contact-form-7' );
33 } else {
34 $reason = sprintf(
35 /* translators: %s: comma separated list of disallowed words */
36 __( "Disallowed words (%s) are used.", 'contact-form-7' ),
37 implode( ', ', (array) $word )
38 );
39 }
40
41 $submission->add_spam_log( array(
42 'agent' => 'disallowed_list',
43 'reason' => $reason,
44 ) );
45 }
46
47 $spam = (bool) $word;
48
49 return $spam;
50 }
51
52 function wpcf7_check_disallowed_list( $target ) {
53 $mod_keys = get_option( 'disallowed_keys' );
54
55 if ( is_scalar( $mod_keys ) ) {
56 $mod_keys = trim( $mod_keys );
57 } else {
58 $mod_keys = '';
59 }
60
61 if ( '' === $mod_keys ) {
62 return false;
63 }
64
65 foreach ( explode( "\n", $mod_keys ) as $word ) {
66 $word = trim( $word );
67 $length = strlen( $word );
68
69 if ( $length < 2 or 256 < $length ) {
70 continue;
71 }
72
73 $pattern = sprintf( '#%s#i', preg_quote( $word, '#' ) );
74
75 if ( preg_match( $pattern, $target ) ) {
76 return $word;
77 }
78 }
79
80 return false;
81 }
82
83 function wpcf7_blacklist_check( $target ) {
84 wpcf7_deprecated_function(
85 __FUNCTION__,
86 '5.3',
87 'wpcf7_check_disallowed_list'
88 );
89
90 return wpcf7_check_disallowed_list( $target );
91 }
92