# formidable/6.8.2/classes/models/FrmValidate.php

Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes &amp; More, version 6.8.2. 56 lines.

- Page: https://pluginprobe.com/plugins/formidable/6.8.2/code/classes/models/FrmValidate.php
- Raw: https://pluginprobe.com/plugins/formidable/6.8.2/raw/classes/models/FrmValidate.php
- Modified: 2024-01-03T20:12:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/formidable/6.8.2/code/classes/models/FrmValidate.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	die( 'You are not allowed to call this page directly.' );
}

abstract class FrmValidate {

	/**
	 * @var int $form_id
	 */
	protected $form_id;

	/**
	 * @var object $form
	 */
	protected $form;

	/**
	 * @param int $form_id
	 */
	public function __construct( $form_id ) {
		$this->form_id = $form_id;
	}

	/**
	 * @return object $form
	 */
	protected function get_form() {
		if ( empty( $this->form ) ) {
			$this->form = FrmForm::getOne( $this->form_id );
		}
		return $this->form;
	}

	/**
	 * @return bool
	 */
	protected function is_option_on() {
		$form = $this->get_form();
		$key  = $this->get_option_key();
		return ! empty( $form->options[ $key ] ) && 'off' !== $form->options[ $key ];
	}

	/**
	 * @return bool
	 */
	abstract public function validate();

	/**
	 * Track the form option key used for is_option_on function.
	 *
	 * @return string
	 */
	abstract protected function get_option_key();
}

```
