| @@ -5,25 +5,18 @@ | ||
| 5 | 5 | |
| 6 | 6 | abstract class FrmValidate { |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | - * @var int | |
| 9 | + * @var int $form_id | |
| 10 | 10 | */ |
| 11 | 11 | protected $form_id; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @var object | |
| 14 | + * @var object $form | |
| 15 | 15 | */ |
| 16 | 16 | protected $form; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @since 6.21 | |
| 20 | - * | |
| 21 | - * @var string | |
| 22 | - */ | |
| 23 | - protected $option_type = 'form'; | |
| 24 | - | |
| 25 | - /** | |
| 26 | 19 | * @param int $form_id |
| 27 | 20 | */ |
| 28 | 21 | public function __construct( $form_id ) { |
| 29 | 22 | $this->form_id = $form_id; |
| @@ -32,9 +25,9 @@ | ||
| 32 | 25 | /** |
| 33 | 26 | * @return object $form |
| 34 | 27 | */ |
| 35 | 28 | protected function get_form() { |
| 36 | - if ( empty( $this->form ) ) { | |
| 29 | + if ( ! isset( $this->form ) ) { | |
| 37 | 30 | $this->form = FrmForm::getOne( $this->form_id ); |
| 38 | 31 | } |
| 39 | 32 | return $this->form; |
| 40 | 33 | } |
| @@ -42,21 +35,15 @@ | ||
| 42 | 35 | /** |
| 43 | 36 | * @return bool |
| 44 | 37 | */ |
| 45 | 38 | 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 | 39 | $form = $this->get_form(); |
| 40 | + $key = $this->get_option_key(); | |
| 54 | 41 | return ! empty( $form->options[ $key ] ) && 'off' !== $form->options[ $key ]; |
| 55 | 42 | } |
| 56 | 43 | |
| 57 | 44 | /** |
| 58 | - * @return bool|string | |
| 45 | + * @return bool | |
| 59 | 46 | */ |
| 60 | 47 | abstract public function validate(); |
| 61 | 48 | |
| 62 | 49 | /** |