PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.2
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.2
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / fields / class-evf-field-payment-single.php
everest-forms / includes / fields Last commit date
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-payment-single.php
181 lines
1 <?php
2 /**
3 * Payment Single Item field
4 *
5 * @package EverestForms\Fields
6 * @since 1.2.0
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 // Currency-aware amount helpers (mirror the Pro evf_format_amount/evf_sanitize_amount
12 // so the locked preview matches the real Pro field exactly, incl. the currency symbol).
13 require_once __DIR__ . '/payment-amount-helpers.php';
14
15 /**
16 * EVF_Field_Payment_Single Class.
17 *
18 * Builder-scope (read-only) version shipped in the free plugin so the field can
19 * be shown LOCKED — with its real preview and readable settings — for the AI
20 * upsell. The full functional implementation (front-end display, validation,
21 * exporters) lives in Everest Forms Pro, whose class loads in place of this one
22 * when the plugin is active (this file is only autoloaded when that class is not
23 * already defined). Keep `is_pro = true` so the field stays locked.
24 */
25 class EVF_Field_Payment_Single extends EVF_Form_Fields {
26
27 /**
28 * Constructor.
29 */
30 public function __construct() {
31 $this->name = esc_html__( 'Single Item', 'everest-forms' );
32 $this->type = 'payment-single';
33 $this->icon = 'evf-icon evf-icon-single-item';
34 $this->order = 10;
35 $this->group = 'payment';
36 $this->is_pro = true;
37 $this->links = array(
38 'image_id' => '',
39 'vedio_id' => 'BccK3ye8tPs',
40 );
41 $this->settings = array(
42 'basic-options' => array(
43 'field_options' => array(
44 'label',
45 'description',
46 'item_price',
47 'item_format',
48 'required',
49 'required_field_message_setting',
50 'required_field_message',
51 ),
52 ),
53 'advanced-options' => array(
54 'field_options' => array(
55 'placeholder',
56 'meta',
57 'label_hide',
58 'css',
59 ),
60 ),
61 );
62
63 parent::__construct();
64 }
65
66 /**
67 * Item price field option.
68 *
69 * @param array $field Field data.
70 */
71 public function item_price( $field ) {
72 $item_price = ! empty( $field['item_price'] ) ? evf_format_amount( evf_sanitize_amount( $field['item_price'] ) ) : '';
73 $item_price_label = $this->field_element(
74 'label',
75 $field,
76 array(
77 'slug' => 'item_price',
78 'value' => esc_html__( 'Item Price', 'everest-forms' ),
79 'tooltip' => esc_html__( 'Please Enter price of your item, without a currency symbol.', 'everest-forms' ),
80 ),
81 false
82 );
83 $item_price_input = $this->field_element(
84 'text',
85 $field,
86 array(
87 'slug' => 'item_price',
88 'value' => $item_price,
89 'class' => 'evf-money-input',
90 'placeholder' => evf_format_amount( 0 ),
91 ),
92 false
93 );
94
95 $args = array(
96 'slug' => 'item_price',
97 'content' => $item_price_label . $item_price_input,
98 );
99 $this->field_element( 'row', $field, $args );
100 }
101
102 /**
103 * Item format field option.
104 *
105 * @param array $field Field data.
106 */
107 public function item_format( $field ) {
108 $item_type = ! empty( $field['item_type'] ) ? esc_attr( $field['item_type'] ) : '';
109 $item_format_label = $this->field_element(
110 'label',
111 $field,
112 array(
113 'slug' => 'item_type',
114 'value' => esc_html__( 'Item Type', 'everest-forms' ),
115 'tooltip' => esc_html__( 'Please select the item type.', 'everest-forms' ),
116 ),
117 false
118 );
119 $item_format_select = $this->field_element(
120 'select',
121 $field,
122 array(
123 'slug' => 'item_type',
124 'value' => $item_type,
125 'options' => array(
126 'single' => esc_html__( 'Pre Defined', 'everest-forms' ),
127 'user' => esc_html__( 'User Defined', 'everest-forms' ),
128 'hidden' => esc_html__( 'Hidden', 'everest-forms' ),
129 ),
130 ),
131 false
132 );
133
134 $args = array(
135 'slug' => 'item_price',
136 'content' => $item_format_label . $item_format_select,
137 );
138 $this->field_element( 'row', $field, $args );
139 }
140
141 /**
142 * Field preview inside the builder.
143 *
144 * @since 1.0.0
145 *
146 * @param array $field Field data and settings.
147 */
148 public function field_preview( $field ) {
149 $item_price = ! empty( $field['item_price'] ) ? evf_format_amount( evf_sanitize_amount( $field['item_price'] ), true ) : evf_format_amount( 0, true );
150 $placeholder = ! empty( $field['placeholder'] ) ? esc_attr( $field['placeholder'] ) : evf_format_amount( 0 );
151 $item_type = ! empty( $field['item_type'] ) ? esc_html( $field['item_type'] ) : 'single';
152 $value = ! empty( $field['item_price'] ) ? evf_format_amount( evf_sanitize_amount( $field['item_price'] ) ) : '';
153
154 echo '<div class="format-selected-' . esc_attr( $item_type ) . ' format-selected">';
155
156 $this->field_preview_option( 'label', $field );
157
158 echo '<p class="item-price">';
159 printf(
160 /* translators: %s - item price. */
161 esc_html__( 'Price: %s', 'everest-forms' ),
162 '<span class="price">' . esc_html( $item_price ) . '</span>'
163 );
164 echo '</p>';
165
166 printf(
167 '<input type="text" placeholder="%s" class="widefat primary-input" value="%s" disabled>',
168 esc_attr( $placeholder ),
169 esc_attr( $value )
170 );
171
172 $this->field_preview_option( 'description', $field );
173
174 echo '<p class="item-price-hidden">';
175 esc_html_e( 'Note: You have selected hidden type which will not visible in the form.', 'everest-forms' );
176 echo '</p>';
177
178 echo '</div>';
179 }
180 }
181