PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.2.0
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.2.0
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / fields / class-field-email.php

class-field-email.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.2.0, at includes/fields/class-field-email.php

96 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Text Field Class
5 */
6 class WeForms_Form_Field_Email extends WeForms_Form_Field_Text {
7
8 function __construct() {
9 $this->name = __( 'Email Address', 'weforms' );
10 $this->input_type = 'email_address';
11 $this->icon = 'envelope-o';
12 }
13
14 /**
15 * Render the text field
16 *
17 * @param array $field_settings
18 * @param integer $form_id
19 *
20 * @return void
21 */
22 public function render( $field_settings, $form_id ) {
23 $value = $field_settings['default'];
24 ?>
25 <li <?php $this->print_list_attributes( $field_settings ); ?>>
26 <?php $this->print_label( $field_settings, $form_id ); ?>
27
28 <div class="wpuf-fields">
29 <input
30 id="<?php echo $field_settings['name'] . '_' . $form_id; ?>"
31 type="email"
32 class="email <?php echo ' wpuf_'.$field_settings['name'].'_'.$form_id; ?>"
33 data-duplicate="<?php echo $field_settings['duplicate'] ? $field_settings['duplicate'] : 'no'; ?>"
34 data-required="<?php echo $field_settings['required'] ?>"
35 data-type="email"
36 name="<?php echo esc_attr( $field_settings['name'] ); ?>"
37 placeholder="<?php echo esc_attr( $field_settings['placeholder'] ); ?>"
38 value="<?php echo esc_attr( $value ) ?>"
39 size="<?php echo esc_attr( $field_settings['size'] ) ?>"
40 autocomplete="email"
41 />
42 <?php $this->help_text( $field_settings ); ?>
43 </div>
44 </li>
45 <?php
46 }
47
48 /**
49 * Get field options setting
50 *
51 * @return array
52 */
53 public function get_options_settings() {
54 $default_options = $this->get_default_option_settings();
55 $default_text_options = $this->get_default_text_option_settings();
56 $check_duplicate = array(
57 array(
58 'name' => 'duplicate',
59 'title' => 'No Duplicates',
60 'type' => 'checkbox',
61 'is_single_opt' => true,
62 'options' => array(
63 'no' => __( 'Unique Values Only', 'weforms' )
64 ),
65 'default' => '',
66 'section' => 'advanced',
67 'priority' => 23,
68 'help_text' => __( 'Select this option to limit user input to unique values only. This will require that a value entered in a field does not currently exist in the entry database for that field.', 'weforms' ),
69 )
70 );
71
72 return array_merge( $default_options, $default_text_options, $check_duplicate );
73 }
74
75 /**
76 * Get the field props
77 *
78 * @return array
79 */
80 public function get_field_props() {
81 $defaults = $this->default_attributes();
82 $defaults['duplicate'] = '';
83 return $defaults;
84 }
85
86 /**
87 * Prepare entry
88 *
89 * @param $field
90 *
91 * @return mixed
92 */
93 public function prepare_entry( $field ) {
94 return sanitize_text_field( trim( $_POST[$field['name']] ) );
95 }
96 }