PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / trunk
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder vtrunk
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
← All changes | app/Modules/Form/AkismetHandler.php +28 -18 3.6.40 → trunk View file →
@@ -14,9 +14,9 @@
14 14 return false;
15 15 }
16 16
17 17 $settings = get_option('_fluentform_global_form_settings');
18 - return $settings && ArrayHelper::get($settings, 'misc.akismet_status') == 'yes';
18 + return $settings && 'yes' == ArrayHelper::get($settings, 'misc.akismet_status');
19 19 }
20 20
21 21 public static function isPluginEnabled()
22 22 {
@@ -30,35 +30,35 @@
30 30 public static function isSpamSubmission($formData, $form)
31 31 {
32 32 global $akismet_api_host, $akismet_api_port;
33 33 $fields = self::getAkismetFields($formData, $form);
34 - $response = \Akismet::http_post( $fields, 'comment-check' );
34 + $response = \Akismet::http_post($fields, 'comment-check');
35 35
36 - return ArrayHelper::get($response, 1) == 'true';
36 + return 'true' == ArrayHelper::get($response, 1);
37 37 }
38 38
39 39 protected static function getAkismetFields($data, $form)
40 40 {
41 41 $app = wpFluentForm();
42 - $ip = $app->request->getIp();
42 + $ip = sanitize_text_field($app->request->getIp());
43 43
44 44 $info = [
45 - 'comment_type' => 'contact-form',
46 - 'comment_author' => '',
45 + 'comment_type' => 'contact-form',
46 + 'comment_author' => '',
47 47 'comment_author_email' => '',
48 - 'comment_content' => '',
48 + 'comment_content' => '',
49 49 'contact_form_subject' => $form->title,
50 - 'comment_author_IP' => $ip,
51 - 'permalink' => urlencode($data['_wp_http_referer']),
52 - 'user_ip' => preg_replace('/[^0-9., ]/', '', $ip),
53 - 'user_agent' => $app->request->header('USER_AGENT'),
54 - 'blog' => get_option('home')
50 + 'comment_author_IP' => $ip,
51 + 'permalink' => urlencode($data['_wp_http_referer']),
52 + 'user_ip' => preg_replace('/[^0-9., ]/', '', $ip),
53 + 'user_agent' => $app->request->header('USER_AGENT'),
54 + 'blog' => get_option('home'),
55 55 ];
56 56
57 57 $maps = [
58 - 'input_name' => 'comment_author',
58 + 'input_name' => 'comment_author',
59 59 'input_email' => 'comment_author_email',
60 - 'textarea' => 'comment_content'
60 + 'textarea' => 'comment_content',
61 61 ];
62 62 $inputs = FormFieldsParser::getInputs($form, ['attributes']);
63 63
64 64 foreach ($inputs as $input) {
@@ -73,12 +73,22 @@
73 73 $info[$maps[$element]] = $value;
74 74 }
75 75 }
76 76 }
77 +
78 + $info = apply_filters_deprecated(
79 + 'fluentform_akismet_fields',
80 + [
81 + $info,
82 + $data,
83 + $form
84 + ],
85 + FLUENTFORM_FRAMEWORK_UPGRADE,
86 + 'fluentform/akismet_fields',
87 + 'Use fluentform/akismet_fields instead of fluentform_akismet_fields.'
88 + );
77 89
78 - $info = apply_filters('fluentform_akismet_fields', $info, $data, $form);
90 + $info = apply_filters('fluentform/akismet_fields', $info, $data, $form);
79 91
80 92 return http_build_query($info);
81 -
82 93 }
83 -
84 -}
94 +}