/home/suroeste/public_html/wp-content/plugins/wpforms/pro/includes/fields
NameSizeModeActions
class-address.php475780644editdlrm
class-content.php66250644editdlrm
class-date-time.php472940644editdlrm
class-divider.php36090644editdlrm
class-entry-preview.php279710644editdlrm
class-file-upload.php646870644editdlrm
class-hidden.php22840644editdlrm
class-html.php57580644editdlrm
class-layout.php86360644editdlrm
class-page-break.php244660644editdlrm
class-password.php184900644editdlrm
class-payment-checkbox.php162880644editdlrm
class-payment-credit-card.php186120644editdlrm
class-payment-dropdown.php170830644editdlrm
class-payment-multiple.php150140644editdlrm
class-payment-single.php114330644editdlrm
class-payment-total.php67060644editdlrm
class-phone.php96400644editdlrm
class-rating.php149310644editdlrm
class-richtext.php415570644editdlrm
class-url.php43840644editdlrm
Edit: /home/suroeste/public_html/wp-content/plugins/wpforms/pro/includes/fields/class-payment-single.php (11433B)
name = esc_html__( 'Single Item', 'wpforms' ); $this->type = 'payment-single'; $this->icon = 'fa-file-o'; $this->order = 30; $this->group = 'payment'; // Define additional field properties. add_filter( 'wpforms_field_properties_' . $this->type, [ $this, 'field_properties' ], 5, 3 ); } /** * Define additional field properties. * * @since 1.5.0 * * @param array $properties Field properties. * @param array $field Field settings. * @param array $form_data Form data and settings. * * @return array */ public function field_properties( $properties, $field, $form_data ) { // Basic IDs. $form_id = absint( $form_data['id'] ); $field_id = absint( $field['id'] ); // Set options container (', esc_attr( $placeholder ), esc_attr( $value ) ); $this->field_preview_option( 'description', $field ); echo '

'; esc_html_e( 'Note: Item type is set to hidden and will not be visible when viewing the form.', 'wpforms' ); echo '

'; echo '
'; } /** * Field display on the form front-end. * * @since 1.0.0 * @since 1.5.0 Converted to a new format, where all the data are taken not from $deprecated, but field properties. * * @param array $field Field data and settings. * @param array $deprecated Deprecated field attributes. * @param array $form_data Form data and settings. */ public function field_display( $field, $deprecated, $form_data ) { // Shortcut for easier access. $primary = $field['properties']['inputs']['primary']; $field_format = ! empty( $field['format'] ) ? $field['format'] : 'single'; // Placeholder attribute is only applicable to password, search, tel, text and url inputs, not hidden. if ( $field_format !== 'user' ) { unset( $primary['attr']['placeholder'] ); } switch ( $field_format ) { case 'single': case 'hidden': if ( $field_format === 'single' ) { $price = ! empty( $field['price'] ) ? $field['price'] : 0; echo '
'; printf( /* translators: %s - price amount. */ esc_html__( 'Price: %s', 'wpforms' ), '' . esc_html( wpforms_format_amount( wpforms_sanitize_amount( $price ), true ) ) . '' ); echo '
'; } // Primary price field. printf( '', wpforms_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ) ); break; case 'user': printf( '', wpforms_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ) ); break; } } /** * Validate field on form submit. * * @since 1.0.0 * * @param int $field_id Field ID. * @param string $field_submit Field data submitted by a user. * @param array $form_data Form data and settings. */ public function validate( $field_id, $field_submit, $form_data ) { // If field is required, check for data. if ( empty( $field_submit ) && ! empty( $form_data['fields'][ $field_id ]['required'] ) ) { wpforms()->get( 'process' )->errors[ $form_data['id'] ][ $field_id ] = wpforms_get_required_label(); return; } // If field format is not user provided, validate the amount posted. if ( ! empty( $field_submit ) && $form_data['fields'][ $field_id ]['format'] !== 'user' ) { $price = wpforms_sanitize_amount( $form_data['fields'][ $field_id ]['price'] ); $submit = wpforms_sanitize_amount( $field_submit ); if ( $price !== $submit ) { wpforms()->get( 'process' )->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'Amount mismatch', 'wpforms' ); } } if ( ! empty( $field_submit ) && $form_data['fields'][ $field_id ]['format'] === 'user' ) { $submit = wpforms_sanitize_amount( $field_submit ); if ( $submit < 0 ) { wpforms()->get( 'process' )->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'Amount can\'t be negative' , 'wpforms' ); } } } /** * Format and sanitize field. * * @since 1.0.0 * * @param int $field_id Field ID. * @param string $field_submit Field data submitted by a user. * @param array $form_data Form data and settings. */ public function format( $field_id, $field_submit, $form_data ) { $field = $form_data['fields'][ $field_id ]; $name = ! empty( $field['label'] ) ? sanitize_text_field( $field['label'] ) : ''; // Only trust the value if the field is user format. if ( 'user' === $field['format'] ) { $amount = wpforms_sanitize_amount( $field_submit ); } else { $amount = wpforms_sanitize_amount( $field['price'] ); } wpforms()->process->fields[ $field_id ] = [ 'name' => $name, 'value' => wpforms_format_amount( $amount, true ), 'amount' => wpforms_format_amount( $amount ), 'amount_raw' => $amount, 'currency' => wpforms_get_currency(), 'id' => absint( $field_id ), 'type' => $this->type, ]; } } new WPForms_Field_Payment_Single();