PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.34
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.34
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 6.5.4 All 140 releases
formidable / classes / models / FrmSpamCheck.php

FrmSpamCheck.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.34, at classes/models/FrmSpamCheck.php

70 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Spam check abstract class
4 *
5 * @since 6.21
6 *
7 * @package Formidable
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 die( 'You are not allowed to call this page directly.' );
12 }
13
14 abstract class FrmSpamCheck {
15
16 /**
17 * Entry values.
18 *
19 * @var array
20 */
21 protected $values;
22
23 /**
24 * @param array $values
25 */
26 public function __construct( $values ) {
27 $this->values = $values;
28 }
29
30 /**
31 * Checks if is spam.
32 *
33 * @return bool|string Return the spam message or `false` if is not spam.
34 */
35 public function is_spam() {
36 if ( ! $this->is_enabled() ) {
37 return false;
38 }
39
40 $is_spam = $this->check();
41
42 return $is_spam ? $this->get_spam_message() : false;
43 }
44
45 /**
46 * Checks for spam.
47 *
48 * @return bool Return `true` if this is spam.
49 */
50 abstract protected function check();
51
52 /**
53 * Checks if the check is enabled.
54 *
55 * @return bool
56 */
57 protected function is_enabled() {
58 return true;
59 }
60
61 /**
62 * Gets spam message.
63 *
64 * @return string If this is empty string, a default message will be used.
65 */
66 protected function get_spam_message() {
67 return FrmAntiSpamController::get_default_spam_message();
68 }
69 }
70