Completed
Push — master ( 762520...3540af )
by Stephanie
04:40
created
classes/models/FrmEntryValidate.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmEntryValidate {
4
-    public static function validate( $values, $exclude = false ) {
5
-        FrmEntry::sanitize_entry_post( $values );
6
-        $errors = array();
4
+	public static function validate( $values, $exclude = false ) {
5
+		FrmEntry::sanitize_entry_post( $values );
6
+		$errors = array();
7 7
 
8
-        if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) {
9
-            $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
10
-            return $errors;
11
-        }
8
+		if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) {
9
+			$errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
10
+			return $errors;
11
+		}
12 12
 
13 13
 		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
14
-            $errors['form'] = __( 'You do not have permission to do that', 'formidable' );
15
-        }
14
+			$errors['form'] = __( 'You do not have permission to do that', 'formidable' );
15
+		}
16 16
 
17 17
 		self::set_item_key( $values );
18 18
 
@@ -69,24 +69,24 @@  discard block
 block discarded – undo
69 69
 		return FrmField::getAll( $where, 'field_order' );
70 70
 	}
71 71
 
72
-    public static function validate_field( $posted_field, &$errors, $values, $args = array() ) {
73
-        $defaults = array(
74
-            'id'              => $posted_field->id,
75
-            'parent_field_id' => '', // the id of the repeat or embed form
76
-            'key_pointer'     => '', // the pointer in the posted array
77
-            'exclude'         => array(), // exclude these field types from validation
78
-        );
79
-        $args = wp_parse_args( $args, $defaults );
72
+	public static function validate_field( $posted_field, &$errors, $values, $args = array() ) {
73
+		$defaults = array(
74
+			'id'              => $posted_field->id,
75
+			'parent_field_id' => '', // the id of the repeat or embed form
76
+			'key_pointer'     => '', // the pointer in the posted array
77
+			'exclude'         => array(), // exclude these field types from validation
78
+		);
79
+		$args = wp_parse_args( $args, $defaults );
80 80
 
81
-        if ( empty($args['parent_field_id']) ) {
81
+		if ( empty($args['parent_field_id']) ) {
82 82
 			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
83
-        } else {
84
-            // value is from a nested form
85
-            $value = $values;
86
-        }
83
+		} else {
84
+			// value is from a nested form
85
+			$value = $values;
86
+		}
87 87
 
88
-        // Check for values in "Other" fields
89
-        FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
88
+		// Check for values in "Other" fields
89
+		FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
90 90
 
91 91
 		self::maybe_clear_value_for_default_blank_setting( $posted_field, $value );
92 92
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 			$value = reset($value);
96 96
 		}
97 97
 
98
-        if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) {
98
+		if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) {
99 99
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
100
-        } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) {
101
-            $_POST['item_name'] = $value;
102
-        }
100
+		} else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) {
101
+			$_POST['item_name'] = $value;
102
+		}
103 103
 
104 104
 		if ( $value != '' ) {
105 105
 			self::validate_url_field( $errors, $posted_field, $value, $args );
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 			self::validate_phone_field( $errors, $posted_field, $value, $args );
109 109
 		}
110 110
 
111
-        FrmEntriesHelper::set_posted_value($posted_field, $value, $args);
111
+		FrmEntriesHelper::set_posted_value($posted_field, $value, $args);
112 112
 
113
-        self::validate_recaptcha($errors, $posted_field, $args);
113
+		self::validate_recaptcha($errors, $posted_field, $args);
114 114
 
115 115
 		$errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args );
116 116
 		$errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
117
-    }
117
+	}
118 118
 
119 119
 	private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) {
120 120
 		if ( FrmField::is_option_true_in_object( $field, 'default_blank' ) && $value == $field->default_value ) {
@@ -124,32 +124,32 @@  discard block
 block discarded – undo
124 124
 
125 125
 	public static function validate_url_field( &$errors, $field, &$value, $args ) {
126 126
 		if ( $value == '' || ! in_array( $field->type, array( 'website', 'url', 'image' ) ) ) {
127
-            return;
128
-        }
127
+			return;
128
+		}
129 129
 
130
-        if ( trim($value) == 'http://' ) {
131
-            $value = '';
132
-        } else {
133
-            $value = esc_url_raw( $value );
130
+		if ( trim($value) == 'http://' ) {
131
+			$value = '';
132
+		} else {
133
+			$value = esc_url_raw( $value );
134 134
 			$value = preg_match( '/^(https?|ftps?|mailto|news|feed|telnet):/is', $value ) ? $value : 'http://' . $value;
135
-        }
135
+		}
136 136
 
137
-        // validate the url format
137
+		// validate the url format
138 138
 		if ( ! preg_match('/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value) ) {
139 139
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
140 140
 		}
141
-    }
141
+	}
142 142
 
143 143
 	public static function validate_email_field( &$errors, $field, $value, $args ) {
144
-        if ( $value == '' || $field->type != 'email' ) {
145
-            return;
146
-        }
144
+		if ( $value == '' || $field->type != 'email' ) {
145
+			return;
146
+		}
147 147
 
148
-        //validate the email format
149
-        if ( ! is_email($value) ) {
148
+		//validate the email format
149
+		if ( ! is_email($value) ) {
150 150
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
151
-        }
152
-    }
151
+		}
152
+	}
153 153
 
154 154
 	public static function validate_number_field( &$errors, $field, $value, $args ) {
155 155
 		//validate the number format
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 
245 245
 	public static function validate_recaptcha( &$errors, $field, $args ) {
246
-        if ( $field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters( 'frm_is_field_hidden', false, $field, stripslashes_deep( $_POST ) ) ) {
247
-            return;
248
-        }
246
+		if ( $field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters( 'frm_is_field_hidden', false, $field, stripslashes_deep( $_POST ) ) ) {
247
+			return;
248
+		}
249 249
 
250 250
 		$frm_settings = FrmAppHelper::get_settings();
251 251
 		if ( empty( $frm_settings->pubkey ) ) {
@@ -253,61 +253,61 @@  discard block
 block discarded – undo
253 253
 			return;
254 254
 		}
255 255
 
256
-        if ( ! isset($_POST['g-recaptcha-response']) ) {
257
-            // If captcha is missing, check if it was already verified
256
+		if ( ! isset($_POST['g-recaptcha-response']) ) {
257
+			// If captcha is missing, check if it was already verified
258 258
 			if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $_POST['recaptcha_checked'], 'frm_ajax' ) ) {
259
-                // There was no captcha submitted
259
+				// There was no captcha submitted
260 260
 				$errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' );
261
-            }
262
-            return;
263
-        }
261
+			}
262
+			return;
263
+		}
264 264
 
265
-        $arg_array = array(
266
-            'body'      => array(
265
+		$arg_array = array(
266
+			'body'      => array(
267 267
 				'secret'   => $frm_settings->privkey,
268 268
 				'response' => $_POST['g-recaptcha-response'],
269 269
 				'remoteip' => FrmAppHelper::get_ip_address(),
270 270
 			),
271 271
 		);
272
-        $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array );
273
-        $response = json_decode(wp_remote_retrieve_body( $resp ), true);
272
+		$resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array );
273
+		$response = json_decode(wp_remote_retrieve_body( $resp ), true);
274 274
 
275
-        if ( isset( $response['success'] ) && ! $response['success'] ) {
276
-            // What happens when the CAPTCHA was entered incorrectly
275
+		if ( isset( $response['success'] ) && ! $response['success'] ) {
276
+			// What happens when the CAPTCHA was entered incorrectly
277 277
 			$errors[ 'field' . $args['id'] ] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid'];
278
-        } else if ( is_wp_error( $resp ) ) {
278
+		} else if ( is_wp_error( $resp ) ) {
279 279
 			$error_string = $resp->get_error_message();
280 280
 			$errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your recaptcha', 'formidable' );
281 281
 			$errors[ 'field' . $args['id'] ] .= ' ' . $error_string;
282
-        }
283
-    }
284
-
285
-    /**
286
-     * check for spam
287
-     * @param boolean $exclude
288
-     * @param array $values
289
-     * @param array $errors by reference
290
-     */
291
-    public static function spam_check( $exclude, $values, &$errors ) {
292
-        if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
293
-            // only check spam if there are no other errors
294
-            return;
295
-        }
282
+		}
283
+	}
284
+
285
+	/**
286
+	 * check for spam
287
+	 * @param boolean $exclude
288
+	 * @param array $values
289
+	 * @param array $errors by reference
290
+	 */
291
+	public static function spam_check( $exclude, $values, &$errors ) {
292
+		if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
293
+			// only check spam if there are no other errors
294
+			return;
295
+		}
296 296
 
297 297
 		if ( self::is_honeypot_spam() || self::is_spam_bot() ) {
298 298
 			$errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
299 299
 		}
300 300
 
301
-    	if ( self::blacklist_check( $values ) ) {
302
-            $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
303
-    	}
301
+		if ( self::blacklist_check( $values ) ) {
302
+			$errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
303
+		}
304 304
 
305
-        if ( self::is_akismet_spam( $values ) ) {
305
+		if ( self::is_akismet_spam( $values ) ) {
306 306
 			if ( self::is_akismet_enabled_for_user( $values['form_id'] ) ) {
307 307
 				$errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
308 308
 			}
309
-	    }
310
-    }
309
+		}
310
+	}
311 311
 
312 312
 	private static function is_honeypot_spam() {
313 313
 		$honeypot_value = FrmAppHelper::get_param( 'frm_verify', '', 'get', 'sanitize_text_field' );
@@ -329,15 +329,15 @@  discard block
 block discarded – undo
329 329
 		return ( isset( $form->options['akismet'] ) && ! empty( $form->options['akismet'] ) && ( $form->options['akismet'] != 'logged' || ! is_user_logged_in() ) );
330 330
 	}
331 331
 
332
-    public static function blacklist_check( $values ) {
333
-        if ( ! apply_filters('frm_check_blacklist', true, $values) ) {
334
-            return false;
335
-        }
332
+	public static function blacklist_check( $values ) {
333
+		if ( ! apply_filters('frm_check_blacklist', true, $values) ) {
334
+			return false;
335
+		}
336 336
 
337
-    	$mod_keys = trim( get_option( 'blacklist_keys' ) );
338
-    	if ( empty( $mod_keys ) ) {
339
-    		return false;
340
-    	}
337
+		$mod_keys = trim( get_option( 'blacklist_keys' ) );
338
+		if ( empty( $mod_keys ) ) {
339
+			return false;
340
+		}
341 341
 
342 342
 		$content = FrmEntriesHelper::entry_array_to_string( $values );
343 343
 		if ( empty( $content ) ) {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 		$user_info = self::get_spam_check_user_info( $values );
350 350
 
351 351
 		return wp_blacklist_check( $user_info['comment_author'], $user_info['comment_author_email'], $user_info['comment_author_url'], $content, $ip, $user_agent );
352
-    }
352
+	}
353 353
 
354 354
 	/**
355 355
 	 * Check entries for Akismet spam
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
         FrmEntry::sanitize_entry_post( $values );
6 6
         $errors = array();
7 7
 
8
-        if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) {
8
+        if ( ! isset( $values['form_id'] ) || ! isset( $values['item_meta'] ) ) {
9 9
             $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
10 10
             return $errors;
11 11
         }
12 12
 
13
-		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
13
+		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) {
14 14
             $errors['form'] = __( 'You do not have permission to do that', 'formidable' );
15 15
         }
16 16
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			unset( $posted_field );
43 43
 		}
44 44
 
45
-		$errors = apply_filters( 'frm_validate_entry', $errors, $values, compact('exclude') );
45
+		$errors = apply_filters( 'frm_validate_entry', $errors, $values, compact( 'exclude' ) );
46 46
 
47 47
 		return $errors;
48 48
 	}
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
         );
79 79
         $args = wp_parse_args( $args, $defaults );
80 80
 
81
-        if ( empty($args['parent_field_id']) ) {
82
-			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
81
+        if ( empty( $args['parent_field_id'] ) ) {
82
+			$value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : '';
83 83
         } else {
84 84
             // value is from a nested form
85 85
             $value = $values;
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 		self::maybe_clear_value_for_default_blank_setting( $posted_field, $value );
92 92
 
93 93
 		// Reset arrays with only one value if it's not a field where array keys need to be preserved
94
-		if ( is_array($value) && count( $value ) == 1 && isset( $value[0] ) ) {
95
-			$value = reset($value);
94
+		if ( is_array( $value ) && count( $value ) == 1 && isset( $value[0] ) ) {
95
+			$value = reset( $value );
96 96
 		}
97 97
 
98 98
         if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) {
99
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
99
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
100 100
         } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) {
101 101
             $_POST['item_name'] = $value;
102 102
         }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 			self::validate_phone_field( $errors, $posted_field, $value, $args );
109 109
 		}
110 110
 
111
-        FrmEntriesHelper::set_posted_value($posted_field, $value, $args);
111
+        FrmEntriesHelper::set_posted_value( $posted_field, $value, $args );
112 112
 
113
-        self::validate_recaptcha($errors, $posted_field, $args);
113
+        self::validate_recaptcha( $errors, $posted_field, $args );
114 114
 
115 115
 		$errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args );
116 116
 		$errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             return;
128 128
         }
129 129
 
130
-        if ( trim($value) == 'http://' ) {
130
+        if ( trim( $value ) == 'http://' ) {
131 131
             $value = '';
132 132
         } else {
133 133
             $value = esc_url_raw( $value );
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
         }
136 136
 
137 137
         // validate the url format
138
-		if ( ! preg_match('/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value) ) {
139
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
138
+		if ( ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) {
139
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
140 140
 		}
141 141
     }
142 142
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
         }
147 147
 
148 148
         //validate the email format
149
-        if ( ! is_email($value) ) {
150
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
149
+        if ( ! is_email( $value ) ) {
150
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
151 151
         }
152 152
     }
153 153
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 			return;
158 158
 		}
159 159
 
160
-		if ( ! is_numeric( $value) ) {
161
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
160
+		if ( ! is_numeric( $value ) ) {
161
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
162 162
 		}
163 163
 
164 164
 		// validate number settings
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
 			if ( $frm_settings->use_html && isset( $field->field_options['minnum'] ) && isset( $field->field_options['maxnum'] ) ) {
169 169
 				//minnum maxnum
170 170
 				if ( (float) $value < $field->field_options['minnum'] ) {
171
-					$errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' );
171
+					$errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' );
172 172
 				} else if ( (float) $value > $field->field_options['maxnum'] ) {
173
-					$errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' );
173
+					$errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' );
174 174
 				}
175 175
 			}
176 176
 		}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			$pattern = self::phone_format( $field );
183 183
 
184 184
 			if ( ! preg_match( $pattern, $value ) ) {
185
-				$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
185
+				$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
186 186
 			}
187 187
 		}
188 188
 	}
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 			return;
254 254
 		}
255 255
 
256
-        if ( ! isset($_POST['g-recaptcha-response']) ) {
256
+        if ( ! isset( $_POST['g-recaptcha-response'] ) ) {
257 257
             // If captcha is missing, check if it was already verified
258 258
 			if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $_POST['recaptcha_checked'], 'frm_ajax' ) ) {
259 259
                 // There was no captcha submitted
260
-				$errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' );
260
+				$errors['field' . $args['id']] = __( 'The captcha is missing from this form', 'formidable' );
261 261
             }
262 262
             return;
263 263
         }
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
 			),
271 271
 		);
272 272
         $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array );
273
-        $response = json_decode(wp_remote_retrieve_body( $resp ), true);
273
+        $response = json_decode( wp_remote_retrieve_body( $resp ), true );
274 274
 
275 275
         if ( isset( $response['success'] ) && ! $response['success'] ) {
276 276
             // What happens when the CAPTCHA was entered incorrectly
277
-			$errors[ 'field' . $args['id'] ] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid'];
277
+			$errors['field' . $args['id']] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid'];
278 278
         } else if ( is_wp_error( $resp ) ) {
279 279
 			$error_string = $resp->get_error_message();
280
-			$errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your recaptcha', 'formidable' );
281
-			$errors[ 'field' . $args['id'] ] .= ' ' . $error_string;
280
+			$errors['field' . $args['id']] = __( 'There was a problem verifying your recaptcha', 'formidable' );
281
+			$errors['field' . $args['id']] .= ' ' . $error_string;
282 282
         }
283 283
     }
284 284
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 	private static function is_akismet_spam( $values ) {
323 323
 		global $wpcom_api_key;
324
-		return ( is_callable('Akismet::http_post') && ( get_option('wordpress_api_key') || $wpcom_api_key ) && self::akismet( $values ) );
324
+		return ( is_callable( 'Akismet::http_post' ) && ( get_option( 'wordpress_api_key' ) || $wpcom_api_key ) && self::akismet( $values ) );
325 325
 	}
326 326
 
327 327
 	private static function is_akismet_enabled_for_user( $form_id ) {
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	}
331 331
 
332 332
     public static function blacklist_check( $values ) {
333
-        if ( ! apply_filters('frm_check_blacklist', true, $values) ) {
333
+        if ( ! apply_filters( 'frm_check_blacklist', true, $values ) ) {
334 334
             return false;
335 335
         }
336 336
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		$datas['user_agent'] = FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' );
387 387
 		$datas['referrer'] = isset( $_SERVER['HTTP_REFERER'] ) ? FrmAppHelper::get_server_value( 'HTTP_REFERER' ) : false;
388 388
 		$datas['blog_lang'] = get_locale();
389
-		$datas['blog_charset'] = get_option('blog_charset');
389
+		$datas['blog_charset'] = get_option( 'blog_charset' );
390 390
 
391 391
 		if ( akismet_test_mode() ) {
392 392
 			$datas['is_test'] = 'true';
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 			// Send any potentially useful $_SERVER vars, but avoid sending junk we don't need.
442 442
 			if ( $include_value ) {
443
-				$datas[ $key ] = $value;
443
+				$datas[$key] = $value;
444 444
 			}
445 445
 			unset( $key, $value );
446 446
 		}
Please login to merge, or discard this patch.