PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.02.04
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.02.04
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 / fields / FrmFieldEmail.php

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

52 lines 890 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @since 3.0
5 */
6 class FrmFieldEmail extends FrmFieldType {
7
8 /**
9 * @var string
10 * @since 3.0
11 */
12 protected $type = 'email';
13 protected $display_type = 'text';
14
15 /**
16 * @var bool
17 * @since 3.0
18 */
19 protected $holds_email_values = true;
20
21 protected function field_settings_for_type() {
22 return array(
23 'size' => true,
24 'clear_on_focus' => true,
25 'invalid' => true,
26 );
27 }
28
29 /**
30 * Validate the email format
31 *
32 * @param array $args
33 *
34 * @return array
35 */
36 public function validate( $args ) {
37 $errors = array();
38 if ( $args['value'] != '' && ! is_email( $args['value'] ) ) {
39 $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
40 }
41
42 return $errors;
43 }
44
45 /**
46 * @since 4.0.04
47 */
48 public function sanitize_value( &$value ) {
49 FrmAppHelper::sanitize_value( 'sanitize_email', $value );
50 }
51 }
52