class-evf-field-address.php
1 year ago
class-evf-field-ai.php
1 year ago
class-evf-field-captcha.php
4 weeks ago
class-evf-field-checkbox.php
2 months ago
class-evf-field-color.php
4 weeks ago
class-evf-field-country.php
2 months ago
class-evf-field-credit-card.php
4 weeks ago
class-evf-field-date-time.php
4 weeks ago
class-evf-field-divider.php
2 years ago
class-evf-field-email.php
1 year ago
class-evf-field-file-upload.php
1 year ago
class-evf-field-first-name.php
1 year ago
class-evf-field-hcaptcha.php
4 months ago
class-evf-field-hidden.php
1 year ago
class-evf-field-html.php
9 months ago
class-evf-field-image-upload.php
1 year ago
class-evf-field-last-name.php
1 year ago
class-evf-field-likert.php
1 year ago
class-evf-field-lookup.php
4 weeks ago
class-evf-field-number.php
1 year ago
class-evf-field-password.php
4 weeks ago
class-evf-field-payment-authorize-net.php
4 weeks ago
class-evf-field-payment-checkbox.php
4 weeks ago
class-evf-field-payment-coupon.php
4 weeks ago
class-evf-field-payment-gateway-selector.php
4 weeks ago
class-evf-field-payment-quantity.php
4 weeks ago
class-evf-field-payment-radio.php
4 weeks ago
class-evf-field-payment-single.php
4 weeks ago
class-evf-field-payment-square.php
1 year ago
class-evf-field-payment-subscription-plan.php
4 weeks ago
class-evf-field-payment-subtotal.php
4 weeks ago
class-evf-field-payment-total.php
4 weeks ago
class-evf-field-phone.php
1 year ago
class-evf-field-privacy-policy.php
2 months ago
class-evf-field-private-note.php
1 year ago
class-evf-field-progress.php
4 weeks ago
class-evf-field-radio.php
2 months ago
class-evf-field-range-slider.php
4 weeks ago
class-evf-field-rating.php
2 months ago
class-evf-field-recaptcha.php
4 months ago
class-evf-field-repeater.php
4 weeks ago
class-evf-field-reset.php
4 weeks ago
class-evf-field-scale-rating.php
1 year ago
class-evf-field-select.php
1 year ago
class-evf-field-signature.php
4 weeks ago
class-evf-field-text.php
1 year ago
class-evf-field-textarea.php
1 year ago
class-evf-field-title.php
2 years ago
class-evf-field-turnstile.php
4 months ago
class-evf-field-url.php
1 year ago
class-evf-field-wysiwyg.php
2 months ago
class-evf-field-yes-no.php
1 year ago
payment-amount-helpers.php
4 weeks ago
class-evf-field-password.php
255 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Password field. |
| 4 | * |
| 5 | * @package EverestForms\Fields |
| 6 | * @since 1.2.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Field_Password Class. |
| 13 | * |
| 14 | * Builder-scope (read-only) version shipped in the free plugin so the field can |
| 15 | * be shown LOCKED — with its real preview and readable settings — for the AI |
| 16 | * upsell. The full functional implementation (front-end display, validation, |
| 17 | * formatting) lives in Everest Forms Pro, whose class loads in place of this one |
| 18 | * when the plugin is active (this file is only autoloaded when that class is not |
| 19 | * already defined). Keep `is_pro = true` so the field stays locked. |
| 20 | */ |
| 21 | class EVF_Field_Password extends EVF_Form_Fields { |
| 22 | |
| 23 | /** |
| 24 | * Constructor. |
| 25 | */ |
| 26 | public function __construct() { |
| 27 | $this->name = esc_html__( 'Password', 'everest-forms' ); |
| 28 | $this->type = 'password'; |
| 29 | $this->icon = 'evf-icon evf-icon-password'; |
| 30 | $this->order = 70; |
| 31 | $this->group = 'advanced'; |
| 32 | $this->is_pro = true; |
| 33 | $this->links = array( |
| 34 | 'image_id' => '', |
| 35 | 'vedio_id' => 'OzSuWDyccFQ', |
| 36 | ); |
| 37 | $this->settings = array( |
| 38 | 'basic-options' => array( |
| 39 | 'field_options' => array( |
| 40 | 'label', |
| 41 | 'description', |
| 42 | 'required', |
| 43 | 'required_field_message_setting', |
| 44 | 'required_field_message', |
| 45 | 'confirmation', |
| 46 | 'password_strength', |
| 47 | 'password_validation', |
| 48 | 'show_hide_password', |
| 49 | |
| 50 | ), |
| 51 | ), |
| 52 | 'advanced-options' => array( |
| 53 | 'field_options' => array( |
| 54 | 'placeholder', |
| 55 | 'meta', |
| 56 | 'confirmation_placeholder', |
| 57 | 'label_hide', |
| 58 | 'sublabel_hide', |
| 59 | 'default_value', |
| 60 | 'css', |
| 61 | ), |
| 62 | ), |
| 63 | ); |
| 64 | |
| 65 | parent::__construct(); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Confirmation field option. |
| 70 | * |
| 71 | * @param array $field Field Data. |
| 72 | */ |
| 73 | public function confirmation( $field ) { |
| 74 | $confirm_field = $this->field_element( |
| 75 | 'toggle', |
| 76 | $field, |
| 77 | array( |
| 78 | 'slug' => 'confirmation', |
| 79 | 'value' => isset( $field['confirmation'] ) ? '1' : '0', |
| 80 | 'desc' => esc_html__( 'Enable Password Confirmation', 'everest-forms' ), |
| 81 | 'tooltip' => esc_html__( 'Check to enable password confirmation.', 'everest-forms' ), |
| 82 | ), |
| 83 | false |
| 84 | ); |
| 85 | |
| 86 | $args = array( |
| 87 | 'slug' => 'confirmation', |
| 88 | 'content' => $confirm_field, |
| 89 | ); |
| 90 | $this->field_element( 'row', $field, $args ); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Confirmation field option. |
| 95 | * |
| 96 | * @param array $field Field Data. |
| 97 | */ |
| 98 | public function password_validation( $field ) { |
| 99 | $confirm_field = $this->field_element( |
| 100 | 'toggle', |
| 101 | $field, |
| 102 | array( |
| 103 | 'slug' => 'password_validation', |
| 104 | 'value' => isset( $field['password_validation'] ) ? '1' : '0', |
| 105 | 'desc' => esc_html__( 'Enable Password Validation', 'everest-forms' ), |
| 106 | 'tooltip' => esc_html__( 'Check to enable password validation.', 'everest-forms' ), |
| 107 | ), |
| 108 | false |
| 109 | ); |
| 110 | |
| 111 | $args = array( |
| 112 | 'slug' => 'password_validation', |
| 113 | 'content' => $confirm_field, |
| 114 | ); |
| 115 | $this->field_element( 'row', $field, $args ); |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Password Meter field option. |
| 120 | * |
| 121 | * @param array $field Field Data. |
| 122 | */ |
| 123 | public function password_strength( $field ) { |
| 124 | $class = isset( $field['password_strength'] ) && '1' === $field['password_strength'] ? 'everest-forms-visible' : 'everest-forms-hidden'; |
| 125 | |
| 126 | $password_strength = $this->field_element( |
| 127 | 'toggle', |
| 128 | $field, |
| 129 | array( |
| 130 | 'slug' => 'password_strength', |
| 131 | 'value' => isset( $field['password_strength'] ) ? $field['password_strength'] : '0', |
| 132 | 'desc' => esc_html__( 'Enable Password Strength Meter', 'everest-forms' ), |
| 133 | 'tooltip' => esc_html__( 'Check to enable password strength meter.', 'everest-forms' ), |
| 134 | ), |
| 135 | false |
| 136 | ); |
| 137 | |
| 138 | $password_bar_choice = $this->field_element( |
| 139 | 'radio', |
| 140 | $field, |
| 141 | array( |
| 142 | 'slug' => 'password_bar', |
| 143 | 'default' => isset( $field['password_bar'] ) ? esc_attr( $field['password_bar'] ) : 'default', |
| 144 | 'desc' => null, |
| 145 | 'options' => array( |
| 146 | 'default' => esc_html__( 'Simple Text', 'everest-forms' ), |
| 147 | 'progress' => esc_html__( 'Progress Bar', 'everest-forms' ), |
| 148 | ), |
| 149 | ), |
| 150 | false |
| 151 | ); |
| 152 | |
| 153 | $args = array( |
| 154 | 'slug' => 'password_strength', |
| 155 | 'content' => $password_strength . '<div class="everest-forms-inner-options ' . $class . '">' . $password_bar_choice . '</div>', |
| 156 | ); |
| 157 | $this->field_element( 'row', $field, $args ); |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Show and Hide password. |
| 162 | * |
| 163 | * @param array $field Field Data. |
| 164 | */ |
| 165 | public function show_hide_password( $field ) { |
| 166 | $fld = $this->field_element( |
| 167 | 'toggle', |
| 168 | $field, |
| 169 | array( |
| 170 | 'slug' => 'show_hide_password', |
| 171 | 'value' => isset( $field['show_hide_password'] ) ? '1' : '0', |
| 172 | 'desc' => esc_html__( 'Enable Show and Hide Password', 'everest-forms' ), |
| 173 | 'tooltip' => esc_html__( 'Check to enable password visibility toggle.', 'everest-forms' ), |
| 174 | ), |
| 175 | false |
| 176 | ); |
| 177 | |
| 178 | $args = array( |
| 179 | 'slug' => 'show_hide_password', |
| 180 | 'content' => $fld, |
| 181 | ); |
| 182 | $this->field_element( 'row', $field, $args ); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Confirmation Placeholder field option. |
| 187 | * |
| 188 | * @param array $field Field Data. |
| 189 | */ |
| 190 | public function confirmation_placeholder( $field ) { |
| 191 | $lbl = $this->field_element( |
| 192 | 'label', |
| 193 | $field, |
| 194 | array( |
| 195 | 'slug' => 'confirmation_placeholder', |
| 196 | 'value' => esc_html__( 'Confirmation Placeholder Text', 'everest-forms' ), |
| 197 | 'tooltip' => esc_html__( 'Enter text for the confirmation field placeholder.', 'everest-forms' ), |
| 198 | ), |
| 199 | false |
| 200 | ); |
| 201 | $fld = $this->field_element( |
| 202 | 'text', |
| 203 | $field, |
| 204 | array( |
| 205 | 'slug' => 'confirmation_placeholder', |
| 206 | 'value' => ! empty( $field['confirmation_placeholder'] ) ? esc_attr( $field['confirmation_placeholder'] ) : '', |
| 207 | ), |
| 208 | false |
| 209 | ); |
| 210 | $args = array( |
| 211 | 'slug' => 'confirmation_placeholder', |
| 212 | 'content' => $lbl . $fld, |
| 213 | ); |
| 214 | $this->field_element( 'row', $field, $args ); |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Field preview inside the builder. |
| 219 | * |
| 220 | * @since 1.0.0 |
| 221 | * |
| 222 | * @param array $field Field data and settings. |
| 223 | */ |
| 224 | public function field_preview( $field ) { |
| 225 | $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : ''; |
| 226 | $confirm_placeholder = ! empty( $field['confirmation_placeholder'] ) ? esc_attr( $field['confirmation_placeholder'] ) : ''; |
| 227 | $confirm = ! empty( $field['confirmation'] ) ? 'enabled' : 'disabled'; |
| 228 | $visibility_class = ! empty( $field['show_hide_password'] ) ? '' : 'everest-forms-hidden'; |
| 229 | |
| 230 | // Label. |
| 231 | $this->field_preview_option( 'label', $field ); |
| 232 | ?> |
| 233 | <div class="everest-forms-confirm everest-forms-confirm-<?php echo esc_attr( $confirm ); ?>"> |
| 234 | <div class="everest-forms-confirm-primary"> |
| 235 | <div class="evf-field-password-input"> |
| 236 | <input type="password" placeholder="<?php echo esc_attr( $placeholder ); ?>" class="widefat primary-input" disabled> |
| 237 | <span class="dashicons dashicons-hidden toggle-password <?php echo esc_attr( $visibility_class ); ?>"></span> |
| 238 | </div> |
| 239 | <label class="everest-forms-sub-label"><?php esc_html_e( 'Password', 'everest-forms' ); ?></label> |
| 240 | </div> |
| 241 | <div class="everest-forms-confirm-confirmation"> |
| 242 | <div class="evf-field-password-input"> |
| 243 | <input type="password" placeholder="<?php echo esc_attr( $confirm_placeholder ); ?>" class="widefat secondary-input" disabled> |
| 244 | <span class="dashicons dashicons-hidden toggle-password <?php echo esc_attr( $visibility_class ); ?>" ></span> |
| 245 | </div> |
| 246 | <label class="everest-forms-sub-label"><?php esc_html_e( 'Confirm Password', 'everest-forms' ); ?></label> |
| 247 | </div> |
| 248 | </div> |
| 249 | |
| 250 | <?php |
| 251 | // Description. |
| 252 | $this->field_preview_option( 'description', $field ); |
| 253 | } |
| 254 | } |
| 255 |