| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | /** |
| 17 | 17 | * @return bool |
| 18 | 18 | */ |
| 19 | 19 | public function check() { |
| 20 | - $mod_keys = trim( $this->get_disallowed_words() ); | |
| 20 | + $mod_keys = trim( get_option( 'disallowed_keys' ) ); | |
| 21 | 21 | |
| 22 | 22 | if ( ! $mod_keys ) { |
| 23 | 23 | return false; |
| 24 | 24 | } |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | $ip = FrmAppHelper::get_ip_address(); |
| 31 | 31 | $user_agent = FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ); |
| 32 | 32 | $user_info = FrmEntryValidate::get_spam_check_user_info( $values ); |
| 33 | 33 | |
| 34 | - return $this->do_check_wp_disallowed_words( | |
| 34 | + return wp_check_comment_disallowed_list( | |
| 35 | 35 | $user_info['comment_author'], |
| 36 | 36 | $user_info['comment_author_email'], |
| 37 | 37 | $user_info['comment_author_url'], |
| 38 | 38 | $content, |
| @@ -38,45 +38,8 @@ | ||
| 38 | 38 | $content, |
| 39 | 39 | $ip, |
| 40 | 40 | $user_agent |
| 41 | 41 | ); |
| 42 | - } | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * For WP 5.5 compatibility. | |
| 46 | - * | |
| 47 | - * @return string | |
| 48 | - */ | |
| 49 | - private function get_disallowed_words() { | |
| 50 | - $keys = get_option( 'disallowed_keys' ); | |
| 51 | - | |
| 52 | - if ( false === $keys ) { | |
| 53 | - // Fallback for WP < 5.5. | |
| 54 | - // phpcs:ignore WordPress.WP.DeprecatedParameterValues.Found | |
| 55 | - return get_option( 'blacklist_keys' ); | |
| 56 | - } | |
| 57 | - | |
| 58 | - return $keys; | |
| 59 | - } | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * For WP 5.5 compatibility. | |
| 63 | - * | |
| 64 | - * @param string $author | |
| 65 | - * @param string $email | |
| 66 | - * @param string $url | |
| 67 | - * @param string $content | |
| 68 | - * @param string $ip | |
| 69 | - * @param string $user_agent | |
| 70 | - * | |
| 71 | - * @return bool Return `true` if contains disallowed words. | |
| 72 | - */ | |
| 73 | - private function do_check_wp_disallowed_words( $author, $email, $url, $content, $ip, $user_agent ) { | |
| 74 | - if ( function_exists( 'wp_check_comment_disallowed_list' ) ) { | |
| 75 | - return wp_check_comment_disallowed_list( $author, $email, $url, $content, $ip, $user_agent ); | |
| 76 | - } | |
| 77 | - // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_blacklist_checkFound | |
| 78 | - return wp_blacklist_check( $author, $email, $url, $content, $ip, $user_agent ); | |
| 79 | 42 | } |
| 80 | 43 | |
| 81 | 44 | protected function is_enabled() { |
| 82 | 45 | return apply_filters( 'frm_check_blacklist', true, $this->values ); |