|
@@ -10,7 +10,7 @@ discard block |
|
|
block discarded – undo |
|
10
|
10
|
*/ |
|
11
|
11
|
|
|
12
|
12
|
// Exit if accessed directly |
|
13
|
|
-if ( ! defined( 'ABSPATH' ) ) { |
|
|
13
|
+if ( ! defined('ABSPATH')) { |
|
14
|
14
|
exit; |
|
15
|
15
|
} |
|
16
|
16
|
|
|
@@ -23,64 +23,64 @@ discard block |
|
|
block discarded – undo |
|
23
|
23
|
* |
|
24
|
24
|
* @return string $purchase_form |
|
25
|
25
|
*/ |
|
26
|
|
-function give_get_donation_form( $args = array() ) { |
|
|
26
|
+function give_get_donation_form($args = array()) { |
|
27
|
27
|
|
|
28
|
28
|
global $post; |
|
29
|
29
|
|
|
30
|
|
- $form_id = is_object( $post ) ? $post->ID : 0; |
|
|
30
|
+ $form_id = is_object($post) ? $post->ID : 0; |
|
31
|
31
|
|
|
32
|
|
- if ( isset( $args['id'] ) ) { |
|
|
32
|
+ if (isset($args['id'])) { |
|
33
|
33
|
$form_id = $args['id']; |
|
34
|
34
|
} |
|
35
|
35
|
|
|
36
|
|
- $defaults = apply_filters( 'give_form_args_defaults', array( |
|
|
36
|
+ $defaults = apply_filters('give_form_args_defaults', array( |
|
37
|
37
|
'form_id' => $form_id |
|
38
|
|
- ) ); |
|
|
38
|
+ )); |
|
39
|
39
|
|
|
40
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
40
|
+ $args = wp_parse_args($args, $defaults); |
|
41
|
41
|
|
|
42
|
|
- $form = new Give_Donate_Form( $args['form_id'] ); |
|
|
42
|
+ $form = new Give_Donate_Form($args['form_id']); |
|
43
|
43
|
|
|
44
|
44
|
//bail if no form ID |
|
45
|
|
- if ( empty( $form->ID ) ) { |
|
|
45
|
+ if (empty($form->ID)) { |
|
46
|
46
|
return false; |
|
47
|
47
|
} |
|
48
|
48
|
|
|
49
|
|
- $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
|
49
|
+ $payment_mode = give_get_chosen_gateway($form->ID); |
|
50
|
50
|
|
|
51
|
|
- $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
|
51
|
+ $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52
|
52
|
'payment-mode' => $payment_mode, |
|
53
|
|
- ) ), |
|
|
53
|
+ )), |
|
54
|
54
|
give_get_current_page_url() |
|
55
|
|
- ) ); |
|
|
55
|
+ )); |
|
56
|
56
|
|
|
57
|
57
|
//Sanity Check: Donation form not published or user doesn't have permission to view drafts |
|
58
|
|
- if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
|
58
|
+ if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59
|
59
|
return false; |
|
60
|
60
|
} |
|
61
|
61
|
|
|
62
|
|
- $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
|
62
|
+ $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
63
|
63
|
? $args['display_style'] |
|
64
|
|
- : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
|
64
|
+ : get_post_meta($form->ID, '_give_payment_display', true); |
|
65
|
65
|
|
|
66
|
|
- $float_labels_option = give_is_float_labels_enabled( $args ) |
|
|
66
|
+ $float_labels_option = give_is_float_labels_enabled($args) |
|
67
|
67
|
? ' float-labels-enabled' |
|
68
|
68
|
: ''; |
|
69
|
69
|
|
|
70
|
70
|
//Form Wrap Classes |
|
71
|
|
- $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
|
71
|
+ $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
72
|
72
|
'give-form-wrap', |
|
73
|
|
- 'give-display-' . $display_option |
|
74
|
|
- ), $form->ID, $args ); |
|
75
|
|
- $form_wrap_classes = implode( ' ', $form_wrap_classes_array ); |
|
|
73
|
+ 'give-display-'.$display_option |
|
|
74
|
+ ), $form->ID, $args); |
|
|
75
|
+ $form_wrap_classes = implode(' ', $form_wrap_classes_array); |
|
76
|
76
|
|
|
77
|
77
|
//Form Classes |
|
78
|
|
- $form_classes_array = apply_filters( 'give_form_classes', array( |
|
|
78
|
+ $form_classes_array = apply_filters('give_form_classes', array( |
|
79
|
79
|
'give-form', |
|
80
|
|
- 'give-form-' . $form->ID, |
|
|
80
|
+ 'give-form-'.$form->ID, |
|
81
|
81
|
$float_labels_option |
|
82
|
|
- ), $form->ID, $args ); |
|
83
|
|
- $form_classes = implode( ' ', $form_classes_array ); |
|
|
82
|
+ ), $form->ID, $args); |
|
|
83
|
+ $form_classes = implode(' ', $form_classes_array); |
|
84
|
84
|
|
|
85
|
85
|
|
|
86
|
86
|
ob_start(); |
|
@@ -93,35 +93,35 @@ discard block |
|
|
block discarded – undo |
|
93
|
93
|
* @param int $form ->ID The current form ID |
|
94
|
94
|
* @param array $args An array of form args |
|
95
|
95
|
*/ |
|
96
|
|
- do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
|
96
|
+ do_action('give_pre_form_output', $form->ID, $args); ?> |
|
97
|
97
|
|
|
98
|
98
|
<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
|
99
|
99
|
|
|
100
|
|
- <?php if ( $form->is_close_donation_form() ) { |
|
|
100
|
+ <?php if ($form->is_close_donation_form()) { |
|
101
|
101
|
|
|
102
|
102
|
//Get Goal thank you message. |
|
103
|
|
- $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
104
|
|
- $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
|
103
|
+ $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
|
104
|
+ $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : __('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
105
|
105
|
|
|
106
|
106
|
//Print thank you message. |
|
107
|
|
- apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
|
107
|
+ apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
108
|
108
|
|
|
109
|
109
|
} else { |
|
110
|
110
|
|
|
111
|
|
- if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
|
111
|
+ if (isset($args['show_title']) && $args['show_title'] == true) { |
|
112
|
112
|
|
|
113
|
|
- echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
|
113
|
+ echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
114
|
114
|
|
|
115
|
115
|
} |
|
116
|
116
|
|
|
117
|
|
- do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
|
117
|
+ do_action('give_pre_form', $form->ID, $args); ?> |
|
118
|
118
|
|
|
119
|
119
|
<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
120
|
120
|
<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
|
121
|
|
- <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
122
|
|
- <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
123
|
|
- <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
124
|
|
- <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
|
121
|
+ <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
|
122
|
+ <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
|
123
|
+ <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
|
124
|
+ <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
125
|
125
|
|
|
126
|
126
|
<!-- The following field is for robots only, invisible to humans: --> |
|
127
|
127
|
<span class="give-hidden" style="display: none !important;"> |
|
@@ -132,13 +132,13 @@ discard block |
|
|
block discarded – undo |
|
132
|
132
|
<?php |
|
133
|
133
|
|
|
134
|
134
|
//Price ID hidden field for variable (mult-level) donation forms |
|
135
|
|
- if ( give_has_variable_prices( $form_id ) ) { |
|
|
135
|
+ if (give_has_variable_prices($form_id)) { |
|
136
|
136
|
//get default selected price ID |
|
137
|
|
- $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
|
137
|
+ $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
138
|
138
|
$price_id = 0; |
|
139
|
139
|
//loop through prices |
|
140
|
|
- foreach ( $prices as $price ) { |
|
141
|
|
- if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
|
140
|
+ foreach ($prices as $price) { |
|
|
141
|
+ if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
142
|
142
|
$price_id = $price['_give_id']['level_id']; |
|
143
|
143
|
}; |
|
144
|
144
|
} |
|
@@ -146,20 +146,20 @@ discard block |
|
|
block discarded – undo |
|
146
|
146
|
<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
|
147
|
147
|
<?php } |
|
148
|
148
|
|
|
149
|
|
- do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
|
149
|
+ do_action('give_checkout_form_top', $form->ID, $args); |
|
150
|
150
|
|
|
151
|
|
- do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
|
151
|
+ do_action('give_payment_mode_select', $form->ID, $args); |
|
152
|
152
|
|
|
153
|
|
- do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
|
153
|
+ do_action('give_checkout_form_bottom', $form->ID, $args); |
|
154
|
154
|
|
|
155
|
155
|
?> |
|
156
|
156
|
</form> |
|
157
|
157
|
|
|
158
|
|
- <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
|
158
|
+ <?php do_action('give_post_form', $form->ID, $args); ?> |
|
159
|
159
|
|
|
160
|
160
|
<?php } ?> |
|
161
|
161
|
|
|
162
|
|
- <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
|
162
|
+ <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
163
|
163
|
<?php |
|
164
|
164
|
|
|
165
|
165
|
/** |
|
@@ -170,11 +170,11 @@ discard block |
|
|
block discarded – undo |
|
170
|
170
|
* @param int $form ->ID The current form ID |
|
171
|
171
|
* @param array $args An array of form args |
|
172
|
172
|
*/ |
|
173
|
|
- do_action( 'give_post_form_output', $form->ID, $args ); |
|
|
173
|
+ do_action('give_post_form_output', $form->ID, $args); |
|
174
|
174
|
|
|
175
|
175
|
$final_output = ob_get_clean(); |
|
176
|
176
|
|
|
177
|
|
- echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
|
177
|
+ echo apply_filters('give_donate_form', $final_output, $args); |
|
178
|
178
|
} |
|
179
|
179
|
|
|
180
|
180
|
|
|
@@ -194,43 +194,43 @@ discard block |
|
|
block discarded – undo |
|
194
|
194
|
* @global $give_options Array of all the Give options |
|
195
|
195
|
* @return string |
|
196
|
196
|
*/ |
|
197
|
|
-function give_show_purchase_form( $form_id ) { |
|
|
197
|
+function give_show_purchase_form($form_id) { |
|
198
|
198
|
|
|
199
|
|
- $payment_mode = give_get_chosen_gateway( $form_id ); |
|
|
199
|
+ $payment_mode = give_get_chosen_gateway($form_id); |
|
200
|
200
|
|
|
201
|
|
- if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
|
201
|
+ if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
202
|
202
|
$form_id = $_POST['give_form_id']; |
|
203
|
203
|
} |
|
204
|
204
|
|
|
205
|
|
- do_action( 'give_purchase_form_top', $form_id ); |
|
|
205
|
+ do_action('give_purchase_form_top', $form_id); |
|
206
|
206
|
|
|
207
|
|
- if ( give_can_checkout() && isset( $form_id ) ) { |
|
|
207
|
+ if (give_can_checkout() && isset($form_id)) { |
|
208
|
208
|
|
|
209
|
|
- do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
|
209
|
+ do_action('give_purchase_form_before_register_login', $form_id); |
|
210
|
210
|
|
|
211
|
|
- do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
|
211
|
+ do_action('give_purchase_form_register_login_fields', $form_id); |
|
212
|
212
|
|
|
213
|
|
- do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
|
213
|
+ do_action('give_purchase_form_before_cc_form', $form_id); |
|
214
|
214
|
|
|
215
|
215
|
// Load the credit card form and allow gateways to load their own if they wish |
|
216
|
|
- if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
217
|
|
- do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
|
216
|
+ if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
|
217
|
+ do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
218
|
218
|
} else { |
|
219
|
|
- do_action( 'give_cc_form', $form_id ); |
|
|
219
|
+ do_action('give_cc_form', $form_id); |
|
220
|
220
|
} |
|
221
|
221
|
|
|
222
|
|
- do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
|
222
|
+ do_action('give_purchase_form_after_cc_form', $form_id); |
|
223
|
223
|
|
|
224
|
224
|
} else { |
|
225
|
225
|
// Can't checkout |
|
226
|
|
- do_action( 'give_purchase_form_no_access', $form_id ); |
|
|
226
|
+ do_action('give_purchase_form_no_access', $form_id); |
|
227
|
227
|
|
|
228
|
228
|
} |
|
229
|
229
|
|
|
230
|
|
- do_action( 'give_purchase_form_bottom', $form_id ); |
|
|
230
|
+ do_action('give_purchase_form_bottom', $form_id); |
|
231
|
231
|
} |
|
232
|
232
|
|
|
233
|
|
-add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
|
233
|
+add_action('give_purchase_form', 'give_show_purchase_form'); |
|
234
|
234
|
|
|
235
|
235
|
/** |
|
236
|
236
|
* |
|
@@ -242,26 +242,26 @@ discard block |
|
|
block discarded – undo |
|
242
|
242
|
* |
|
243
|
243
|
* @return void |
|
244
|
244
|
*/ |
|
245
|
|
-function give_show_register_login_fields( $form_id ) { |
|
|
245
|
+function give_show_register_login_fields($form_id) { |
|
246
|
246
|
|
|
247
|
|
- $show_register_form = give_show_login_register_option( $form_id ); |
|
|
247
|
+ $show_register_form = give_show_login_register_option($form_id); |
|
248
|
248
|
|
|
249
|
|
- if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
|
249
|
+ if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
250
|
250
|
<div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
|
251
|
|
- <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
|
251
|
+ <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
252
|
252
|
</div> |
|
253
|
|
- <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
|
253
|
+ <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
254
|
254
|
<div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
|
255
|
|
- <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
|
255
|
+ <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
256
|
256
|
</div> |
|
257
|
257
|
<?php endif; ?> |
|
258
|
258
|
|
|
259
|
|
- <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
260
|
|
- do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
|
259
|
+ <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
|
260
|
+ do_action('give_purchase_form_after_user_info', $form_id); |
|
261
|
261
|
} |
|
262
|
262
|
} |
|
263
|
263
|
|
|
264
|
|
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
|
264
|
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
265
|
265
|
|
|
266
|
266
|
/** |
|
267
|
267
|
* Donation Amount Field |
|
@@ -275,33 +275,33 @@ discard block |
|
|
block discarded – undo |
|
275
|
275
|
* |
|
276
|
276
|
* @return void |
|
277
|
277
|
*/ |
|
278
|
|
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
|
278
|
+function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
279
|
279
|
|
|
280
|
280
|
global $give_options; |
|
281
|
281
|
|
|
282
|
|
- $variable_pricing = give_has_variable_prices( $form_id ); |
|
283
|
|
- $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
284
|
|
- $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
285
|
|
- $symbol = give_currency_symbol( give_get_currency() ); |
|
286
|
|
- $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
287
|
|
- $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
288
|
|
- $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
|
282
|
+ $variable_pricing = give_has_variable_prices($form_id); |
|
|
283
|
+ $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
|
284
|
+ $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
|
285
|
+ $symbol = give_currency_symbol(give_get_currency()); |
|
|
286
|
+ $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
|
287
|
+ $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
|
288
|
+ $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
289
|
289
|
|
|
290
|
|
- do_action( 'give_before_donation_levels', $form_id, $args ); |
|
|
290
|
+ do_action('give_before_donation_levels', $form_id, $args); |
|
291
|
291
|
|
|
292
|
292
|
//Set Price, No Custom Amount Allowed means hidden price field |
|
293
|
|
- if ( $allow_custom_amount == 'no' ) { |
|
|
293
|
+ if ($allow_custom_amount == 'no') { |
|
294
|
294
|
?> |
|
295
|
295
|
|
|
296
|
|
- <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
|
296
|
+ <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
297
|
297
|
<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
|
298
|
298
|
value="<?php echo $default_amount; ?>" required> |
|
299
|
299
|
<div class="set-price give-donation-amount form-row-wide"> |
|
300
|
|
- <?php if ( $currency_position == 'before' ) { |
|
|
300
|
+ <?php if ($currency_position == 'before') { |
|
301
|
301
|
echo $currency_output; |
|
302
|
302
|
} ?> |
|
303
|
303
|
<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
|
304
|
|
- <?php if ( $currency_position == 'after' ) { |
|
|
304
|
+ <?php if ($currency_position == 'after') { |
|
305
|
305
|
echo $currency_output; |
|
306
|
306
|
} ?> |
|
307
|
307
|
</div> |
|
@@ -311,34 +311,34 @@ discard block |
|
|
block discarded – undo |
|
311
|
311
|
?> |
|
312
|
312
|
<div class="give-total-wrap"> |
|
313
|
313
|
<div class="give-donation-amount form-row-wide"> |
|
314
|
|
- <?php if ( $currency_position == 'before' ) { |
|
|
314
|
+ <?php if ($currency_position == 'before') { |
|
315
|
315
|
echo $currency_output; |
|
316
|
316
|
} ?> |
|
317
|
|
- <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
|
317
|
+ <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
318
|
318
|
<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
|
319
|
|
- <?php if ( $currency_position == 'after' ) { |
|
|
319
|
+ <?php if ($currency_position == 'after') { |
|
320
|
320
|
echo $currency_output; |
|
321
|
321
|
} ?> |
|
322
|
322
|
</div> |
|
323
|
323
|
</div> |
|
324
|
324
|
<?php } |
|
325
|
325
|
|
|
326
|
|
- do_action( 'give_after_donation_amount', $form_id, $args ); |
|
|
326
|
+ do_action('give_after_donation_amount', $form_id, $args); |
|
327
|
327
|
|
|
328
|
328
|
//Custom Amount Text |
|
329
|
|
- if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
|
329
|
+ if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
330
|
330
|
<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
|
331
|
331
|
<?php } |
|
332
|
332
|
|
|
333
|
333
|
//Output Variable Pricing Levels |
|
334
|
|
- if ( $variable_pricing ) { |
|
335
|
|
- give_output_levels( $form_id ); |
|
|
334
|
+ if ($variable_pricing) { |
|
|
335
|
+ give_output_levels($form_id); |
|
336
|
336
|
} |
|
337
|
337
|
|
|
338
|
|
- do_action( 'give_after_donation_levels', $form_id, $args ); |
|
|
338
|
+ do_action('give_after_donation_levels', $form_id, $args); |
|
339
|
339
|
} |
|
340
|
340
|
|
|
341
|
|
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
|
341
|
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
342
|
342
|
|
|
343
|
343
|
|
|
344
|
344
|
/** |
|
@@ -350,32 +350,32 @@ discard block |
|
|
block discarded – undo |
|
350
|
350
|
* |
|
351
|
351
|
* @return string |
|
352
|
352
|
*/ |
|
353
|
|
-function give_output_levels( $form_id ) { |
|
|
353
|
+function give_output_levels($form_id) { |
|
354
|
354
|
|
|
355
|
355
|
//Get variable pricing |
|
356
|
|
- $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
357
|
|
- $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
358
|
|
- $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
359
|
|
- $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
360
|
|
- if ( empty( $custom_amount_text ) ) { |
|
361
|
|
- $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
|
356
|
+ $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
|
357
|
+ $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
|
358
|
+ $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
|
359
|
+ $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
|
360
|
+ if (empty($custom_amount_text)) { |
|
|
361
|
+ $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
362
|
362
|
} |
|
363
|
363
|
|
|
364
|
364
|
$output = ''; |
|
365
|
365
|
$counter = 0; |
|
366
|
366
|
|
|
367
|
|
- switch ( $display_style ) { |
|
|
367
|
+ switch ($display_style) { |
|
368
|
368
|
case 'buttons': |
|
369
|
369
|
|
|
370
|
370
|
$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
|
371
|
371
|
|
|
372
|
|
- foreach ( $prices as $price ) { |
|
373
|
|
- $counter ++; |
|
374
|
|
- $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
375
|
|
- $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
|
372
|
+ foreach ($prices as $price) { |
|
|
373
|
+ $counter++; |
|
|
374
|
+ $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
|
375
|
+ $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
376
|
376
|
|
|
377
|
377
|
$output .= '<li>'; |
|
378
|
|
- $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
|
378
|
+ $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
379
|
379
|
$output .= $level_text; |
|
380
|
380
|
$output .= '</button>'; |
|
381
|
381
|
$output .= '</li>'; |
|
@@ -383,7 +383,7 @@ discard block |
|
|
block discarded – undo |
|
383
|
383
|
} |
|
384
|
384
|
|
|
385
|
385
|
//Custom Amount |
|
386
|
|
- if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
|
386
|
+ if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
387
|
387
|
$output .= '<li>'; |
|
388
|
388
|
$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
|
389
|
389
|
$output .= $custom_amount_text; |
|
@@ -399,23 +399,23 @@ discard block |
|
|
block discarded – undo |
|
399
|
399
|
|
|
400
|
400
|
$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
|
401
|
401
|
|
|
402
|
|
- foreach ( $prices as $price ) { |
|
403
|
|
- $counter ++; |
|
404
|
|
- $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
405
|
|
- $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
|
402
|
+ foreach ($prices as $price) { |
|
|
403
|
+ $counter++; |
|
|
404
|
+ $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
|
405
|
+ $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
406
|
406
|
|
|
407
|
407
|
$output .= '<li>'; |
|
408
|
|
- $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
409
|
|
- $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
|
408
|
+ $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
|
409
|
+ $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
410
|
410
|
$output .= '</li>'; |
|
411
|
411
|
|
|
412
|
412
|
} |
|
413
|
413
|
|
|
414
|
414
|
//Custom Amount |
|
415
|
|
- if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
|
415
|
+ if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
416
|
416
|
$output .= '<li>'; |
|
417
|
417
|
$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
|
418
|
|
- $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
|
418
|
+ $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
419
|
419
|
$output .= '</li>'; |
|
420
|
420
|
} |
|
421
|
421
|
|
|
@@ -425,23 +425,23 @@ discard block |
|
|
block discarded – undo |
|
425
|
425
|
|
|
426
|
426
|
case 'dropdown': |
|
427
|
427
|
|
|
428
|
|
- $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
429
|
|
- $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
|
428
|
+ $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>'; |
|
|
429
|
+ $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
430
|
430
|
|
|
431
|
431
|
//first loop through prices |
|
432
|
|
- foreach ( $prices as $price ) { |
|
433
|
|
- $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
434
|
|
- $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
|
432
|
+ foreach ($prices as $price) { |
|
|
433
|
+ $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
|
434
|
+ $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
435
|
435
|
|
|
436
|
|
- $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
|
436
|
+ $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
437
|
437
|
$output .= $level_text; |
|
438
|
438
|
$output .= '</option>'; |
|
439
|
439
|
|
|
440
|
440
|
} |
|
441
|
441
|
|
|
442
|
442
|
//Custom Amount |
|
443
|
|
- if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
444
|
|
- $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
|
443
|
+ if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
|
444
|
+ $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
445
|
445
|
} |
|
446
|
446
|
|
|
447
|
447
|
$output .= '</select>'; |
|
@@ -449,7 +449,7 @@ discard block |
|
|
block discarded – undo |
|
449
|
449
|
break; |
|
450
|
450
|
} |
|
451
|
451
|
|
|
452
|
|
- echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
|
452
|
+ echo apply_filters('give_form_level_output', $output, $form_id); |
|
453
|
453
|
} |
|
454
|
454
|
|
|
455
|
455
|
/** |
|
@@ -461,26 +461,26 @@ discard block |
|
|
block discarded – undo |
|
461
|
461
|
* @param array $args |
|
462
|
462
|
* |
|
463
|
463
|
*/ |
|
464
|
|
-function give_display_checkout_button( $form_id, $args ) { |
|
|
464
|
+function give_display_checkout_button($form_id, $args) { |
|
465
|
465
|
|
|
466
|
|
- $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
|
466
|
+ $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
467
|
467
|
? $args['display_style'] |
|
468
|
|
- : get_post_meta( $form_id, '_give_payment_display', true ); |
|
|
468
|
+ : get_post_meta($form_id, '_give_payment_display', true); |
|
469
|
469
|
|
|
470
|
470
|
//no btn for onpage |
|
471
|
|
- if ( $display_option === 'onpage' ) { |
|
|
471
|
+ if ($display_option === 'onpage') { |
|
472
|
472
|
return; |
|
473
|
473
|
} |
|
474
|
474
|
|
|
475
|
|
- $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
476
|
|
- $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
|
475
|
+ $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
|
476
|
+ $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
477
|
477
|
|
|
478
|
|
- $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
|
478
|
+ $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
479
|
479
|
|
|
480
|
|
- echo apply_filters( 'give_display_checkout_button', $output ); |
|
|
480
|
+ echo apply_filters('give_display_checkout_button', $output); |
|
481
|
481
|
} |
|
482
|
482
|
|
|
483
|
|
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
|
483
|
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
484
|
484
|
|
|
485
|
485
|
/** |
|
486
|
486
|
* Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
|
@@ -491,71 +491,71 @@ discard block |
|
|
block discarded – undo |
|
491
|
491
|
* |
|
492
|
492
|
* @return void |
|
493
|
493
|
*/ |
|
494
|
|
-function give_user_info_fields( $form_id ) { |
|
|
494
|
+function give_user_info_fields($form_id) { |
|
495
|
495
|
|
|
496
|
|
- if ( is_user_logged_in() ) : |
|
497
|
|
- $user_data = get_userdata( get_current_user_id() ); |
|
|
496
|
+ if (is_user_logged_in()) : |
|
|
497
|
+ $user_data = get_userdata(get_current_user_id()); |
|
498
|
498
|
endif; |
|
499
|
499
|
|
|
500
|
|
- do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
|
500
|
+ do_action('give_purchase_form_before_personal_info', $form_id); |
|
501
|
501
|
?> |
|
502
|
502
|
<fieldset id="give_checkout_user_info"> |
|
503
|
|
- <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
|
503
|
+ <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
504
|
504
|
<p id="give-first-name-wrap" class="form-row form-row-first"> |
|
505
|
505
|
<label class="give-label" for="give-first"> |
|
506
|
|
- <?php _e( 'First Name', 'give' ); ?> |
|
507
|
|
- <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
|
506
|
+ <?php _e('First Name', 'give'); ?> |
|
|
507
|
+ <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
508
|
508
|
<span class="give-required-indicator">*</span> |
|
509
|
509
|
<?php } ?> |
|
510
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
|
510
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
511
|
511
|
</label> |
|
512
|
|
- <input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
|
512
|
+ <input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
513
|
513
|
echo ' required '; |
|
514
|
514
|
} ?>/> |
|
515
|
515
|
</p> |
|
516
|
516
|
|
|
517
|
517
|
<p id="give-last-name-wrap" class="form-row form-row-last"> |
|
518
|
518
|
<label class="give-label" for="give-last"> |
|
519
|
|
- <?php _e( 'Last Name', 'give' ); ?> |
|
520
|
|
- <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
|
519
|
+ <?php _e('Last Name', 'give'); ?> |
|
|
520
|
+ <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
521
|
521
|
<span class="give-required-indicator">*</span> |
|
522
|
522
|
<?php } ?> |
|
523
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
|
523
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
524
|
524
|
</label> |
|
525
|
525
|
|
|
526
|
|
- <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
|
526
|
+ <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
527
|
527
|
echo ' required'; |
|
528
|
|
- } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
|
528
|
+ } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
529
|
529
|
echo ' required '; |
|
530
|
530
|
} ?> /> |
|
531
|
531
|
</p> |
|
532
|
532
|
|
|
533
|
|
- <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
|
533
|
+ <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
534
|
534
|
<p id="give-email-wrap" class="form-row form-row-wide"> |
|
535
|
535
|
<label class="give-label" for="give-email"> |
|
536
|
|
- <?php _e( 'Email Address', 'give' ); ?> |
|
537
|
|
- <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
|
536
|
+ <?php _e('Email Address', 'give'); ?> |
|
|
537
|
+ <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
538
|
538
|
<span class="give-required-indicator">*</span> |
|
539
|
539
|
<?php } ?> |
|
540
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
|
540
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
541
|
541
|
</label> |
|
542
|
542
|
|
|
543
|
|
- <input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
|
543
|
+ <input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
544
|
544
|
echo ' required '; |
|
545
|
545
|
} ?>/> |
|
546
|
546
|
|
|
547
|
547
|
</p> |
|
548
|
|
- <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
|
548
|
+ <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
549
|
549
|
|
|
550
|
|
- <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
|
550
|
+ <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
551
|
551
|
</fieldset> |
|
552
|
552
|
<?php |
|
553
|
|
- do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
|
553
|
+ do_action('give_purchase_form_after_personal_info', $form_id); |
|
554
|
554
|
|
|
555
|
555
|
} |
|
556
|
556
|
|
|
557
|
|
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
558
|
|
-add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
|
557
|
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
|
558
|
+add_action('give_register_fields_before', 'give_user_info_fields'); |
|
559
|
559
|
|
|
560
|
560
|
/** |
|
561
|
561
|
* Renders the credit card info form. |
|
@@ -566,73 +566,73 @@ discard block |
|
|
block discarded – undo |
|
566
|
566
|
* |
|
567
|
567
|
* @return void |
|
568
|
568
|
*/ |
|
569
|
|
-function give_get_cc_form( $form_id ) { |
|
|
569
|
+function give_get_cc_form($form_id) { |
|
570
|
570
|
|
|
571
|
571
|
ob_start(); |
|
572
|
572
|
|
|
573
|
|
- do_action( 'give_before_cc_fields', $form_id ); ?> |
|
|
573
|
+ do_action('give_before_cc_fields', $form_id); ?> |
|
574
|
574
|
|
|
575
|
575
|
<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
|
576
|
|
- <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
577
|
|
- <?php if ( is_ssl() ) : ?> |
|
|
576
|
+ <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
|
577
|
+ <?php if (is_ssl()) : ?> |
|
578
|
578
|
<div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
|
579
|
579
|
<span class="give-icon padlock"></span> |
|
580
|
|
- <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
|
580
|
+ <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
581
|
581
|
</div> |
|
582
|
582
|
<?php endif; ?> |
|
583
|
583
|
<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
|
584
|
584
|
<label for="card_number-<?php echo $form_id ?>" class="give-label"> |
|
585
|
|
- <?php _e( 'Card Number', 'give' ); ?> |
|
|
585
|
+ <?php _e('Card Number', 'give'); ?> |
|
586
|
586
|
<span class="give-required-indicator">*</span> |
|
587
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
|
587
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
588
|
588
|
<span class="card-type"></span> |
|
589
|
589
|
</label> |
|
590
|
590
|
|
|
591
|
|
- <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/> |
|
|
591
|
+ <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/> |
|
592
|
592
|
</p> |
|
593
|
593
|
|
|
594
|
594
|
<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
|
595
|
595
|
<label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
|
596
|
|
- <?php _e( 'CVC', 'give' ); ?> |
|
|
596
|
+ <?php _e('CVC', 'give'); ?> |
|
597
|
597
|
<span class="give-required-indicator">*</span> |
|
598
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
|
598
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
599
|
599
|
</label> |
|
600
|
600
|
|
|
601
|
|
- <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/> |
|
|
601
|
+ <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/> |
|
602
|
602
|
</p> |
|
603
|
603
|
|
|
604
|
604
|
<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
|
605
|
605
|
<label for="card_name-<?php echo $form_id ?>" class="give-label"> |
|
606
|
|
- <?php _e( 'Name on the Card', 'give' ); ?> |
|
|
606
|
+ <?php _e('Name on the Card', 'give'); ?> |
|
607
|
607
|
<span class="give-required-indicator">*</span> |
|
608
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
|
608
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
609
|
609
|
</label> |
|
610
|
610
|
|
|
611
|
|
- <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/> |
|
|
611
|
+ <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/> |
|
612
|
612
|
</p> |
|
613
|
|
- <?php do_action( 'give_before_cc_expiration' ); ?> |
|
|
613
|
+ <?php do_action('give_before_cc_expiration'); ?> |
|
614
|
614
|
<p class="card-expiration form-row form-row-one-third"> |
|
615
|
615
|
<label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
|
616
|
|
- <?php _e( 'Expiration', 'give' ); ?> |
|
|
616
|
+ <?php _e('Expiration', 'give'); ?> |
|
617
|
617
|
<span class="give-required-indicator">*</span> |
|
618
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
|
618
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
619
|
619
|
</label> |
|
620
|
620
|
|
|
621
|
621
|
<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
|
622
|
622
|
<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
|
623
|
623
|
|
|
624
|
|
- <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/> |
|
|
624
|
+ <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/> |
|
625
|
625
|
</p> |
|
626
|
|
- <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
|
626
|
+ <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
627
|
627
|
|
|
628
|
628
|
</fieldset> |
|
629
|
629
|
<?php |
|
630
|
|
- do_action( 'give_after_cc_fields', $form_id ); |
|
|
630
|
+ do_action('give_after_cc_fields', $form_id); |
|
631
|
631
|
|
|
632
|
632
|
echo ob_get_clean(); |
|
633
|
633
|
} |
|
634
|
634
|
|
|
635
|
|
-add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
|
635
|
+add_action('give_cc_form', 'give_get_cc_form'); |
|
636
|
636
|
|
|
637
|
637
|
/** |
|
638
|
638
|
* Outputs the default credit card address fields |
|
@@ -643,110 +643,110 @@ discard block |
|
|
block discarded – undo |
|
643
|
643
|
* |
|
644
|
644
|
* @return void |
|
645
|
645
|
*/ |
|
646
|
|
-function give_default_cc_address_fields( $form_id ) { |
|
|
646
|
+function give_default_cc_address_fields($form_id) { |
|
647
|
647
|
|
|
648
|
648
|
$logged_in = is_user_logged_in(); |
|
649
|
649
|
|
|
650
|
|
- if ( $logged_in ) { |
|
651
|
|
- $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
|
650
|
+ if ($logged_in) { |
|
|
651
|
+ $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
652
|
652
|
} |
|
653
|
|
- $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
654
|
|
- $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
655
|
|
- $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
656
|
|
- $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
|
653
|
+ $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
|
654
|
+ $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
|
655
|
+ $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
|
656
|
+ $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
657
|
657
|
ob_start(); ?> |
|
658
|
658
|
<fieldset id="give_cc_address" class="cc-address"> |
|
659
|
|
- <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
660
|
|
- <?php do_action( 'give_cc_billing_top' ); ?> |
|
|
659
|
+ <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
|
660
|
+ <?php do_action('give_cc_billing_top'); ?> |
|
661
|
661
|
<p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
|
662
|
662
|
<label for="card_address" class="give-label"> |
|
663
|
|
- <?php _e( 'Address', 'give' ); ?> |
|
|
663
|
+ <?php _e('Address', 'give'); ?> |
|
664
|
664
|
<?php |
|
665
|
|
- if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
|
665
|
+ if (give_field_is_required('card_address', $form_id)) { ?> |
|
666
|
666
|
<span class="give-required-indicator">*</span> |
|
667
|
667
|
<?php } ?> |
|
668
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
|
668
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
669
|
669
|
</label> |
|
670
|
670
|
|
|
671
|
|
- <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
|
671
|
+ <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
672
|
672
|
echo ' required'; |
|
673
|
|
- } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
|
673
|
+ } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
674
|
674
|
echo ' required '; |
|
675
|
675
|
} ?>/> |
|
676
|
676
|
</p> |
|
677
|
677
|
|
|
678
|
678
|
<p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
|
679
|
679
|
<label for="card_address_2" class="give-label"> |
|
680
|
|
- <?php _e( 'Address Line 2', 'give' ); ?> |
|
681
|
|
- <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
|
680
|
+ <?php _e('Address Line 2', 'give'); ?> |
|
|
681
|
+ <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
682
|
682
|
<span class="give-required-indicator">*</span> |
|
683
|
683
|
<?php } ?> |
|
684
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
|
684
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
685
|
685
|
</label> |
|
686
|
686
|
|
|
687
|
|
- <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
|
687
|
+ <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
688
|
688
|
echo ' required'; |
|
689
|
|
- } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
|
689
|
+ } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
690
|
690
|
echo ' required '; |
|
691
|
691
|
} ?>/> |
|
692
|
692
|
</p> |
|
693
|
693
|
|
|
694
|
694
|
<p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
|
695
|
695
|
<label for="card_city" class="give-label"> |
|
696
|
|
- <?php _e( 'City', 'give' ); ?> |
|
697
|
|
- <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
|
696
|
+ <?php _e('City', 'give'); ?> |
|
|
697
|
+ <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
698
|
698
|
<span class="give-required-indicator">*</span> |
|
699
|
699
|
<?php } ?> |
|
700
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
|
700
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
701
|
701
|
</label> |
|
702
|
|
- <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
|
702
|
+ <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
703
|
703
|
echo ' required'; |
|
704
|
|
- } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
|
704
|
+ } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
705
|
705
|
echo ' required '; |
|
706
|
706
|
} ?>/> |
|
707
|
707
|
</p> |
|
708
|
708
|
|
|
709
|
709
|
<p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
|
710
|
710
|
<label for="card_zip" class="give-label"> |
|
711
|
|
- <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
712
|
|
- <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
|
711
|
+ <?php _e('Zip / Postal Code', 'give'); ?> |
|
|
712
|
+ <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
713
|
713
|
<span class="give-required-indicator">*</span> |
|
714
|
714
|
<?php } ?> |
|
715
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
|
715
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
716
|
716
|
</label> |
|
717
|
717
|
|
|
718
|
|
- <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
|
718
|
+ <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
719
|
719
|
echo ' required'; |
|
720
|
|
- } ?>" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
|
720
|
+ } ?>" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
721
|
721
|
echo ' required '; |
|
722
|
722
|
} ?>/> |
|
723
|
723
|
</p> |
|
724
|
724
|
|
|
725
|
725
|
<p id="give-card-country-wrap" class="form-row form-row-first"> |
|
726
|
726
|
<label for="billing_country" class="give-label"> |
|
727
|
|
- <?php _e( 'Country', 'give' ); ?> |
|
728
|
|
- <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
|
727
|
+ <?php _e('Country', 'give'); ?> |
|
|
728
|
+ <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
729
|
729
|
<span class="give-required-indicator">*</span> |
|
730
|
730
|
<?php } ?> |
|
731
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
|
731
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
732
|
732
|
</label> |
|
733
|
733
|
|
|
734
|
|
- <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
|
734
|
+ <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
735
|
735
|
echo ' required'; |
|
736
|
|
- } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
|
736
|
+ } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
737
|
737
|
echo ' required '; |
|
738
|
738
|
} ?>> |
|
739
|
739
|
<?php |
|
740
|
740
|
|
|
741
|
741
|
$selected_country = give_get_country(); |
|
742
|
742
|
|
|
743
|
|
- if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
|
743
|
+ if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
744
|
744
|
$selected_country = $user_address['country']; |
|
745
|
745
|
} |
|
746
|
746
|
|
|
747
|
747
|
$countries = give_get_country_list(); |
|
748
|
|
- foreach ( $countries as $country_code => $country ) { |
|
749
|
|
- echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
|
748
|
+ foreach ($countries as $country_code => $country) { |
|
|
749
|
+ echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
750
|
750
|
} |
|
751
|
751
|
?> |
|
752
|
752
|
</select> |
|
@@ -754,44 +754,44 @@ discard block |
|
|
block discarded – undo |
|
754
|
754
|
|
|
755
|
755
|
<p id="give-card-state-wrap" class="form-row form-row-last"> |
|
756
|
756
|
<label for="card_state" class="give-label"> |
|
757
|
|
- <?php _e( 'State / Province', 'give' ); ?> |
|
758
|
|
- <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
|
757
|
+ <?php _e('State / Province', 'give'); ?> |
|
|
758
|
+ <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
759
|
759
|
<span class="give-required-indicator">*</span> |
|
760
|
760
|
<?php } ?> |
|
761
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
|
761
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
762
|
762
|
</label> |
|
763
|
763
|
|
|
764
|
764
|
<?php |
|
765
|
765
|
$selected_state = give_get_state(); |
|
766
|
|
- $states = give_get_states( $selected_country ); |
|
|
766
|
+ $states = give_get_states($selected_country); |
|
767
|
767
|
|
|
768
|
|
- if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
|
768
|
+ if ($logged_in && ! empty($user_address['state'])) { |
|
769
|
769
|
$selected_state = $user_address['state']; |
|
770
|
770
|
} |
|
771
|
771
|
|
|
772
|
|
- if ( ! empty( $states ) ) : ?> |
|
773
|
|
- <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
|
772
|
+ if ( ! empty($states)) : ?> |
|
|
773
|
+ <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
774
|
774
|
echo ' required'; |
|
775
|
|
- } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
|
775
|
+ } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
776
|
776
|
echo ' required '; |
|
777
|
777
|
} ?>> |
|
778
|
778
|
<?php |
|
779
|
|
- foreach ( $states as $state_code => $state ) { |
|
780
|
|
- echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
|
779
|
+ foreach ($states as $state_code => $state) { |
|
|
780
|
+ echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
781
|
781
|
} |
|
782
|
782
|
?> |
|
783
|
783
|
</select> |
|
784
|
784
|
<?php else : ?> |
|
785
|
|
- <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
|
785
|
+ <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
786
|
786
|
<?php endif; ?> |
|
787
|
787
|
</p> |
|
788
|
|
- <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
|
788
|
+ <?php do_action('give_cc_billing_bottom'); ?> |
|
789
|
789
|
</fieldset> |
|
790
|
790
|
<?php |
|
791
|
791
|
echo ob_get_clean(); |
|
792
|
792
|
} |
|
793
|
793
|
|
|
794
|
|
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
|
794
|
+add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
795
|
795
|
|
|
796
|
796
|
|
|
797
|
797
|
/** |
|
@@ -803,93 +803,93 @@ discard block |
|
|
block discarded – undo |
|
803
|
803
|
* |
|
804
|
804
|
* @return string |
|
805
|
805
|
*/ |
|
806
|
|
-function give_get_register_fields( $form_id ) { |
|
|
806
|
+function give_get_register_fields($form_id) { |
|
807
|
807
|
|
|
808
|
808
|
global $user_ID; |
|
809
|
809
|
|
|
810
|
|
- if ( is_user_logged_in() ) { |
|
811
|
|
- $user_data = get_userdata( $user_ID ); |
|
|
810
|
+ if (is_user_logged_in()) { |
|
|
811
|
+ $user_data = get_userdata($user_ID); |
|
812
|
812
|
} |
|
813
|
813
|
|
|
814
|
|
- $show_register_form = give_show_login_register_option( $form_id ); |
|
|
814
|
+ $show_register_form = give_show_login_register_option($form_id); |
|
815
|
815
|
|
|
816
|
816
|
ob_start(); ?> |
|
817
|
817
|
<fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
|
818
|
818
|
|
|
819
|
|
- <?php if ( $show_register_form == 'both' ) { ?> |
|
|
819
|
+ <?php if ($show_register_form == 'both') { ?> |
|
820
|
820
|
<div class="give-login-account-wrap"> |
|
821
|
|
- <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
822
|
|
- <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
|
821
|
+ <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
|
822
|
+ <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
823
|
823
|
</p> |
|
824
|
824
|
<p class="give-loading-text"> |
|
825
|
|
- <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
|
825
|
+ <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
826
|
826
|
</div> |
|
827
|
827
|
<?php } ?> |
|
828
|
828
|
|
|
829
|
|
- <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
|
829
|
+ <?php do_action('give_register_fields_before', $form_id); ?> |
|
830
|
830
|
|
|
831
|
831
|
<fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
|
832
|
|
- <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
833
|
|
- if ( ! give_logged_in_only( $form_id ) ) { |
|
834
|
|
- echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
|
832
|
+ <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
|
833
|
+ if ( ! give_logged_in_only($form_id)) { |
|
|
834
|
+ echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
835
|
835
|
} ?></legend> |
|
836
|
|
- <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
|
836
|
+ <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
837
|
837
|
<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
|
838
|
838
|
<label for="give-user-login-<?php echo $form_id; ?>"> |
|
839
|
|
- <?php _e( 'Username', 'give' ); ?> |
|
840
|
|
- <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
|
839
|
+ <?php _e('Username', 'give'); ?> |
|
|
840
|
+ <?php if (give_logged_in_only($form_id)) { ?> |
|
841
|
841
|
<span class="give-required-indicator">*</span> |
|
842
|
842
|
<?php } ?> |
|
843
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
|
843
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
844
|
844
|
</label> |
|
845
|
845
|
|
|
846
|
|
- <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
|
846
|
+ <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
847
|
847
|
echo 'required '; |
|
848
|
|
- } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
|
848
|
+ } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
849
|
849
|
</div> |
|
850
|
850
|
|
|
851
|
851
|
<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
|
852
|
852
|
<label for="give-user-pass-<?php echo $form_id; ?>"> |
|
853
|
|
- <?php _e( 'Password', 'give' ); ?> |
|
854
|
|
- <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
|
853
|
+ <?php _e('Password', 'give'); ?> |
|
|
854
|
+ <?php if (give_logged_in_only($form_id)) { ?> |
|
855
|
855
|
<span class="give-required-indicator">*</span> |
|
856
|
856
|
<?php } ?> |
|
857
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
|
857
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
858
|
858
|
</label> |
|
859
|
859
|
|
|
860
|
|
- <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
|
860
|
+ <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
861
|
861
|
echo 'required '; |
|
862
|
|
- } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
|
862
|
+ } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
863
|
863
|
</div> |
|
864
|
864
|
|
|
865
|
865
|
<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
|
866
|
866
|
<label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
|
867
|
|
- <?php _e( 'Confirm PW', 'give' ); ?> |
|
868
|
|
- <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
|
867
|
+ <?php _e('Confirm PW', 'give'); ?> |
|
|
868
|
+ <?php if (give_logged_in_only($form_id)) { ?> |
|
869
|
869
|
<span class="give-required-indicator">*</span> |
|
870
|
870
|
<?php } ?> |
|
871
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
|
871
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
872
|
872
|
</label> |
|
873
|
873
|
|
|
874
|
|
- <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
|
874
|
+ <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
875
|
875
|
echo 'required '; |
|
876
|
|
- } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
|
876
|
+ } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
877
|
877
|
</div> |
|
878
|
|
- <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
|
878
|
+ <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
879
|
879
|
</fieldset> |
|
880
|
880
|
|
|
881
|
|
- <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
|
881
|
+ <?php do_action('give_register_fields_after', $form_id); ?> |
|
882
|
882
|
|
|
883
|
883
|
<input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
|
884
|
884
|
|
|
885
|
|
- <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
|
885
|
+ <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
886
|
886
|
|
|
887
|
887
|
</fieldset> |
|
888
|
888
|
<?php |
|
889
|
889
|
echo ob_get_clean(); |
|
890
|
890
|
} |
|
891
|
891
|
|
|
892
|
|
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
|
892
|
+add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
893
|
893
|
|
|
894
|
894
|
/** |
|
895
|
895
|
* Gets the login fields for the login form on the checkout. This function hooks |
|
@@ -902,79 +902,79 @@ discard block |
|
|
block discarded – undo |
|
902
|
902
|
* |
|
903
|
903
|
* @return string |
|
904
|
904
|
*/ |
|
905
|
|
-function give_get_login_fields( $form_id ) { |
|
|
905
|
+function give_get_login_fields($form_id) { |
|
906
|
906
|
|
|
907
|
|
- $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
908
|
|
- $show_register_form = give_show_login_register_option( $form_id ); |
|
|
907
|
+ $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
|
908
|
+ $show_register_form = give_show_login_register_option($form_id); |
|
909
|
909
|
|
|
910
|
910
|
ob_start(); |
|
911
|
911
|
?> |
|
912
|
912
|
<fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
|
913
|
|
- <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
914
|
|
- if ( ! give_logged_in_only( $form_id ) ) { |
|
915
|
|
- echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
|
913
|
+ <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
|
914
|
+ if ( ! give_logged_in_only($form_id)) { |
|
|
915
|
+ echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
916
|
916
|
} ?> |
|
917
|
917
|
</legend> |
|
918
|
|
- <?php if ( $show_register_form == 'both' ) { ?> |
|
|
918
|
+ <?php if ($show_register_form == 'both') { ?> |
|
919
|
919
|
<p class="give-new-account-link"> |
|
920
|
|
- <?php _e( 'Need to create an account?', 'give' ); ?> |
|
921
|
|
- <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
922
|
|
- <?php _e( 'Register', 'give' ); |
|
923
|
|
- if ( ! give_logged_in_only( $form_id ) ) { |
|
924
|
|
- echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
|
920
|
+ <?php _e('Need to create an account?', 'give'); ?> |
|
|
921
|
+ <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
|
922
|
+ <?php _e('Register', 'give'); |
|
|
923
|
+ if ( ! give_logged_in_only($form_id)) { |
|
|
924
|
+ echo ' '.__('or checkout as a guest.', 'give'); |
|
925
|
925
|
} ?> |
|
926
|
926
|
</a> |
|
927
|
927
|
</p> |
|
928
|
928
|
<p class="give-loading-text"> |
|
929
|
|
- <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
|
929
|
+ <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
930
|
930
|
<?php } ?> |
|
931
|
|
- <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
|
931
|
+ <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
932
|
932
|
<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
|
933
|
933
|
<label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
|
934
|
|
- <?php _e( 'Username', 'give' ); ?> |
|
935
|
|
- <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
|
934
|
+ <?php _e('Username', 'give'); ?> |
|
|
935
|
+ <?php if (give_logged_in_only($form_id)) { ?> |
|
936
|
936
|
<span class="give-required-indicator">*</span> |
|
937
|
937
|
<?php } ?> |
|
938
|
938
|
</label> |
|
939
|
939
|
|
|
940
|
|
- <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
|
940
|
+ <input class="<?php if (give_logged_in_only($form_id)) { |
|
941
|
941
|
echo 'required '; |
|
942
|
|
- } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
|
942
|
+ } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
943
|
943
|
</div> |
|
944
|
944
|
|
|
945
|
945
|
<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
|
946
|
946
|
<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
|
947
|
|
- <?php _e( 'Password', 'give' ); ?> |
|
948
|
|
- <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
|
947
|
+ <?php _e('Password', 'give'); ?> |
|
|
948
|
+ <?php if (give_logged_in_only($form_id)) { ?> |
|
949
|
949
|
<span class="give-required-indicator">*</span> |
|
950
|
950
|
<?php } ?> |
|
951
|
951
|
</label> |
|
952
|
|
- <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
|
952
|
+ <input class="<?php if (give_logged_in_only($form_id)) { |
|
953
|
953
|
echo 'required '; |
|
954
|
|
- } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
|
954
|
+ } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
955
|
955
|
<input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
|
956
|
956
|
</div> |
|
957
|
957
|
|
|
958
|
958
|
<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
|
959
|
959
|
<span class="give-forgot-password "> |
|
960
|
|
- <a href="<?php echo wp_lostpassword_url( $redirect )?>"> <?php _e( 'Forgot password?' ) ?> </a> |
|
|
960
|
+ <a href="<?php echo wp_lostpassword_url($redirect)?>"> <?php _e('Forgot password?') ?> </a> |
|
961
|
961
|
</span> |
|
962
|
962
|
</div> |
|
963
|
963
|
|
|
964
|
964
|
<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
|
965
|
|
- <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
966
|
|
- <?php if ( $show_register_form !== 'login' ) { ?> |
|
967
|
|
- <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
|
965
|
+ <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
|
966
|
+ <?php if ($show_register_form !== 'login') { ?> |
|
|
967
|
+ <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
968
|
968
|
<?php } ?> |
|
969
|
969
|
<span class="give-loading-animation"></span> |
|
970
|
970
|
</div> |
|
971
|
|
- <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
|
971
|
+ <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
972
|
972
|
</fieldset><!--end #give-login-fields--> |
|
973
|
973
|
<?php |
|
974
|
974
|
echo ob_get_clean(); |
|
975
|
975
|
} |
|
976
|
976
|
|
|
977
|
|
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
|
977
|
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
978
|
978
|
|
|
979
|
979
|
/** |
|
980
|
980
|
* Payment Mode Select |
|
@@ -990,49 +990,49 @@ discard block |
|
|
block discarded – undo |
|
990
|
990
|
* |
|
991
|
991
|
* @return void |
|
992
|
992
|
*/ |
|
993
|
|
-function give_payment_mode_select( $form_id ) { |
|
|
993
|
+function give_payment_mode_select($form_id) { |
|
994
|
994
|
|
|
995
|
995
|
$gateways = give_get_enabled_payment_gateways(); |
|
996
|
996
|
|
|
997
|
|
- do_action( 'give_payment_mode_top', $form_id ); ?> |
|
|
997
|
+ do_action('give_payment_mode_top', $form_id); ?> |
|
998
|
998
|
|
|
999
|
999
|
<fieldset id="give-payment-mode-select"> |
|
1000
|
|
- <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
|
1000
|
+ <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
1001
|
1001
|
<div id="give-payment-mode-wrap"> |
|
1002
|
|
- <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
1003
|
|
- <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
|
1002
|
+ <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
|
1003
|
+ <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
1004
|
1004
|
</legend> |
|
1005
|
1005
|
<?php |
|
1006
|
1006
|
|
|
1007
|
|
- do_action( 'give_payment_mode_before_gateways' ) ?> |
|
|
1007
|
+ do_action('give_payment_mode_before_gateways') ?> |
|
1008
|
1008
|
|
|
1009
|
1009
|
<ul id="give-gateway-radio-list"> |
|
1010
|
|
- <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
1011
|
|
- $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
|
1010
|
+ <?php foreach ($gateways as $gateway_id => $gateway) : |
|
|
1011
|
+ $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
1012
|
1012
|
$checked_class = $checked ? ' give-gateway-option-selected' : ''; |
|
1013
|
|
- echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
1014
|
|
- echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
|
1013
|
+ echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
|
1014
|
+ echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
1015
|
1015
|
echo '</label></li>'; |
|
1016
|
1016
|
endforeach; ?> |
|
1017
|
1017
|
</ul> |
|
1018
|
|
- <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
|
1018
|
+ <?php do_action('give_payment_mode_after_gateways'); ?> |
|
1019
|
1019
|
</div> |
|
1020
|
|
- <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
|
1020
|
+ <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
1021
|
1021
|
</fieldset> |
|
1022
|
1022
|
|
|
1023
|
|
- <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
|
1023
|
+ <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
1024
|
1024
|
|
|
1025
|
1025
|
<div id="give_purchase_form_wrap"> |
|
1026
|
1026
|
|
|
1027
|
|
- <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
|
1027
|
+ <?php do_action('give_purchase_form', $form_id); ?> |
|
1028
|
1028
|
|
|
1029
|
1029
|
</div><!-- the checkout fields are loaded into this--> |
|
1030
|
1030
|
|
|
1031
|
|
- <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
|
1031
|
+ <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
1032
|
1032
|
|
|
1033
|
1033
|
} |
|
1034
|
1034
|
|
|
1035
|
|
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
|
1035
|
+add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1036
|
1036
|
|
|
1037
|
1037
|
|
|
1038
|
1038
|
/** |
|
@@ -1047,36 +1047,36 @@ discard block |
|
|
block discarded – undo |
|
1047
|
1047
|
* |
|
1048
|
1048
|
* @return void |
|
1049
|
1049
|
*/ |
|
1050
|
|
-function give_terms_agreement( $form_id ) { |
|
|
1050
|
+function give_terms_agreement($form_id) { |
|
1051
|
1051
|
|
|
1052
|
|
- $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1053
|
|
- $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1054
|
|
- $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
|
1052
|
+ $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
|
1053
|
+ $label = get_post_meta($form_id, '_give_agree_label', true); |
|
|
1054
|
+ $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1055
|
1055
|
|
|
1056
|
|
- if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
|
1056
|
+ if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1057
|
1057
|
<fieldset id="give_terms_agreement"> |
|
1058
|
|
- <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
|
1058
|
+ <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
1059
|
1059
|
<?php |
|
1060
|
|
- do_action( 'give_before_terms' ); |
|
1061
|
|
- echo wpautop( stripslashes( $terms ) ); |
|
1062
|
|
- do_action( 'give_after_terms' ); |
|
|
1060
|
+ do_action('give_before_terms'); |
|
|
1061
|
+ echo wpautop(stripslashes($terms)); |
|
|
1062
|
+ do_action('give_after_terms'); |
|
1063
|
1063
|
?> |
|
1064
|
1064
|
</div> |
|
1065
|
1065
|
<div id="give_show_terms"> |
|
1066
|
|
- <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
1067
|
|
- <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
|
1066
|
+ <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php _e('Show Terms', 'give'); ?></a> |
|
|
1067
|
+ <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
1068
|
1068
|
</div> |
|
1069
|
1069
|
|
|
1070
|
1070
|
<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
|
1071
|
1071
|
<label |
|
1072
|
|
- for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
|
1072
|
+ for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
1073
|
1073
|
|
|
1074
|
1074
|
</fieldset> |
|
1075
|
1075
|
<?php |
|
1076
|
1076
|
} |
|
1077
|
1077
|
} |
|
1078
|
1078
|
|
|
1079
|
|
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
|
1079
|
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1080
|
1080
|
|
|
1081
|
1081
|
/** |
|
1082
|
1082
|
* Checkout Final Total |
|
@@ -1088,27 +1088,27 @@ discard block |
|
|
block discarded – undo |
|
1088
|
1088
|
* @since 1.0 |
|
1089
|
1089
|
* @return void |
|
1090
|
1090
|
*/ |
|
1091
|
|
-function give_checkout_final_total( $form_id ) { |
|
|
1091
|
+function give_checkout_final_total($form_id) { |
|
1092
|
1092
|
|
|
1093
|
|
- if ( isset( $_POST['give_total'] ) ) { |
|
1094
|
|
- $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
|
1093
|
+ if (isset($_POST['give_total'])) { |
|
|
1094
|
+ $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1095
|
1095
|
} else { |
|
1096
|
1096
|
//default total |
|
1097
|
|
- $total = give_get_default_form_amount( $form_id ); |
|
|
1097
|
+ $total = give_get_default_form_amount($form_id); |
|
1098
|
1098
|
} |
|
1099
|
1099
|
//Only proceed if give_total available |
|
1100
|
|
- if ( empty( $total ) ) { |
|
|
1100
|
+ if (empty($total)) { |
|
1101
|
1101
|
return; |
|
1102
|
1102
|
} |
|
1103
|
1103
|
?> |
|
1104
|
1104
|
<p id="give-final-total-wrap" class="form-wrap "> |
|
1105
|
|
- <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
1106
|
|
- <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
|
1105
|
+ <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
|
1106
|
+ <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1107
|
1107
|
</p> |
|
1108
|
1108
|
<?php |
|
1109
|
1109
|
} |
|
1110
|
1110
|
|
|
1111
|
|
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
|
1111
|
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1112
|
1112
|
|
|
1113
|
1113
|
|
|
1114
|
1114
|
/** |
|
@@ -1120,22 +1120,22 @@ discard block |
|
|
block discarded – undo |
|
1120
|
1120
|
* |
|
1121
|
1121
|
* @return void |
|
1122
|
1122
|
*/ |
|
1123
|
|
-function give_checkout_submit( $form_id ) { |
|
|
1123
|
+function give_checkout_submit($form_id) { |
|
1124
|
1124
|
?> |
|
1125
|
1125
|
<fieldset id="give_purchase_submit"> |
|
1126
|
|
- <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
|
1126
|
+ <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1127
|
1127
|
|
|
1128
|
|
- <?php give_checkout_hidden_fields( $form_id ); ?> |
|
|
1128
|
+ <?php give_checkout_hidden_fields($form_id); ?> |
|
1129
|
1129
|
|
|
1130
|
|
- <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
|
1130
|
+ <?php echo give_checkout_button_purchase($form_id); ?> |
|
1131
|
1131
|
|
|
1132
|
|
- <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
|
1132
|
+ <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1133
|
1133
|
|
|
1134
|
1134
|
</fieldset> |
|
1135
|
1135
|
<?php |
|
1136
|
1136
|
} |
|
1137
|
1137
|
|
|
1138
|
|
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
|
1138
|
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1139
|
1139
|
|
|
1140
|
1140
|
|
|
1141
|
1141
|
/** |
|
@@ -1148,17 +1148,17 @@ discard block |
|
|
block discarded – undo |
|
1148
|
1148
|
* |
|
1149
|
1149
|
* @return string |
|
1150
|
1150
|
*/ |
|
1151
|
|
-function give_checkout_button_purchase( $form_id ) { |
|
|
1151
|
+function give_checkout_button_purchase($form_id) { |
|
1152
|
1152
|
|
|
1153
|
|
- $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1154
|
|
- $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
|
1153
|
+ $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
|
1154
|
+ $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
1155
|
1155
|
ob_start(); ?> |
|
1156
|
1156
|
<div class="give-submit-button-wrap give-clearfix"> |
|
1157
|
1157
|
<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
|
1158
|
1158
|
<span class="give-loading-animation"></span> |
|
1159
|
1159
|
</div> |
|
1160
|
1160
|
<?php |
|
1161
|
|
- return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
|
1161
|
+ return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1162
|
1162
|
} |
|
1163
|
1163
|
|
|
1164
|
1164
|
/** |
|
@@ -1171,18 +1171,18 @@ discard block |
|
|
block discarded – undo |
|
1171
|
1171
|
* |
|
1172
|
1172
|
* @return void |
|
1173
|
1173
|
*/ |
|
1174
|
|
-function give_agree_to_terms_js( $form_id ) { |
|
|
1174
|
+function give_agree_to_terms_js($form_id) { |
|
1175
|
1175
|
|
|
1176
|
|
- $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
|
1176
|
+ $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1177
|
1177
|
|
|
1178
|
|
- if ( $form_option === 'yes' ) { |
|
|
1178
|
+ if ($form_option === 'yes') { |
|
1179
|
1179
|
?> |
|
1180
|
1180
|
<script type="text/javascript"> |
|
1181
|
1181
|
jQuery(document).ready(function ($) { |
|
1182
|
|
- $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
|
1182
|
+ $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1183
|
1183
|
e.preventDefault(); |
|
1184
|
|
- $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1185
|
|
- $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
|
1184
|
+ $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
|
1185
|
+ $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1186
|
1186
|
return false; |
|
1187
|
1187
|
}); |
|
1188
|
1188
|
}); |
|
@@ -1191,7 +1191,7 @@ discard block |
|
|
block discarded – undo |
|
1191
|
1191
|
} |
|
1192
|
1192
|
} |
|
1193
|
1193
|
|
|
1194
|
|
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
|
1194
|
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1195
|
1195
|
|
|
1196
|
1196
|
/** |
|
1197
|
1197
|
* Show Give Goals |
|
@@ -1204,25 +1204,25 @@ discard block |
|
|
block discarded – undo |
|
1204
|
1204
|
* @return mixed |
|
1205
|
1205
|
*/ |
|
1206
|
1206
|
|
|
1207
|
|
-function give_show_goal_progress( $form_id, $args ) { |
|
|
1207
|
+function give_show_goal_progress($form_id, $args) { |
|
1208
|
1208
|
|
|
1209
|
|
- $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
1210
|
|
- $form = new Give_Donate_Form( $form_id ); |
|
|
1209
|
+ $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
|
1210
|
+ $form = new Give_Donate_Form($form_id); |
|
1211
|
1211
|
$goal = $form->goal; |
|
1212
|
|
- $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
|
1212
|
+ $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
1213
|
1213
|
$income = $form->get_earnings(); |
|
1214
|
|
- $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
1215
|
|
- $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1216
|
|
- $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
|
1214
|
+ $color = get_post_meta($form_id, '_give_goal_color', true); |
|
|
1215
|
+ $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
|
1216
|
+ $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1217
|
1217
|
|
|
1218
|
1218
|
//Sanity check - respect shortcode args |
|
1219
|
|
- if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
|
1219
|
+ if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
1220
|
1220
|
return false; |
|
1221
|
1221
|
} |
|
1222
|
1222
|
|
|
1223
|
1223
|
//Sanity check - ensure form has goal set to output |
|
1224
|
|
- if ( empty( $form->ID ) |
|
1225
|
|
- || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
|
1224
|
+ if (empty($form->ID) |
|
|
1225
|
+ || (is_singular('give_forms') && $goal_option !== 'yes') |
|
1226
|
1226
|
|| $goal_option !== 'yes' |
|
1227
|
1227
|
|| $goal == 0 |
|
1228
|
1228
|
) { |
|
@@ -1230,26 +1230,26 @@ discard block |
|
|
block discarded – undo |
|
1230
|
1230
|
return false; |
|
1231
|
1231
|
} |
|
1232
|
1232
|
|
|
1233
|
|
- $progress = round( ( $income / $goal ) * 100, 2 ); |
|
|
1233
|
+ $progress = round(($income / $goal) * 100, 2); |
|
1234
|
1234
|
|
|
1235
|
|
- if ( $income >= $goal ) { |
|
|
1235
|
+ if ($income >= $goal) { |
|
1236
|
1236
|
$progress = 100; |
|
1237
|
1237
|
} |
|
1238
|
1238
|
|
|
1239
|
1239
|
$output = '<div class="give-goal-progress">'; |
|
1240
|
1240
|
|
|
1241
|
1241
|
//Goal Progress Text |
|
1242
|
|
- if ( ! empty( $show_text ) ) { |
|
|
1242
|
+ if ( ! empty($show_text)) { |
|
1243
|
1243
|
|
|
1244
|
1244
|
$output .= '<div class="raised">'; |
|
1245
|
1245
|
|
|
1246
|
|
- if ( $goal_format !== 'percentage' ) { |
|
|
1246
|
+ if ($goal_format !== 'percentage') { |
|
1247
|
1247
|
|
|
1248
|
|
- $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>'; |
|
|
1248
|
+ $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>'; |
|
1249
|
1249
|
|
|
1250
|
|
- } elseif ( $goal_format == 'percentage' ) { |
|
|
1250
|
+ } elseif ($goal_format == 'percentage') { |
|
1251
|
1251
|
|
|
1252
|
|
- $output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>'; |
|
|
1252
|
+ $output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>'; |
|
1253
|
1253
|
|
|
1254
|
1254
|
} |
|
1255
|
1255
|
|
|
@@ -1258,11 +1258,11 @@ discard block |
|
|
block discarded – undo |
|
1258
|
1258
|
} |
|
1259
|
1259
|
|
|
1260
|
1260
|
//Goal Progress Bar |
|
1261
|
|
- if ( ! empty( $show_bar ) ) { |
|
|
1261
|
+ if ( ! empty($show_bar)) { |
|
1262
|
1262
|
$output .= '<div class="give-progress-bar">'; |
|
1263
|
|
- $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
1264
|
|
- if ( ! empty( $color ) ) { |
|
1265
|
|
- $output .= 'background-color:' . $color; |
|
|
1263
|
+ $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
|
1264
|
+ if ( ! empty($color)) { |
|
|
1265
|
+ $output .= 'background-color:'.$color; |
|
1266
|
1266
|
} |
|
1267
|
1267
|
$output .= '"></span>'; |
|
1268
|
1268
|
$output .= '</div><!-- /.give-progress-bar -->'; |
|
@@ -1270,13 +1270,13 @@ discard block |
|
|
block discarded – undo |
|
1270
|
1270
|
|
|
1271
|
1271
|
$output .= '</div><!-- /.goal-progress -->'; |
|
1272
|
1272
|
|
|
1273
|
|
- echo apply_filters( 'give_goal_output', $output ); |
|
|
1273
|
+ echo apply_filters('give_goal_output', $output); |
|
1274
|
1274
|
|
|
1275
|
1275
|
return false; |
|
1276
|
1276
|
|
|
1277
|
1277
|
} |
|
1278
|
1278
|
|
|
1279
|
|
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
|
1279
|
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1280
|
1280
|
|
|
1281
|
1281
|
/** |
|
1282
|
1282
|
* Adds Actions to Render Form Content |
|
@@ -1288,19 +1288,19 @@ discard block |
|
|
block discarded – undo |
|
1288
|
1288
|
* |
|
1289
|
1289
|
* @return void |
|
1290
|
1290
|
*/ |
|
1291
|
|
-function give_form_content( $form_id, $args ) { |
|
|
1291
|
+function give_form_content($form_id, $args) { |
|
1292
|
1292
|
|
|
1293
|
|
- $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
|
1293
|
+ $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1294
|
1294
|
? $args['show_content'] |
|
1295
|
|
- : get_post_meta( $form_id, '_give_content_option', true ); |
|
|
1295
|
+ : get_post_meta($form_id, '_give_content_option', true); |
|
1296
|
1296
|
|
|
1297
|
|
- if ( $show_content !== 'none' ) { |
|
|
1297
|
+ if ($show_content !== 'none') { |
|
1298
|
1298
|
//add action according to value |
|
1299
|
|
- add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
|
1299
|
+ add_action($show_content, 'give_form_display_content', 10, 2); |
|
1300
|
1300
|
} |
|
1301
|
1301
|
} |
|
1302
|
1302
|
|
|
1303
|
|
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
|
1303
|
+add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1304
|
1304
|
|
|
1305
|
1305
|
/** |
|
1306
|
1306
|
* Renders Post Form Content |
|
@@ -1312,24 +1312,24 @@ discard block |
|
|
block discarded – undo |
|
1312
|
1312
|
* @return void |
|
1313
|
1313
|
* @since 1.0 |
|
1314
|
1314
|
*/ |
|
1315
|
|
-function give_form_display_content( $form_id, $args ) { |
|
|
1315
|
+function give_form_display_content($form_id, $args) { |
|
1316
|
1316
|
|
|
1317
|
|
- $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1318
|
|
- $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
|
1317
|
+ $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
|
1318
|
+ $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1319
|
1319
|
? $args['show_content'] |
|
1320
|
|
- : get_post_meta( $form_id, '_give_content_option', true ); |
|
|
1320
|
+ : get_post_meta($form_id, '_give_content_option', true); |
|
1321
|
1321
|
|
|
1322
|
|
- if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1323
|
|
- $content = apply_filters( 'the_content', $content ); |
|
|
1322
|
+ if (give_get_option('disable_the_content_filter') !== 'on') { |
|
|
1323
|
+ $content = apply_filters('the_content', $content); |
|
1324
|
1324
|
} |
|
1325
|
1325
|
|
|
1326
|
|
- $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
|
1326
|
+ $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1327
|
1327
|
|
|
1328
|
|
- echo apply_filters( 'give_form_content_output', $output ); |
|
|
1328
|
+ echo apply_filters('give_form_content_output', $output); |
|
1329
|
1329
|
|
|
1330
|
1330
|
//remove action to prevent content output on addition forms on page |
|
1331
|
1331
|
//@see: https://github.com/WordImpress/Give/issues/634 |
|
1332
|
|
- remove_action( $show_content, 'give_form_display_content' ); |
|
|
1332
|
+ remove_action($show_content, 'give_form_display_content'); |
|
1333
|
1333
|
} |
|
1334
|
1334
|
|
|
1335
|
1335
|
|
|
@@ -1342,16 +1342,16 @@ discard block |
|
|
block discarded – undo |
|
1342
|
1342
|
* |
|
1343
|
1343
|
* @return void |
|
1344
|
1344
|
*/ |
|
1345
|
|
-function give_checkout_hidden_fields( $form_id ) { |
|
|
1345
|
+function give_checkout_hidden_fields($form_id) { |
|
1346
|
1346
|
|
|
1347
|
|
- do_action( 'give_hidden_fields_before', $form_id ); |
|
1348
|
|
- if ( is_user_logged_in() ) { ?> |
|
|
1347
|
+ do_action('give_hidden_fields_before', $form_id); |
|
|
1348
|
+ if (is_user_logged_in()) { ?> |
|
1349
|
1349
|
<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
|
1350
|
1350
|
<?php } ?> |
|
1351
|
1351
|
<input type="hidden" name="give_action" value="purchase"/> |
|
1352
|
|
- <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
|
1352
|
+ <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1353
|
1353
|
<?php |
|
1354
|
|
- do_action( 'give_hidden_fields_after', $form_id ); |
|
|
1354
|
+ do_action('give_hidden_fields_after', $form_id); |
|
1355
|
1355
|
|
|
1356
|
1356
|
} |
|
1357
|
1357
|
|
|
@@ -1366,20 +1366,20 @@ discard block |
|
|
block discarded – undo |
|
1366
|
1366
|
* |
|
1367
|
1367
|
* @return string $content Filtered content |
|
1368
|
1368
|
*/ |
|
1369
|
|
-function give_filter_success_page_content( $content ) { |
|
|
1369
|
+function give_filter_success_page_content($content) { |
|
1370
|
1370
|
|
|
1371
|
1371
|
global $give_options; |
|
1372
|
1372
|
|
|
1373
|
|
- if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1374
|
|
- if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1375
|
|
- $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
|
1373
|
+ if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
|
1374
|
+ if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
|
1375
|
+ $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1376
|
1376
|
} |
|
1377
|
1377
|
} |
|
1378
|
1378
|
|
|
1379
|
1379
|
return $content; |
|
1380
|
1380
|
} |
|
1381
|
1381
|
|
|
1382
|
|
-add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
|
1382
|
+add_filter('the_content', 'give_filter_success_page_content'); |
|
1383
|
1383
|
|
|
1384
|
1384
|
|
|
1385
|
1385
|
/** |
|
@@ -1391,14 +1391,14 @@ discard block |
|
|
block discarded – undo |
|
1391
|
1391
|
|
|
1392
|
1392
|
function give_test_mode_frontend_warning() { |
|
1393
|
1393
|
|
|
1394
|
|
- $test_mode = give_get_option( 'test_mode' ); |
|
|
1394
|
+ $test_mode = give_get_option('test_mode'); |
|
1395
|
1395
|
|
|
1396
|
|
- if ( $test_mode == 'on' ) { |
|
1397
|
|
- echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
|
1396
|
+ if ($test_mode == 'on') { |
|
|
1397
|
+ echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
1398
|
1398
|
} |
|
1399
|
1399
|
} |
|
1400
|
1400
|
|
|
1401
|
|
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
|
1401
|
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1402
|
1402
|
|
|
1403
|
1403
|
|
|
1404
|
1404
|
/** |
|
@@ -1408,21 +1408,21 @@ discard block |
|
|
block discarded – undo |
|
1408
|
1408
|
* @since 1.4.1 |
|
1409
|
1409
|
*/ |
|
1410
|
1410
|
|
|
1411
|
|
-function give_members_only_form( $final_output, $args ) { |
|
|
1411
|
+function give_members_only_form($final_output, $args) { |
|
1412
|
1412
|
|
|
1413
|
|
- $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
|
1413
|
+ $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1414
|
1414
|
|
|
1415
|
1415
|
//Sanity Check: Must have form_id & not be logged in |
|
1416
|
|
- if ( empty( $form_id ) || is_user_logged_in() ) { |
|
|
1416
|
+ if (empty($form_id) || is_user_logged_in()) { |
|
1417
|
1417
|
return $final_output; |
|
1418
|
1418
|
} |
|
1419
|
1419
|
|
|
1420
|
1420
|
//Logged in only and Register / Login set to none |
|
1421
|
|
- if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
|
1421
|
+ if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1422
|
1422
|
|
|
1423
|
|
- $final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false ); |
|
|
1423
|
+ $final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false); |
|
1424
|
1424
|
|
|
1425
|
|
- return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
|
1425
|
+ return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1426
|
1426
|
|
|
1427
|
1427
|
} |
|
1428
|
1428
|
|
|
@@ -1430,4 +1430,4 @@ discard block |
|
|
block discarded – undo |
|
1430
|
1430
|
|
|
1431
|
1431
|
} |
|
1432
|
1432
|
|
|
1433
|
|
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
|
1433
|
+add_filter('give_donate_form', 'give_members_only_form', 10, 2); |