PATH:
home
/
letacommog
/
entrepro
/
wp-content
/
plugins
/
weforms
/
includes
/
fields
<?php /** * Text Field Class */ class WeForms_Form_Field_Text extends WeForms_Field_Contract { function __construct() { $this->name = __( 'Text', 'weforms' ); $this->input_type = 'text_field'; $this->icon = 'text-width'; } /** * Render the text field * * @param array $field_settings * @param integer $form_id * * @return void */ public function render( $field_settings, $form_id ) { $value = $field_settings['default']; ?> <li <?php $this->print_list_attributes( $field_settings ); ?>> <?php $this->print_label( $field_settings, $form_id ); ?> <div class="wpuf-fields"> <input class="textfield <?php echo 'wpuf_' . $field_settings['name'] . '_' . $form_id; ?>" id="<?php echo $field_settings['name'] . '_' . $form_id; ?>" type="text" data-duplicate="<?php echo $field_settings['duplicate'] ? $field_settings['duplicate'] : 'no'; ?>" data-required="<?php echo $field_settings['required'] ?>" data-type="text" name="<?php echo esc_attr( $field_settings['name'] ); ?>" placeholder="<?php echo esc_attr( $field_settings['placeholder'] ); ?>" value="<?php echo esc_attr( $value ) ?>" size="<?php echo esc_attr( $field_settings['size'] ) ?>" /> <span class="wpuf-wordlimit-message wpuf-help"></span> <?php $this->help_text( $field_settings ); ?> </div> <?php if ( isset( $field_settings['word_restriction'] ) && $field_settings['word_restriction'] ) { $this->check_word_restriction_func( $field_settings['word_restriction'], 'no', $field_settings['name'] . '_' . $form_id ); } $mask_option = isset( $field_settings['mask_options'] ) ? $field_settings['mask_options'] : ''; if ( $mask_option ) { ?> <script> jQuery(document).ready(function($) { var text_field = $( "input[name*=<?php echo esc_attr( $field_settings['name'] ); ?>]" ); switch ( '<?php echo $mask_option; ?>' ) { case 'us_phone': text_field.mask('(999) 999-9999'); break; case 'date': text_field.mask('99/99/9999'); break; case 'tax_id': text_field.mask('99-9999999'); break; case 'ssn': text_field.mask('999-99-9999'); break; case 'zip': text_field.mask('99999'); break; default: break; } }); </script> <?php } ?> </li> <?php } /** * Get field options setting * * @return array */ public function get_options_settings() { $default_options = $this->get_default_option_settings(); $default_text_options = $this->get_default_text_option_settings( true ); $check_duplicate = array( array( 'name' => 'duplicate', 'title' => 'No Duplicates', 'type' => 'checkbox', 'is_single_opt' => true, 'options' => array( 'no' => __( 'Unique Values Only', 'weforms' ) ), 'default' => '', 'section' => 'advanced', 'priority' => 23, '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' ), ) ); $text_options = array_merge( $default_options, $default_text_options, $check_duplicate ); return apply_filters( 'weforms_text_field_option_settings', $text_options ); } /** * Get the field props * * @return array */ public function get_field_props() { $defaults = $this->default_attributes(); $props = array( 'word_restriction' => '', 'duplicate' => '', ); return array_merge( $defaults, $props ); } /** * Prepare entry * * @param $field * * @return mixed */ public function prepare_entry( $field ) { return sanitize_text_field( trim( $_POST[$field['name']] ) ); } }
[+]
..
[-] class-field-sectionbreak.php
[edit]
[-] class-field-html.php
[edit]
[-] class-field-textarea.php
[edit]
[-] class-field-text.php
[edit]
[-] class-field-image.php
[edit]
[-] class-field-multidropdown.php
[edit]
[-] class-field-url.php
[edit]
[-] class-field-name.php
[edit]
[-] class-field-recaptcha.php
[edit]
[-] class-field-checkbox.php
[edit]
[-] class-abstract-fields.php
[edit]
[-] class-field-email.php
[edit]
[-] class-field-date.php
[edit]
[-] class-fields-pro.php
[edit]
[-] class-field-dropdown.php
[edit]
[-] class-field-hidden.php
[edit]
[-] class-field-radio.php
[edit]