PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmSpamCheckWPDisallowedWords.php +8 -31 6.25 → trunk View file →
@@ -2,8 +2,9 @@
2 2 /**
3 3 * Spam check using WordPress disallowed words
4 4 *
5 5 * @since 6.21
6 + *
6 7 * @package Formidable
7 8 */
8 9
9 10 if ( ! defined( 'ABSPATH' ) ) {
@@ -11,11 +12,15 @@
11 12 }
12 13
13 14 class FrmSpamCheckWPDisallowedWords extends FrmSpamCheck {
14 15
16 + /**
17 + * @return bool
18 + */
15 19 public function check() {
16 - $mod_keys = trim( $this->get_disallowed_words() );
17 - if ( empty( $mod_keys ) ) {
20 + $mod_keys = trim( get_option( 'disallowed_keys' ) );
21 +
22 + if ( ! $mod_keys ) {
18 23 return false;
19 24 }
20 25
21 26 $values = $this->values;
@@ -25,9 +30,9 @@
25 30 $ip = FrmAppHelper::get_ip_address();
26 31 $user_agent = FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' );
27 32 $user_info = FrmEntryValidate::get_spam_check_user_info( $values );
28 33
29 - return $this->do_check_wp_disallowed_words(
34 + return wp_check_comment_disallowed_list(
30 35 $user_info['comment_author'],
31 36 $user_info['comment_author_email'],
32 37 $user_info['comment_author_url'],
33 38 $content,
@@ -33,36 +38,8 @@
33 38 $content,
34 39 $ip,
35 40 $user_agent
36 41 );
37 - }
38 -
39 - /**
40 - * For WP 5.5 compatibility.
41 - *
42 - * @return string
43 - */
44 - private function get_disallowed_words() {
45 - $keys = get_option( 'disallowed_keys' );
46 - if ( false === $keys ) {
47 - // Fallback for WP < 5.5.
48 - // phpcs:ignore WordPress.WP.DeprecatedParameterValues.Found
49 - $keys = get_option( 'blacklist_keys' );
50 - }
51 - return $keys;
52 - }
53 -
54 - /**
55 - * For WP 5.5 compatibility.
56 - *
57 - * @return bool Return `true` if contains disallowed words.
58 - */
59 - private function do_check_wp_disallowed_words( $author, $email, $url, $content, $ip, $user_agent ) {
60 - if ( function_exists( 'wp_check_comment_disallowed_list' ) ) {
61 - return wp_check_comment_disallowed_list( $author, $email, $url, $content, $ip, $user_agent );
62 - }
63 - // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_blacklist_checkFound
64 - return wp_blacklist_check( $author, $email, $url, $content, $ip, $user_agent );
65 42 }
66 43
67 44 protected function is_enabled() {
68 45 return apply_filters( 'frm_check_blacklist', true, $this->values );