| @@ -33,10 +33,9 @@ | ||
| 33 | 33 | /** |
| 34 | 34 | * @return bool |
| 35 | 35 | */ |
| 36 | 36 | private static function is_enabled() { |
| 37 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 38 | - return $frm_settings->honeypot; | |
| 37 | + return (bool) FrmAppHelper::get_settings()->honeypot; | |
| 39 | 38 | } |
| 40 | 39 | |
| 41 | 40 | /** |
| 42 | 41 | * @return bool |
| @@ -42,9 +41,9 @@ | ||
| 42 | 41 | * @return bool |
| 43 | 42 | */ |
| 44 | 43 | public function validate() { |
| 45 | 44 | if ( ! $this->is_option_on() || ! $this->check_honeypot_filter() ) { |
| 46 | - // never flag as honeypot spam if disabled. | |
| 45 | + // Never flag as honeypot spam if disabled. | |
| 47 | 46 | return true; |
| 48 | 47 | } |
| 49 | 48 | return ! $this->is_honeypot_spam(); |
| 50 | 49 | } |
| @@ -55,9 +54,8 @@ | ||
| 55 | 54 | private function is_honeypot_spam() { |
| 56 | 55 | $is_honeypot_spam = $this->is_legacy_honeypot_spam(); |
| 57 | 56 | |
| 58 | 57 | if ( ! $is_honeypot_spam ) { |
| 59 | - | |
| 60 | 58 | $field_id = $this->get_honeypot_field_id(); |
| 61 | 59 | |
| 62 | 60 | if ( ! $field_id ) { |
| 63 | 61 | return false; |
| @@ -121,10 +119,9 @@ | ||
| 121 | 119 | |
| 122 | 120 | global $frm_vars; |
| 123 | 121 | $offset = isset( $frm_vars['honeypot_selectors'] ) ? count( $frm_vars['honeypot_selectors'] ) + 1 : 1; |
| 124 | 122 | $honeypot_field_id = $max_field_id ? $max_field_id + $offset : $offset; |
| 125 | - | |
| 126 | - $class = class_exists( 'FrmProFormState' ) ? 'FrmProFormState' : 'FrmFormState'; | |
| 123 | + $class = class_exists( 'FrmProFormState' ) ? 'FrmProFormState' : 'FrmFormState'; | |
| 127 | 124 | $class::set_initial_value( 'honeypot_field_id', $honeypot_field_id ); |
| 128 | 125 | |
| 129 | 126 | $honeypot->render_field( $honeypot_field_id ); |
| 130 | 127 | self::maybe_print_honeypot_css(); |
| @@ -241,8 +238,9 @@ | ||
| 241 | 238 | ); |
| 242 | 239 | |
| 243 | 240 | $container_id = 'frm_field_' . $field_id . '_container'; |
| 244 | 241 | $this->track_html_id( $container_id ); |
| 242 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 245 | 243 | ?> |
| 246 | 244 | <div id="<?php echo esc_attr( $container_id ); ?>"> |
| 247 | 245 | <label for="<?php echo esc_attr( $input_attrs['id'] ); ?>" <?php FrmFormsHelper::maybe_hide_inline(); ?>> |
| 248 | 246 | <?php esc_html_e( 'If you are human, leave this field blank.', 'formidable' ); ?> |
| @@ -249,8 +247,9 @@ | ||
| 249 | 247 | </label> |
| 250 | 248 | <input <?php FrmAppHelper::array_to_html_params( $input_attrs, true ); ?> <?php FrmFormsHelper::maybe_hide_inline(); ?> /> |
| 251 | 249 | </div> |
| 252 | 250 | <?php |
| 251 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 253 | 252 | } |
| 254 | 253 | |
| 255 | 254 | /** |
| 256 | 255 | * @param string $html_id |
| @@ -270,11 +269,10 @@ | ||
| 270 | 269 | /** |
| 271 | 270 | * @return int |
| 272 | 271 | */ |
| 273 | 272 | private function get_honeypot_field_id() { |
| 274 | - $class = class_exists( 'FrmProFormState' ) ? 'FrmProFormState' : 'FrmFormState'; | |
| 275 | - $honeypot_field_id = $class::get_from_request( 'honeypot_field_id', 0 ); | |
| 276 | - return $honeypot_field_id; | |
| 273 | + $class = class_exists( 'FrmProFormState' ) ? 'FrmProFormState' : 'FrmFormState'; | |
| 274 | + return $class::get_from_request( 'honeypot_field_id', 0 ); | |
| 277 | 275 | } |
| 278 | 276 | |
| 279 | 277 | /** |
| 280 | 278 | * @return string |
| @@ -335,7 +333,8 @@ | ||
| 335 | 333 | if ( ! is_string( $option ) ) { |
| 336 | 334 | // For backward compatibility use the old class name. |
| 337 | 335 | return 'frm_verify'; |
| 338 | 336 | } |
| 337 | + | |
| 339 | 338 | return $option; |
| 340 | 339 | } |
| 341 | 340 | } |