PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | stripe/views/action-settings/payments-options.php +229 -90 6.25 → trunk View file →
@@ -4,140 +4,234 @@
4 4 }
5 5
6 6 $stripe_connected = FrmStrpLiteConnectHelper::at_least_one_mode_is_setup();
7 7 $square_connected = FrmSquareLiteConnectHelper::at_least_one_mode_is_setup();
8 +$paypal_connected = FrmPayPalLiteConnectHelper::at_least_one_mode_is_setup();
8 9
9 10 if ( $stripe_connected ) {
10 - FrmStrpLiteAppHelper::fee_education( 'tip', $form_action->post_content['gateway'] );
11 + FrmStrpLiteAppHelper::fee_education( 'stripe-action-tip', $form_action->post_content['gateway'] );
11 12 }
13 +
12 14 if ( $square_connected ) {
13 - FrmSquareLiteAppHelper::fee_education( 'tip', $form_action->post_content['gateway'] );
15 + FrmSquareLiteAppHelper::fee_education( 'square-action-tip', $form_action->post_content['gateway'] );
14 16 }
15 -if ( ! $stripe_connected && ! $square_connected ) {
17 +
18 +if ( $paypal_connected ) {
19 + FrmPayPalLiteAppHelper::fee_education( 'paypal-action-tip', $form_action->post_content['gateway'] );
20 +}
21 +
22 +if ( ! $stripe_connected && ! $square_connected && ! $paypal_connected ) {
16 23 FrmStrpLiteAppHelper::not_connected_warning();
17 24 }
18 25 ?>
19 26
27 +<?php
28 +// Only show gateway tabs if there are multiple gateways available.
29 +if ( count( $gateways ) > 1 ) {
30 + FrmTransLiteAppHelper::show_gateway_buttons( $gateways, $form_action, $action_control );
31 +}
32 +?>
33 +
34 +<?php
35 +/**
36 + * Show warning if amount is empty.
37 + * Only show for existing actions (has ID), not new actions.
38 + *
39 + * @since 6.31
40 + */
41 +if ( ! empty( $form_action->ID ) && empty( $form_action->post_content['amount'] ) ) :
42 + ?>
43 + <div class="frm_warning_style frm-with-icon">
44 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
45 + <span><?php esc_html_e( 'Amount is required or payments will not work.', 'formidable' ); ?></span>
46 + </div>
47 +<?php endif; ?>
48 +
49 +<p class="frm6">
50 + <label>
51 + <?php esc_html_e( 'Payment Type', 'formidable' ); ?>
52 + </label>
53 + <select name="<?php echo esc_attr( $action_control->get_field_name( 'type' ) ); ?>" class="frm_trans_type">
54 + <option value="single" <?php selected( $form_action->post_content['type'], 'one_time' ); ?>><?php esc_html_e( 'One-time Payment', 'formidable' ); ?></option>
55 + <option value="recurring" <?php selected( $form_action->post_content['type'], 'recurring' ); ?>><?php esc_html_e( 'Recurring', 'formidable' ); ?></option>
56 + </select>
57 +</p>
58 +
20 59 <div class="frm_grid_container">
21 60 <p>
22 61 <label for="<?php echo esc_attr( $action_control->get_field_id( 'description' ) ); ?>">
23 62 <?php esc_html_e( 'Description', 'formidable' ); ?>
24 63 </label>
25 - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'description' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['description'] ); ?>" class="frm_not_email_subject large-text" />
64 + <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'description' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'description' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['description'] ); ?>" class="frm_not_email_subject large-text" />
26 65 </p>
27 66
28 67 <p class="frm6">
29 68 <label for="<?php echo esc_attr( $action_control->get_field_id( 'amount' ) ); ?>">
30 - <?php esc_html_e( 'Amount', 'formidable' ); ?>
69 + <?php esc_html_e( 'Amount', 'formidable' ); ?> <span class="frm_required">*</span>
31 70 </label>
32 - <input type="text" value="<?php echo esc_attr( $form_action->post_content['amount'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'amount' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'amount' ) ); ?>" class="frm_not_email_subject large-text" />
71 + <input type="text" value="<?php echo esc_attr( $form_action->post_content['amount'] ); ?>" name="<?php echo esc_attr( $action_control->get_field_name( 'amount' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'amount' ) ); ?>" class="frm_not_email_subject large-text" />
33 72 </p>
34 73
35 - <?php $cc_field_id = $this->get_credit_card_field_id( $field_dropdown_atts ); ?>
36 - <input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'credit_card' ) ); ?>" value="<?php echo esc_attr( $cc_field_id ); ?>" />
37 -
38 74 <p class="frm6">
39 - <label>
40 - <?php esc_html_e( 'Payment Type', 'formidable' ); ?>
75 + <label for="<?php echo esc_attr( $action_control->get_field_id( 'currency' ) ); ?>">
76 + <?php esc_html_e( 'Currency', 'formidable' ); ?>
41 77 </label>
42 - <select name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>" class="frm_trans_type">
43 - <option value="single" <?php selected( $form_action->post_content['type'], 'one_time' ); ?>><?php esc_html_e( 'One-time Payment', 'formidable' ); ?></option>
44 - <option value="recurring" <?php selected( $form_action->post_content['type'], 'recurring' ); ?>><?php esc_html_e( 'Recurring', 'formidable' ); ?></option>
45 - </select>
78 + <?php FrmTransLiteAppHelper::show_currency_dropdown( $action_control->get_field_id( 'currency' ), $action_control->get_field_name( 'currency' ), $form_action->post_content ); ?>
46 79 </p>
47 80
48 - <?php $this->echo_capture_payment_upsell( $form_action->post_content['gateway'] ); ?>
49 -
50 - <p class="frm6 frm_trans_sub_opts <?php echo $form_action->post_content['type'] === 'recurring' ? '' : 'frm_hidden'; ?>">
51 - <label>
52 - <?php esc_html_e( 'Repeat', 'formidable' ); ?>
53 - </label>
54 - <span>
55 - <span class="frm_grid_container">
56 - <input class="frm6" type="number" name="<?php echo esc_attr( $this->get_field_name( 'interval_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['interval_count'] ); ?>" max="90" min="1" step="1" />
57 - <select class="frm6" name="<?php echo esc_attr( $this->get_field_name( 'interval' ) ); ?>" class="auto_width">
58 - <?php foreach ( $repeat_times as $k => $v ) { ?>
59 - <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $form_action->post_content['interval'], $k ); ?>><?php echo esc_html( $v ); ?></option>
60 - <?php } ?>
61 - </select>
62 - <input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'payment_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['payment_count'] ); ?>" />
63 - </span>
64 - </span>
65 - </p>
66 -
67 81 <?php
68 - /*
69 - Note: The Repeat Cadence setting is added with JavaScript.
70 - This hidden input is added so the JS knows what value is set.
71 - */
82 + // Only show radio buttons when there's a single gateway (tabs are shown for multiple gateways).
83 + if ( count( $gateways ) === 1 ) :
72 84 ?>
73 - <input type="hidden" class="frm-repeat-cadence-value" value="<?php echo esc_attr( $form_action->post_content['repeat_cadence'] ?? 'DAILY' ); ?>" />
74 -
75 - <p class="frm_trans_sub_opts frm6 <?php echo $form_action->post_content['type'] === 'recurring' ? '' : 'frm_hidden'; ?>">
76 - <label>
77 - <?php esc_html_e( 'Recurring Payment Limit', 'formidable' ); ?>
78 - </label>
79 - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'payment_limit' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['payment_limit'] ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'payment_limit' ) ); ?>" class="frm_not_email_subject" />
80 - </p>
81 -
82 - <p class="frm_trans_sub_opts frm6 <?php echo $form_action->post_content['type'] === 'recurring' ? '' : 'frm_hidden'; ?>">
83 - <label>
84 - <?php esc_html_e( 'Trial Period', 'formidable' ); ?>
85 - </label>
86 - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'trial_interval_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['trial_interval_count'] ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'trial_interval_count' ) ); ?>" class="frm_not_email_subject" />
87 - <?php esc_html_e( 'day(s)', 'formidable' ); ?>
88 - </p>
89 -
90 - <p class="frm6">
91 - <label for="<?php echo esc_attr( $this->get_field_id( 'currency' ) ); ?>">
92 - <?php esc_html_e( 'Currency', 'formidable' ); ?>
93 - </label>
94 - <?php FrmTransLiteAppHelper::show_currency_dropdown( $this->get_field_id( 'currency' ), $this->get_field_name( 'currency' ), $form_action->post_content ); ?>
95 - </p>
96 -
97 85 <p>
86 + <span class="frm-block frm-mb-6"><?php esc_html_e( 'Gateway(s)', 'formidable' ); ?></span>
98 87 <?php
99 - esc_html_e( 'Gateway(s)', 'formidable' );
100 -
101 88 foreach ( $gateways as $gateway_name => $gateway ) {
102 89 $gateway_classes = $gateway['recurring'] ? '' : 'frm_gateway_no_recur';
103 90 $gateway_classes .= $form_action->post_content['type'] === 'recurring' && ! $gateway['recurring'] ? ' frm_hidden' : '';
104 - $gateway_id = $this->get_field_id( 'gateways' ) . '_' . $gateway_name;
105 -
106 - $radio_atts = array(
91 + $gateway_id = $action_control->get_field_id( 'gateways' ) . '_' . $gateway_name;
92 + $radio_atts = array(
107 93 'type' => 'radio',
108 94 'value' => $gateway_name,
109 - 'name' => $this->get_field_name( 'gateway' ),
95 + 'name' => $action_control->get_field_name( 'gateway' ),
110 96 'id' => $gateway_id,
111 97 );
112 98 ?>
113 - <label for="<?php echo esc_attr( $gateway_id ); ?>" class="frm_gateway_opt <?php echo esc_attr( $gateway_classes ); ?>">
114 - <input
115 - <?php
116 - FrmAppHelper::array_to_html_params( $radio_atts, true );
117 - echo ' ';
118 - FrmAppHelper::checked( $form_action->post_content['gateway'], $gateway_name );
119 - ?>
120 - />
121 - <?php echo esc_html( $gateway['label'] ); ?> &nbsp;
122 - </label>
99 + <label for="<?php echo esc_attr( $gateway_id ); ?>" class="frm_gateway_opt <?php echo esc_attr( $gateway_classes ); ?>">
100 + <input
101 + <?php
102 + FrmAppHelper::array_to_html_params( $radio_atts, true );
103 + echo ' ';
104 + FrmAppHelper::checked( $form_action->post_content['gateway'], $gateway_name );
105 + ?>
106 + />
107 + <?php echo esc_html( $gateway['label'] ); ?> &nbsp;
108 + </label>
123 109 <?php
124 110 }//end foreach
125 111 ?>
126 112 </p>
113 + <?php endif; ?>
127 114
128 115 <?php
129 116 FrmStrpLiteActionsController::add_action_options(
130 117 array(
131 118 'form_action' => $form_action,
132 - 'action_control' => $this,
119 + 'action_control' => $action_control,
133 120 )
134 121 );
135 122 ?>
123 +
124 + <?php $cc_field_id = $action_control->get_credit_card_field_id( $field_dropdown_atts ); ?>
125 + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'credit_card' ) ); ?>" value="<?php echo esc_attr( $cc_field_id ); ?>" />
126 +
127 + <?php $action_control->echo_capture_payment_upsell( $form_action->post_content['gateway'] ); ?>
128 +
129 + <div class="frm_trans_sub_opts <?php echo $form_action->post_content['type'] === 'recurring' ? '' : 'frm_hidden'; ?>">
130 + <div class="frm_grid_container">
131 + <h3><?php esc_html_e( 'Recurring Payment Settings', 'formidable' ); ?></h3>
132 + <?php
133 + /**
134 + * Show warning if PayPal is selected and product name is empty.
135 + * Only show for existing actions (has ID), not new actions.
136 + * Only show when payment type is recurring.
137 + *
138 + * @since 6.31
139 + */
140 + if ( ! empty( $form_action->ID ) && 'recurring' === $form_action->post_content['type'] && in_array( 'paypal', (array) $form_action->post_content['gateway'], true ) && empty( $form_action->post_content['product_name'] ) ) :
141 + ?>
142 + <div class="frm_warning_style frm-with-icon frm-mt-0">
143 + <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
144 + <span><?php esc_html_e( 'Product Name is required for PayPal recurring payments.', 'formidable' ); ?></span>
145 + </div>
146 + <?php endif; ?>
147 +
148 + <?php
149 + /**
150 + * @since 6.31
151 + *
152 + * @param array $args
153 + */
154 + do_action(
155 + 'frm_payments_settings_recurring_product_info',
156 + array(
157 + 'form_action' => $form_action,
158 + 'action_control' => $action_control,
159 + )
160 + );
161 + ?>
162 +
163 + <p class="frm6">
164 + <label>
165 + <?php esc_html_e( 'Repeat', 'formidable' ); ?>
166 + </label>
167 + <span>
168 + <span class="frm_grid_container">
169 + <input class="frm6" type="number" name="<?php echo esc_attr( $action_control->get_field_name( 'interval_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['interval_count'] ); ?>" max="90" min="1" step="1" />
170 + <select class="frm6" name="<?php echo esc_attr( $action_control->get_field_name( 'interval' ) ); ?>" class="auto_width">
171 + <?php foreach ( $repeat_times as $k => $v ) { ?>
172 + <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $form_action->post_content['interval'], $k ); ?>><?php echo esc_html( $v ); ?></option>
173 + <?php } ?>
174 + </select>
175 + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'payment_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['payment_count'] ); ?>" />
176 + </span>
177 + </span>
178 + </p>
179 +
180 + <?php
181 + /*
182 + Note: The Repeat Cadence setting is added with JavaScript.
183 + This hidden input is added so the JS knows what value is set.
184 + */
185 + ?>
186 + <input type="hidden" class="frm-repeat-cadence-value" value="<?php echo esc_attr( $form_action->post_content['repeat_cadence'] ?? 'DAILY' ); ?>" />
187 +
188 + <p class="frm6">
189 + <label>
190 + <?php esc_html_e( 'Recurring Payment Limit', 'formidable' ); ?>
191 + </label>
192 + <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'payment_limit' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['payment_limit'] ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'payment_limit' ) ); ?>" class="frm_not_email_subject" />
193 + </p>
194 +
195 + <p class="frm6">
196 + <label>
197 + <?php esc_html_e( 'Trial Period', 'formidable' ); ?>
198 + </label>
199 + <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'trial_interval_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['trial_interval_count'] ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'trial_interval_count' ) ); ?>" class="frm_not_email_subject" />
200 + <?php esc_html_e( 'day(s)', 'formidable' ); ?>
201 + </p>
202 + </div>
203 + </div>
204 +
205 + <?php
206 + /**
207 + * Allow add-ons to inject settings after the Recurring Payment Settings section.
208 + *
209 + * @since 6.31
210 + *
211 + * @param array $args {
212 + *
213 + * @type object $form_action The form action post object.
214 + * @type object $action_control The action controller object.
215 + * }
216 + */
217 + do_action(
218 + 'frm_payments_settings_after_recurring',
219 + array(
220 + 'form_action' => $form_action,
221 + 'action_control' => $action_control,
222 + )
223 + );
224 + ?>
136 225 </div>
137 -<div class="frm_grid_container">
138 - <h3>
139 - <?php esc_html_e( 'Customer Information', 'formidable' ); ?>
226 +<div class="frm_grid_container frm-mb-xs">
227 + <?php
228 + $billing_label = __( 'Billing Information', 'formidable' );
229 + $customer_label = __( 'Customer Information', 'formidable' );
230 + $is_paypal = in_array( 'paypal', (array) $form_action->post_content['gateway'], true );
231 + ?>
232 + <h3 class="frm-billing-section-heading frm-mt-0" data-billing-label="<?php echo esc_attr( $billing_label ); ?>" data-customer-label="<?php echo esc_attr( $customer_label ); ?>">
233 + <?php echo esc_html( $is_paypal ? $billing_label : $customer_label ); ?>
140 234 </h3>
141 235
142 236 <p class="frm6">
143 237 <label for="<?php echo esc_attr( $action_control->get_field_id( 'email' ) ); ?>">
@@ -142,37 +236,82 @@
142 236 <p class="frm6">
143 237 <label for="<?php echo esc_attr( $action_control->get_field_id( 'email' ) ); ?>">
144 238 <?php esc_html_e( 'Email', 'formidable' ); ?>
145 239 </label>
146 - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'email' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['email'] ); ?>" class="frm_not_email_to large-text" />
240 + <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'email' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'email' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['email'] ); ?>" class="frm_not_email_to large-text" />
147 241 </p>
148 242
243 + <?php if ( ! has_action( 'frm_stripe_lite_customer_info_after_email' ) ) : ?>
244 + <p class="frm6">
245 + <label for="<?php echo esc_attr( $action_control->get_field_id( 'billing_address' ) ); ?>">
246 + <?php esc_html_e( 'Address', 'formidable' ); ?>
247 + </label>
248 + <?php
249 + $action_control->show_fields_dropdown(
250 + $field_dropdown_atts,
251 + array(
252 + 'name' => 'billing_address',
253 + 'allowed_fields' => 'address',
254 + )
255 + );
256 + ?>
257 + </p>
258 + <?php endif; ?>
259 +
149 260 <?php
150 261 /**
151 262 * Trigger an action so Pro can include an Address dropdown.
263 + * When a plugin hooks in here, the default Address dropdown above is not rendered.
152 264 *
153 265 * @since 6.5
154 266 *
155 267 * @param array $args {
156 - * @type FrmFormAction $action_control
157 - * @type array $field_dropdown_atts
268 + *
269 + * @type WP_Post $form_action The form action post object.
270 + * @type FrmFormAction $action_control The action controller object.
271 + * @type array $field_dropdown_atts Attributes for field dropdown rendering.
158 272 * }
159 273 */
160 274 do_action(
161 275 'frm_stripe_lite_customer_info_after_email',
162 - compact( 'action_control', 'field_dropdown_atts' )
276 + compact( 'form_action', 'action_control', 'field_dropdown_atts' )
163 277 );
164 278 ?>
165 279
166 280 <p class="frm6">
167 - <label for="<?php echo esc_attr( $this->get_field_id( 'billing_first_name' ) ); ?>">
281 + <label for="<?php echo esc_attr( $action_control->get_field_id( 'billing_first_name' ) ); ?>">
168 282 <?php esc_html_e( 'First Name', 'formidable' ); ?>
169 283 </label>
170 - <?php $this->show_fields_dropdown( $field_dropdown_atts, array( 'name' => 'billing_first_name' ) ); ?>
284 + <?php $action_control->show_fields_dropdown( $field_dropdown_atts, array( 'name' => 'billing_first_name' ) ); ?>
171 285 </p>
172 286 <p class="frm6">
173 - <label for="<?php echo esc_attr( $this->get_field_id( 'billing_last_name' ) ); ?>">
287 + <label for="<?php echo esc_attr( $action_control->get_field_id( 'billing_last_name' ) ); ?>">
174 288 <?php esc_html_e( 'Last Name', 'formidable' ); ?>
175 289 </label>
176 - <?php $this->show_fields_dropdown( $field_dropdown_atts, array( 'name' => 'billing_last_name' ) ); ?>
290 + <?php $action_control->show_fields_dropdown( $field_dropdown_atts, array( 'name' => 'billing_last_name' ) ); ?>
177 291 </p>
178 292 </div>
293 +
294 +<?php
295 +if ( ! has_action( 'frm_payment_settings_after_customer_info' ) ) {
296 + include FrmTransLiteAppHelper::plugin_path() . '/views/action-settings/paypal-shipping.php';
297 +}
298 +
299 +/**
300 + * Fires after the Customer Information section in payment action settings.
301 + * Used by Pro to add gateway-specific Shipping and Billing sections.
302 + * When a plugin hooks in here, the default Shipping Information section above is not rendered.
303 + *
304 + * @since 6.31
305 + *
306 + * @param array $args {
307 + *
308 + * @type WP_Post $form_action The form action post object.
309 + * @type FrmFormAction $action_control The action controller object.
310 + * @type array $field_dropdown_atts Attributes for field dropdown rendering.
311 + * }
312 + */
313 +do_action(
314 + 'frm_payment_settings_after_customer_info',
315 + compact( 'form_action', 'action_control', 'field_dropdown_atts' )
316 +);
317 +?>