PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.30
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.30
6.35 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 All 141 releases
formidable / classes / models / FrmValidate.php

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

69 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 abstract class FrmValidate {
7
8 /**
9 * @var int
10 */
11 protected $form_id;
12
13 /**
14 * @var object|null
15 */
16 protected $form;
17
18 /**
19 * @since 6.21
20 *
21 * @var string
22 */
23 protected $option_type = 'form';
24
25 /**
26 * @param int $form_id
27 */
28 public function __construct( $form_id ) {
29 $this->form_id = $form_id;
30 }
31
32 /**
33 * @return object|null Form.
34 */
35 protected function get_form() {
36 if ( ! $this->form ) {
37 $this->form = FrmForm::getOne( $this->form_id );
38 }
39 return $this->form;
40 }
41
42 /**
43 * @return bool
44 */
45 protected function is_option_on() {
46 $key = $this->get_option_key();
47
48 if ( 'global' === $this->option_type ) {
49 $frm_settings = FrmAppHelper::get_settings();
50 return ! empty( $frm_settings->$key );
51 }
52
53 $form = $this->get_form();
54 return ! empty( $form->options[ $key ] ) && 'off' !== $form->options[ $key ];
55 }
56
57 /**
58 * @return bool|string
59 */
60 abstract public function validate();
61
62 /**
63 * Track the form option key used for is_option_on function.
64 *
65 * @return string
66 */
67 abstract protected function get_option_key();
68 }
69