|
@@ -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,56 +23,56 @@ 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
|
|
- $post_id = is_object( $post ) ? $post->ID : 0; |
|
30
|
+ $post_id = is_object($post) ? $post->ID : 0; |
31
|
31
|
|
32
|
|
- if ( isset( $args['id'] ) ) { |
|
32
|
+ if (isset($args['id'])) { |
33
|
33
|
$post_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' => $post_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
|
|
- if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_product', $form->ID ) ) { |
|
57
|
+ if ('publish' !== $form->post_status && ! current_user_can('edit_product', $form->ID)) { |
58
|
58
|
return false; // Product not published or user doesn't have permission to view drafts |
59
|
59
|
} |
60
|
60
|
|
61
|
|
- $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
61
|
+ $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
62
|
62
|
? $args['display_style'] |
63
|
|
- : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
63
|
+ : get_post_meta($form->ID, '_give_payment_display', true); |
64
|
64
|
|
65
|
|
- $float_labels_option = give_is_float_labels_enabled( $args ) |
|
65
|
+ $float_labels_option = give_is_float_labels_enabled($args) |
66
|
66
|
? ' float-labels-enabled' |
67
|
67
|
: ''; |
68
|
68
|
|
69
|
69
|
|
70
|
|
- $form_classes_array = apply_filters( 'give_form_classes', array( |
|
70
|
+ $form_classes_array = apply_filters('give_form_classes', array( |
71
|
71
|
'give-form-wrap', |
72
|
|
- 'give-display-' . $display_option |
73
|
|
- ), $form->ID, $args ); |
|
72
|
+ 'give-display-'.$display_option |
|
73
|
+ ), $form->ID, $args); |
74
|
74
|
|
75
|
|
- $form_classes = implode( ' ', $form_classes_array ); |
|
75
|
+ $form_classes = implode(' ', $form_classes_array); |
76
|
76
|
|
77
|
77
|
ob_start(); |
78
|
78
|
|
|
@@ -84,34 +84,34 @@ discard block |
|
|
block discarded – undo |
84
|
84
|
* @param int $form ->ID The current form ID |
85
|
85
|
* @param array $args An array of form args |
86
|
86
|
*/ |
87
|
|
- do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
87
|
+ do_action('give_pre_form_output', $form->ID, $args); ?> |
88
|
88
|
|
89
|
89
|
<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_classes; ?>"> |
90
|
90
|
|
91
|
91
|
<?php |
92
|
|
- if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
92
|
+ if (isset($args['show_title']) && $args['show_title'] == true) { |
93
|
93
|
|
94
|
|
- echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $post_id ) . '</h2>' ); |
|
94
|
+ echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($post_id).'</h2>'); |
95
|
95
|
|
96
|
96
|
} ?> |
97
|
97
|
|
98
|
|
- <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
98
|
+ <?php do_action('give_pre_form', $form->ID, $args); ?> |
99
|
99
|
|
100
|
|
- <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint( $form->ID ); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
100
|
+ <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint($form->ID); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
101
|
101
|
<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
102
|
|
- <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
103
|
|
- <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
104
|
|
- <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
105
|
|
- <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price( $form->ID ); ?>"/> |
|
102
|
+ <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
103
|
+ <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
104
|
+ <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
105
|
+ <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price($form->ID); ?>"/> |
106
|
106
|
<?php |
107
|
107
|
//Price ID hidden field for variable (mult-level) donation forms |
108
|
|
- if ( give_has_variable_prices( $post_id ) ) { |
|
108
|
+ if (give_has_variable_prices($post_id)) { |
109
|
109
|
//get default selected price ID |
110
|
|
- $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $post_id ), $post_id ); |
|
110
|
+ $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($post_id), $post_id); |
111
|
111
|
$price_id = 0; |
112
|
112
|
//loop through prices |
113
|
|
- foreach ( $prices as $price ) { |
114
|
|
- if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
113
|
+ foreach ($prices as $price) { |
|
114
|
+ if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
115
|
115
|
$price_id = $price['_give_id']['level_id']; |
116
|
116
|
}; |
117
|
117
|
} |
|
@@ -119,19 +119,19 @@ discard block |
|
|
block discarded – undo |
119
|
119
|
<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
120
|
120
|
<?php } |
121
|
121
|
|
122
|
|
- do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
122
|
+ do_action('give_checkout_form_top', $form->ID, $args); |
123
|
123
|
|
124
|
|
- do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
124
|
+ do_action('give_payment_mode_select', $form->ID, $args); |
125
|
125
|
|
126
|
|
- do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
126
|
+ do_action('give_checkout_form_bottom', $form->ID, $args); |
127
|
127
|
|
128
|
128
|
?> |
129
|
129
|
|
130
|
130
|
</form> |
131
|
131
|
|
132
|
|
- <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
132
|
+ <?php do_action('give_post_form', $form->ID, $args); ?> |
133
|
133
|
|
134
|
|
- <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
134
|
+ <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
135
|
135
|
<?php |
136
|
136
|
|
137
|
137
|
/** |
|
@@ -142,11 +142,11 @@ discard block |
|
|
block discarded – undo |
142
|
142
|
* @param int $form ->ID The current form ID |
143
|
143
|
* @param array $args An array of form args |
144
|
144
|
*/ |
145
|
|
- do_action( 'give_post_form_output', $form->ID, $args ); |
|
145
|
+ do_action('give_post_form_output', $form->ID, $args); |
146
|
146
|
|
147
|
147
|
$final_output = ob_get_clean(); |
148
|
148
|
|
149
|
|
- echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
149
|
+ echo apply_filters('give_donate_form', $final_output, $args); |
150
|
150
|
} |
151
|
151
|
|
152
|
152
|
|
|
@@ -166,57 +166,57 @@ discard block |
|
|
block discarded – undo |
166
|
166
|
* @global $give_options Array of all the Give options |
167
|
167
|
* @return string |
168
|
168
|
*/ |
169
|
|
-function give_show_purchase_form( $form_id ) { |
|
169
|
+function give_show_purchase_form($form_id) { |
170
|
170
|
|
171
|
|
- $payment_mode = give_get_chosen_gateway( $form_id ); |
|
171
|
+ $payment_mode = give_get_chosen_gateway($form_id); |
172
|
172
|
|
173
|
|
- if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
173
|
+ if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
174
|
174
|
$form_id = $_POST['give_form_id']; |
175
|
175
|
} |
176
|
176
|
|
177
|
|
- do_action( 'give_purchase_form_top', $form_id ); |
|
177
|
+ do_action('give_purchase_form_top', $form_id); |
178
|
178
|
|
179
|
|
- if ( give_can_checkout() && isset( $form_id ) ) { |
|
179
|
+ if (give_can_checkout() && isset($form_id)) { |
180
|
180
|
|
181
|
|
- do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
181
|
+ do_action('give_purchase_form_before_register_login', $form_id); |
182
|
182
|
|
183
|
|
- $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
183
|
+ $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
184
|
184
|
|
185
|
|
- if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
185
|
+ if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
186
|
186
|
<div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
187
|
|
- <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
187
|
+ <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
188
|
188
|
</div> |
189
|
|
- <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
189
|
+ <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
190
|
190
|
<div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
191
|
|
- <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
191
|
+ <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
192
|
192
|
</div> |
193
|
193
|
<?php endif; ?> |
194
|
194
|
|
195
|
|
- <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
196
|
|
- do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
195
|
+ <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
196
|
+ do_action('give_purchase_form_after_user_info', $form_id); |
197
|
197
|
} |
198
|
198
|
|
199
|
|
- do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
199
|
+ do_action('give_purchase_form_before_cc_form', $form_id); |
200
|
200
|
|
201
|
201
|
// Load the credit card form and allow gateways to load their own if they wish |
202
|
|
- if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
203
|
|
- do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
202
|
+ if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
203
|
+ do_action('give_'.$payment_mode.'_cc_form', $form_id); |
204
|
204
|
} else { |
205
|
|
- do_action( 'give_cc_form', $form_id ); |
|
205
|
+ do_action('give_cc_form', $form_id); |
206
|
206
|
} |
207
|
207
|
|
208
|
|
- do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
208
|
+ do_action('give_purchase_form_after_cc_form', $form_id); |
209
|
209
|
|
210
|
210
|
} else { |
211
|
211
|
// Can't checkout |
212
|
|
- do_action( 'give_purchase_form_no_access', $form_id ); |
|
212
|
+ do_action('give_purchase_form_no_access', $form_id); |
213
|
213
|
|
214
|
214
|
} |
215
|
215
|
|
216
|
|
- do_action( 'give_purchase_form_bottom', $form_id ); |
|
216
|
+ do_action('give_purchase_form_bottom', $form_id); |
217
|
217
|
} |
218
|
218
|
|
219
|
|
-add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
219
|
+add_action('give_purchase_form', 'give_show_purchase_form'); |
220
|
220
|
|
221
|
221
|
/** |
222
|
222
|
* Donation Amount Field |
|
@@ -230,37 +230,37 @@ discard block |
|
|
block discarded – undo |
230
|
230
|
* |
231
|
231
|
* @return void |
232
|
232
|
*/ |
233
|
|
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
233
|
+function give_output_donation_amount_top($form_id = 0, $args = array()) { |
234
|
234
|
|
235
|
235
|
global $give_options; |
236
|
236
|
|
237
|
|
- $variable_pricing = give_has_variable_prices( $form_id ); |
238
|
|
- $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
239
|
|
- $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
240
|
|
- $symbol = give_currency_symbol( $give_options['currency'] ); |
241
|
|
- $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
242
|
|
- $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
243
|
|
- $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
237
|
+ $variable_pricing = give_has_variable_prices($form_id); |
|
238
|
+ $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
239
|
+ $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
240
|
+ $symbol = give_currency_symbol($give_options['currency']); |
|
241
|
+ $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
242
|
+ $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
243
|
+ $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
244
|
244
|
|
245
|
|
- do_action( 'give_before_donation_levels', $form_id ); |
|
245
|
+ do_action('give_before_donation_levels', $form_id); |
246
|
246
|
|
247
|
247
|
//Set Price, No Custom Amount Allowed means hidden price field |
248
|
|
- if ( $allow_custom_amount == 'no' ) { |
|
248
|
+ if ($allow_custom_amount == 'no') { |
249
|
249
|
?> |
250
|
250
|
|
251
|
|
- <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
251
|
+ <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
252
|
252
|
<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
253
|
253
|
value="<?php echo $default_amount; ?>" required> |
254
|
254
|
<p class="set-price give-donation-amount form-row-wide"> |
255
|
|
- <?php if ( $currency_position == 'before' ) { |
|
255
|
+ <?php if ($currency_position == 'before') { |
256
|
256
|
echo $currency_output; |
257
|
257
|
} ?> |
258
|
258
|
<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
259
|
|
- <?php if ( $currency_position == 'after' ) { |
|
259
|
+ <?php if ($currency_position == 'after') { |
260
|
260
|
echo $currency_output; |
261
|
261
|
} ?> |
262
|
262
|
<span class="give-loading-text give-updating-price-loader"> |
263
|
|
- <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
263
|
+ <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
264
|
264
|
</span> |
265
|
265
|
</p> |
266
|
266
|
<?php |
|
@@ -269,35 +269,35 @@ discard block |
|
|
block discarded – undo |
269
|
269
|
?> |
270
|
270
|
<div class="give-total-wrap"> |
271
|
271
|
<div class="give-donation-amount form-row-wide"> |
272
|
|
- <?php if ( $currency_position == 'before' ) { |
|
272
|
+ <?php if ($currency_position == 'before') { |
273
|
273
|
echo $currency_output; |
274
|
274
|
} ?> |
275
|
|
- <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
275
|
+ <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
276
|
276
|
<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
277
|
277
|
placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
278
|
|
- <?php if ( $currency_position == 'after' ) { |
|
278
|
+ <?php if ($currency_position == 'after') { |
279
|
279
|
echo $currency_output; |
280
|
280
|
} ?> |
281
|
281
|
<span class="give-loading-text give-updating-price-loader"> |
282
|
|
- <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
282
|
+ <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
283
|
283
|
</span> |
284
|
284
|
</div> |
285
|
285
|
</div> |
286
|
286
|
<?php } |
287
|
287
|
|
288
|
288
|
//Custom Amount Text |
289
|
|
- if ( ! $variable_pricing && $allow_custom_amount == 'yes' ) { ?> |
290
|
|
- <p class="give-custom-amount-text"><?php echo ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Give a Custom Amount', 'give' ); ?></p> |
|
289
|
+ if ( ! $variable_pricing && $allow_custom_amount == 'yes') { ?> |
|
290
|
+ <p class="give-custom-amount-text"><?php echo ! empty($custom_amount_text) ? $custom_amount_text : __('Give a Custom Amount', 'give'); ?></p> |
291
|
291
|
<?php } |
292
|
292
|
|
293
|
293
|
//Output Variable Pricing Levels |
294
|
|
- if ( $variable_pricing ) { |
295
|
|
- give_output_levels( $form_id ); |
|
294
|
+ if ($variable_pricing) { |
|
295
|
+ give_output_levels($form_id); |
296
|
296
|
} |
297
|
|
- do_action( 'give_after_donation_levels', $form_id, $args ); |
|
297
|
+ do_action('give_after_donation_levels', $form_id, $args); |
298
|
298
|
} |
299
|
299
|
|
300
|
|
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
300
|
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
301
|
301
|
|
302
|
302
|
|
303
|
303
|
/** |
|
@@ -309,32 +309,32 @@ discard block |
|
|
block discarded – undo |
309
|
309
|
* |
310
|
310
|
* @return string |
311
|
311
|
*/ |
312
|
|
-function give_output_levels( $form_id ) { |
|
312
|
+function give_output_levels($form_id) { |
313
|
313
|
|
314
|
314
|
//Get variable pricing |
315
|
|
- $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
316
|
|
- $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
317
|
|
- $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
318
|
|
- $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
319
|
|
- if ( empty( $custom_amount_text ) ) { |
320
|
|
- $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
315
|
+ $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
316
|
+ $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
317
|
+ $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
318
|
+ $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
319
|
+ if (empty($custom_amount_text)) { |
|
320
|
+ $custom_amount_text = __('Give a Custom Amount', 'give'); |
321
|
321
|
} |
322
|
322
|
|
323
|
323
|
$output = ''; |
324
|
324
|
$counter = 0; |
325
|
325
|
|
326
|
|
- switch ( $display_style ) { |
|
326
|
+ switch ($display_style) { |
327
|
327
|
case 'buttons': |
328
|
328
|
|
329
|
329
|
$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
330
|
330
|
|
331
|
|
- foreach ( $prices as $price ) { |
332
|
|
- $counter ++; |
333
|
|
- $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 ); |
334
|
|
- $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 ); |
|
331
|
+ foreach ($prices as $price) { |
|
332
|
+ $counter++; |
|
333
|
+ $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); |
|
334
|
+ $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); |
335
|
335
|
|
336
|
336
|
$output .= '<li>'; |
337
|
|
- $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
337
|
+ $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
338
|
338
|
$output .= $level_text; |
339
|
339
|
$output .= '</button>'; |
340
|
340
|
$output .= '</li>'; |
|
@@ -342,7 +342,7 @@ discard block |
|
|
block discarded – undo |
342
|
342
|
} |
343
|
343
|
|
344
|
344
|
//Custom Amount |
345
|
|
- if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
345
|
+ if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
346
|
346
|
$output .= '<li>'; |
347
|
347
|
$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
348
|
348
|
$output .= $custom_amount_text; |
|
@@ -358,23 +358,23 @@ discard block |
|
|
block discarded – undo |
358
|
358
|
|
359
|
359
|
$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
360
|
360
|
|
361
|
|
- foreach ( $prices as $price ) { |
362
|
|
- $counter ++; |
363
|
|
- $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 ); |
364
|
|
- $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 ); |
|
361
|
+ foreach ($prices as $price) { |
|
362
|
+ $counter++; |
|
363
|
+ $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); |
|
364
|
+ $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); |
365
|
365
|
|
366
|
366
|
$output .= '<li>'; |
367
|
|
- $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'] ) . '">'; |
368
|
|
- $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
367
|
+ $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']).'">'; |
|
368
|
+ $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
369
|
369
|
$output .= '</li>'; |
370
|
370
|
|
371
|
371
|
} |
372
|
372
|
|
373
|
373
|
//Custom Amount |
374
|
|
- if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
374
|
+ if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
375
|
375
|
$output .= '<li>'; |
376
|
376
|
$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">'; |
377
|
|
- $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
377
|
+ $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
378
|
378
|
$output .= '</li>'; |
379
|
379
|
} |
380
|
380
|
|
|
@@ -384,23 +384,23 @@ discard block |
|
|
block discarded – undo |
384
|
384
|
|
385
|
385
|
case 'dropdown': |
386
|
386
|
|
387
|
|
- $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose your Donation Amount', 'give' ) . ':</label>'; |
388
|
|
- $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
387
|
+ $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose your Donation Amount', 'give').':</label>'; |
|
388
|
+ $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
389
|
389
|
|
390
|
390
|
//first loop through prices |
391
|
|
- foreach ( $prices as $price ) { |
392
|
|
- $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 ); |
393
|
|
- $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id, $form_id, $price ); |
|
391
|
+ foreach ($prices as $price) { |
|
392
|
+ $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); |
|
393
|
+ $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id, $form_id, $price); |
394
|
394
|
|
395
|
|
- $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'] ) . '">'; |
|
395
|
+ $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']).'">'; |
396
|
396
|
$output .= $level_text; |
397
|
397
|
$output .= '</option>'; |
398
|
398
|
|
399
|
399
|
} |
400
|
400
|
|
401
|
401
|
//Custom Amount |
402
|
|
- if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
403
|
|
- $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
402
|
+ if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
403
|
+ $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
404
|
404
|
} |
405
|
405
|
|
406
|
406
|
$output .= '</select>'; |
|
@@ -408,7 +408,7 @@ discard block |
|
|
block discarded – undo |
408
|
408
|
break; |
409
|
409
|
} |
410
|
410
|
|
411
|
|
- echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
411
|
+ echo apply_filters('give_form_level_output', $output, $form_id); |
412
|
412
|
} |
413
|
413
|
|
414
|
414
|
/** |
|
@@ -420,26 +420,26 @@ discard block |
|
|
block discarded – undo |
420
|
420
|
* @param array $args |
421
|
421
|
* |
422
|
422
|
*/ |
423
|
|
-function give_display_checkout_button( $form_id, $args ) { |
|
423
|
+function give_display_checkout_button($form_id, $args) { |
424
|
424
|
|
425
|
|
- $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
425
|
+ $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
426
|
426
|
? $args['display_style'] |
427
|
|
- : get_post_meta( $form_id, '_give_payment_display', true ); |
|
427
|
+ : get_post_meta($form_id, '_give_payment_display', true); |
428
|
428
|
|
429
|
429
|
//no btn for onpage |
430
|
|
- if ( $display_option === 'onpage' ) { |
|
430
|
+ if ($display_option === 'onpage') { |
431
|
431
|
return; |
432
|
432
|
} |
433
|
433
|
|
434
|
|
- $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
435
|
|
- $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
434
|
+ $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
435
|
+ $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
436
|
436
|
|
437
|
|
- $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
437
|
+ $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
438
|
438
|
|
439
|
|
- echo apply_filters( 'give_display_checkout_button', $output ); |
|
439
|
+ echo apply_filters('give_display_checkout_button', $output); |
440
|
440
|
} |
441
|
441
|
|
442
|
|
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
442
|
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
443
|
443
|
|
444
|
444
|
/** |
445
|
445
|
* Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
|
@@ -450,71 +450,71 @@ discard block |
|
|
block discarded – undo |
450
|
450
|
* |
451
|
451
|
* @return void |
452
|
452
|
*/ |
453
|
|
-function give_user_info_fields( $form_id ) { |
|
453
|
+function give_user_info_fields($form_id) { |
454
|
454
|
|
455
|
|
- if ( is_user_logged_in() ) : |
456
|
|
- $user_data = get_userdata( get_current_user_id() ); |
|
455
|
+ if (is_user_logged_in()) : |
|
456
|
+ $user_data = get_userdata(get_current_user_id()); |
457
|
457
|
endif; |
458
|
458
|
|
459
|
|
- do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
459
|
+ do_action('give_purchase_form_before_personal_info', $form_id); |
460
|
460
|
?> |
461
|
461
|
<fieldset id="give_checkout_user_info"> |
462
|
|
- <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
462
|
+ <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
463
|
463
|
<p id="give-first-name-wrap" class="form-row form-row-first"> |
464
|
464
|
<label class="give-label" for="give-first"> |
465
|
|
- <?php _e( 'First Name', 'give' ); ?> |
466
|
|
- <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
465
|
+ <?php _e('First Name', 'give'); ?> |
|
466
|
+ <?php if (give_field_is_required('give_first', $form_id)) { ?> |
467
|
467
|
<span class="give-required-indicator">*</span> |
468
|
468
|
<?php } ?> |
469
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
469
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
470
|
470
|
</label> |
471
|
|
- <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 ) ) { |
|
471
|
+ <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)) { |
472
|
472
|
echo ' required '; |
473
|
473
|
} ?>/> |
474
|
474
|
</p> |
475
|
475
|
|
476
|
476
|
<p id="give-last-name-wrap" class="form-row form-row-last"> |
477
|
477
|
<label class="give-label" for="give-last"> |
478
|
|
- <?php _e( 'Last Name', 'give' ); ?> |
479
|
|
- <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
478
|
+ <?php _e('Last Name', 'give'); ?> |
|
479
|
+ <?php if (give_field_is_required('give_last', $form_id)) { ?> |
480
|
480
|
<span class="give-required-indicator">*</span> |
481
|
481
|
<?php } ?> |
482
|
|
- <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> |
|
482
|
+ <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> |
483
|
483
|
</label> |
484
|
484
|
|
485
|
|
- <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
485
|
+ <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
486
|
486
|
echo ' required'; |
487
|
|
- } ?>" 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 ) ) { |
|
487
|
+ } ?>" 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)) { |
488
|
488
|
echo ' required '; |
489
|
489
|
} ?> /> |
490
|
490
|
</p> |
491
|
491
|
|
492
|
|
- <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
492
|
+ <?php do_action('give_purchase_form_before_email', $form_id); ?> |
493
|
493
|
<p id="give-email-wrap" class="form-row form-row-wide"> |
494
|
494
|
<label class="give-label" for="give-email"> |
495
|
|
- <?php _e( 'Email Address', 'give' ); ?> |
496
|
|
- <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
495
|
+ <?php _e('Email Address', 'give'); ?> |
|
496
|
+ <?php if (give_field_is_required('give_email', $form_id)) { ?> |
497
|
497
|
<span class="give-required-indicator">*</span> |
498
|
498
|
<?php } ?> |
499
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
499
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
500
|
500
|
</label> |
501
|
501
|
|
502
|
|
- <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 ) ) { |
|
502
|
+ <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)) { |
503
|
503
|
echo ' required '; |
504
|
504
|
} ?>/> |
505
|
505
|
|
506
|
506
|
</p> |
507
|
|
- <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
507
|
+ <?php do_action('give_purchase_form_after_email', $form_id); ?> |
508
|
508
|
|
509
|
|
- <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
509
|
+ <?php do_action('give_purchase_form_user_info', $form_id); ?> |
510
|
510
|
</fieldset> |
511
|
511
|
<?php |
512
|
|
- do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
512
|
+ do_action('give_purchase_form_after_personal_info', $form_id); |
513
|
513
|
|
514
|
514
|
} |
515
|
515
|
|
516
|
|
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
517
|
|
-add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
516
|
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
517
|
+add_action('give_register_fields_before', 'give_user_info_fields'); |
518
|
518
|
|
519
|
519
|
/** |
520
|
520
|
* Renders the credit card info form. |
|
@@ -525,73 +525,73 @@ discard block |
|
|
block discarded – undo |
525
|
525
|
* |
526
|
526
|
* @return void |
527
|
527
|
*/ |
528
|
|
-function give_get_cc_form( $form_id ) { |
|
528
|
+function give_get_cc_form($form_id) { |
529
|
529
|
|
530
|
530
|
ob_start(); |
531
|
531
|
|
532
|
|
- do_action( 'give_before_cc_fields', $form_id ); ?> |
|
532
|
+ do_action('give_before_cc_fields', $form_id); ?> |
533
|
533
|
|
534
|
534
|
<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
535
|
|
- <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
536
|
|
- <?php if ( is_ssl() ) : ?> |
|
535
|
+ <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
536
|
+ <?php if (is_ssl()) : ?> |
537
|
537
|
<div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
538
|
538
|
<span class="give-icon padlock"></span> |
539
|
|
- <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
539
|
+ <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
540
|
540
|
</div> |
541
|
541
|
<?php endif; ?> |
542
|
542
|
<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
543
|
543
|
<label for="card_number-<?php echo $form_id ?>" class="give-label"> |
544
|
|
- <?php _e( 'Card Number', 'give' ); ?> |
|
544
|
+ <?php _e('Card Number', 'give'); ?> |
545
|
545
|
<span class="give-required-indicator">*</span> |
546
|
|
- <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> |
|
546
|
+ <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> |
547
|
547
|
<span class="card-type"></span> |
548
|
548
|
</label> |
549
|
549
|
|
550
|
|
- <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/> |
|
550
|
+ <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/> |
551
|
551
|
</p> |
552
|
552
|
|
553
|
553
|
<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
554
|
554
|
<label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
555
|
|
- <?php _e( 'CVC', 'give' ); ?> |
|
555
|
+ <?php _e('CVC', 'give'); ?> |
556
|
556
|
<span class="give-required-indicator">*</span> |
557
|
|
- <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> |
|
557
|
+ <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> |
558
|
558
|
</label> |
559
|
559
|
|
560
|
|
- <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/> |
|
560
|
+ <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/> |
561
|
561
|
</p> |
562
|
562
|
|
563
|
563
|
<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
564
|
564
|
<label for="card_name-<?php echo $form_id ?>" class="give-label"> |
565
|
|
- <?php _e( 'Name on the Card', 'give' ); ?> |
|
565
|
+ <?php _e('Name on the Card', 'give'); ?> |
566
|
566
|
<span class="give-required-indicator">*</span> |
567
|
|
- <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> |
|
567
|
+ <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> |
568
|
568
|
</label> |
569
|
569
|
|
570
|
|
- <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/> |
|
570
|
+ <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/> |
571
|
571
|
</p> |
572
|
|
- <?php do_action( 'give_before_cc_expiration' ); ?> |
|
572
|
+ <?php do_action('give_before_cc_expiration'); ?> |
573
|
573
|
<p class="card-expiration form-row form-row-one-third"> |
574
|
574
|
<label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
575
|
|
- <?php _e( 'Expiration', 'give' ); ?> |
|
575
|
+ <?php _e('Expiration', 'give'); ?> |
576
|
576
|
<span class="give-required-indicator">*</span> |
577
|
|
- <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> |
|
577
|
+ <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> |
578
|
578
|
</label> |
579
|
579
|
|
580
|
580
|
<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
581
|
581
|
<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
582
|
582
|
|
583
|
|
- <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/> |
|
583
|
+ <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/> |
584
|
584
|
</p> |
585
|
|
- <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
585
|
+ <?php do_action('give_after_cc_expiration', $form_id); ?> |
586
|
586
|
|
587
|
587
|
</fieldset> |
588
|
588
|
<?php |
589
|
|
- do_action( 'give_after_cc_fields', $form_id ); |
|
589
|
+ do_action('give_after_cc_fields', $form_id); |
590
|
590
|
|
591
|
591
|
echo ob_get_clean(); |
592
|
592
|
} |
593
|
593
|
|
594
|
|
-add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
594
|
+add_action('give_cc_form', 'give_get_cc_form'); |
595
|
595
|
|
596
|
596
|
/** |
597
|
597
|
* Outputs the default credit card address fields |
|
@@ -602,110 +602,110 @@ discard block |
|
|
block discarded – undo |
602
|
602
|
* |
603
|
603
|
* @return void |
604
|
604
|
*/ |
605
|
|
-function give_default_cc_address_fields( $form_id ) { |
|
605
|
+function give_default_cc_address_fields($form_id) { |
606
|
606
|
|
607
|
607
|
$logged_in = is_user_logged_in(); |
608
|
608
|
|
609
|
|
- if ( $logged_in ) { |
610
|
|
- $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
609
|
+ if ($logged_in) { |
|
610
|
+ $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
611
|
611
|
} |
612
|
|
- $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
613
|
|
- $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
614
|
|
- $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
615
|
|
- $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
612
|
+ $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
613
|
+ $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
614
|
+ $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
615
|
+ $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
616
|
616
|
ob_start(); ?> |
617
|
617
|
<fieldset id="give_cc_address" class="cc-address"> |
618
|
|
- <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
619
|
|
- <?php do_action( 'give_cc_billing_top' ); ?> |
|
618
|
+ <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
619
|
+ <?php do_action('give_cc_billing_top'); ?> |
620
|
620
|
<p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
621
|
621
|
<label for="card_address" class="give-label"> |
622
|
|
- <?php _e( 'Address', 'give' ); ?> |
|
622
|
+ <?php _e('Address', 'give'); ?> |
623
|
623
|
<?php |
624
|
|
- if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
624
|
+ if (give_field_is_required('card_address', $form_id)) { ?> |
625
|
625
|
<span class="give-required-indicator">*</span> |
626
|
626
|
<?php } ?> |
627
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
627
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
628
|
628
|
</label> |
629
|
629
|
|
630
|
|
- <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
630
|
+ <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
631
|
631
|
echo ' required'; |
632
|
|
- } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
632
|
+ } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
633
|
633
|
echo ' required '; |
634
|
634
|
} ?>/> |
635
|
635
|
</p> |
636
|
636
|
|
637
|
637
|
<p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
638
|
638
|
<label for="card_address_2" class="give-label"> |
639
|
|
- <?php _e( 'Address Line 2', 'give' ); ?> |
640
|
|
- <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
639
|
+ <?php _e('Address Line 2', 'give'); ?> |
|
640
|
+ <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
641
|
641
|
<span class="give-required-indicator">*</span> |
642
|
642
|
<?php } ?> |
643
|
|
- <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> |
|
643
|
+ <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> |
644
|
644
|
</label> |
645
|
645
|
|
646
|
|
- <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 ) ) { |
|
646
|
+ <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)) { |
647
|
647
|
echo ' required'; |
648
|
|
- } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
648
|
+ } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
649
|
649
|
echo ' required '; |
650
|
650
|
} ?>/> |
651
|
651
|
</p> |
652
|
652
|
|
653
|
653
|
<p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
654
|
654
|
<label for="card_city" class="give-label"> |
655
|
|
- <?php _e( 'City', 'give' ); ?> |
656
|
|
- <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
655
|
+ <?php _e('City', 'give'); ?> |
|
656
|
+ <?php if (give_field_is_required('card_city', $form_id)) { ?> |
657
|
657
|
<span class="give-required-indicator">*</span> |
658
|
658
|
<?php } ?> |
659
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
659
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
660
|
660
|
</label> |
661
|
|
- <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
661
|
+ <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
662
|
662
|
echo ' required'; |
663
|
|
- } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
663
|
+ } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
664
|
664
|
echo ' required '; |
665
|
665
|
} ?>/> |
666
|
666
|
</p> |
667
|
667
|
|
668
|
668
|
<p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
669
|
669
|
<label for="card_zip" class="give-label"> |
670
|
|
- <?php _e( 'Zip / Postal Code', 'give' ); ?> |
671
|
|
- <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
670
|
+ <?php _e('Zip / Postal Code', 'give'); ?> |
|
671
|
+ <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
672
|
672
|
<span class="give-required-indicator">*</span> |
673
|
673
|
<?php } ?> |
674
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
674
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
675
|
675
|
</label> |
676
|
676
|
|
677
|
|
- <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 ) ) { |
|
677
|
+ <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)) { |
678
|
678
|
echo ' required'; |
679
|
|
- } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
679
|
+ } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
680
|
680
|
echo ' required '; |
681
|
681
|
} ?>/> |
682
|
682
|
</p> |
683
|
683
|
|
684
|
684
|
<p id="give-card-country-wrap" class="form-row form-row-first"> |
685
|
685
|
<label for="billing_country" class="give-label"> |
686
|
|
- <?php _e( 'Country', 'give' ); ?> |
687
|
|
- <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
686
|
+ <?php _e('Country', 'give'); ?> |
|
687
|
+ <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
688
|
688
|
<span class="give-required-indicator">*</span> |
689
|
689
|
<?php } ?> |
690
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
690
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
691
|
691
|
</label> |
692
|
692
|
|
693
|
|
- <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
693
|
+ <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
694
|
694
|
echo ' required'; |
695
|
|
- } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
695
|
+ } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
696
|
696
|
echo ' required '; |
697
|
697
|
} ?>> |
698
|
698
|
<?php |
699
|
699
|
|
700
|
700
|
$selected_country = give_get_country(); |
701
|
701
|
|
702
|
|
- if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
702
|
+ if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
703
|
703
|
$selected_country = $user_address['country']; |
704
|
704
|
} |
705
|
705
|
|
706
|
706
|
$countries = give_get_country_list(); |
707
|
|
- foreach ( $countries as $country_code => $country ) { |
708
|
|
- echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
707
|
+ foreach ($countries as $country_code => $country) { |
|
708
|
+ echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
709
|
709
|
} |
710
|
710
|
?> |
711
|
711
|
</select> |
|
@@ -713,44 +713,44 @@ discard block |
|
|
block discarded – undo |
713
|
713
|
|
714
|
714
|
<p id="give-card-state-wrap" class="form-row form-row-last"> |
715
|
715
|
<label for="card_state" class="give-label"> |
716
|
|
- <?php _e( 'State / Province', 'give' ); ?> |
717
|
|
- <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
716
|
+ <?php _e('State / Province', 'give'); ?> |
|
717
|
+ <?php if (give_field_is_required('card_state', $form_id)) { ?> |
718
|
718
|
<span class="give-required-indicator">*</span> |
719
|
719
|
<?php } ?> |
720
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
720
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
721
|
721
|
</label> |
722
|
722
|
|
723
|
723
|
<?php |
724
|
724
|
$selected_state = give_get_state(); |
725
|
|
- $states = give_get_states( $selected_country ); |
|
725
|
+ $states = give_get_states($selected_country); |
726
|
726
|
|
727
|
|
- if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
727
|
+ if ($logged_in && ! empty($user_address['state'])) { |
728
|
728
|
$selected_state = $user_address['state']; |
729
|
729
|
} |
730
|
730
|
|
731
|
|
- if ( ! empty( $states ) ) : ?> |
732
|
|
- <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
731
|
+ if ( ! empty($states)) : ?> |
|
732
|
+ <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
733
|
733
|
echo ' required'; |
734
|
|
- } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
734
|
+ } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
735
|
735
|
echo ' required '; |
736
|
736
|
} ?>> |
737
|
737
|
<?php |
738
|
|
- foreach ( $states as $state_code => $state ) { |
739
|
|
- echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
738
|
+ foreach ($states as $state_code => $state) { |
|
739
|
+ echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
740
|
740
|
} |
741
|
741
|
?> |
742
|
742
|
</select> |
743
|
743
|
<?php else : ?> |
744
|
|
- <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
744
|
+ <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
745
|
745
|
<?php endif; ?> |
746
|
746
|
</p> |
747
|
|
- <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
747
|
+ <?php do_action('give_cc_billing_bottom'); ?> |
748
|
748
|
</fieldset> |
749
|
749
|
<?php |
750
|
750
|
echo ob_get_clean(); |
751
|
751
|
} |
752
|
752
|
|
753
|
|
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
753
|
+add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
754
|
754
|
|
755
|
755
|
|
756
|
756
|
/** |
|
@@ -762,94 +762,94 @@ discard block |
|
|
block discarded – undo |
762
|
762
|
* |
763
|
763
|
* @return string |
764
|
764
|
*/ |
765
|
|
-function give_get_register_fields( $form_id ) { |
|
765
|
+function give_get_register_fields($form_id) { |
766
|
766
|
|
767
|
767
|
global $give_options; |
768
|
768
|
global $user_ID; |
769
|
769
|
|
770
|
|
- if ( is_user_logged_in() ) { |
771
|
|
- $user_data = get_userdata( $user_ID ); |
|
770
|
+ if (is_user_logged_in()) { |
|
771
|
+ $user_data = get_userdata($user_ID); |
772
|
772
|
} |
773
|
773
|
|
774
|
|
- $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
774
|
+ $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
775
|
775
|
|
776
|
776
|
ob_start(); ?> |
777
|
777
|
<fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
778
|
778
|
|
779
|
|
- <?php if ( $show_register_form == 'both' ) { ?> |
|
779
|
+ <?php if ($show_register_form == 'both') { ?> |
780
|
780
|
<div class="give-login-account-wrap"> |
781
|
|
- <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
782
|
|
- <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
781
|
+ <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
782
|
+ <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
783
|
783
|
</p> |
784
|
784
|
<p class="give-loading-text"> |
785
|
|
- <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
785
|
+ <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
786
|
786
|
</div> |
787
|
787
|
<?php } ?> |
788
|
788
|
|
789
|
|
- <?php do_action( 'give_register_fields_before' ); ?> |
|
789
|
+ <?php do_action('give_register_fields_before'); ?> |
790
|
790
|
|
791
|
791
|
<fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
792
|
|
- <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
793
|
|
- if ( ! give_no_guest_checkout( $form_id ) ) { |
794
|
|
- echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
792
|
+ <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
793
|
+ if ( ! give_no_guest_checkout($form_id)) { |
|
794
|
+ echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
795
|
795
|
} ?></legend> |
796
|
|
- <?php do_action( 'give_register_account_fields_before' ); ?> |
|
796
|
+ <?php do_action('give_register_account_fields_before'); ?> |
797
|
797
|
<p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
798
|
798
|
<label for="give-user-login-<?php echo $form_id; ?>"> |
799
|
|
- <?php _e( 'Username', 'give' ); ?> |
800
|
|
- <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
799
|
+ <?php _e('Username', 'give'); ?> |
|
800
|
+ <?php if (give_no_guest_checkout($form_id)) { ?> |
801
|
801
|
<span class="give-required-indicator">*</span> |
802
|
802
|
<?php } ?> |
803
|
|
- <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> |
|
803
|
+ <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> |
804
|
804
|
</label> |
805
|
805
|
|
806
|
|
- <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
806
|
+ <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
807
|
807
|
echo 'required '; |
808
|
|
- } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
808
|
+ } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
809
|
809
|
</p> |
810
|
810
|
|
811
|
811
|
<p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
812
|
812
|
<label for="give-user-pass-<?php echo $form_id; ?>"> |
813
|
|
- <?php _e( 'Password', 'give' ); ?> |
814
|
|
- <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
813
|
+ <?php _e('Password', 'give'); ?> |
|
814
|
+ <?php if (give_no_guest_checkout($form_id)) { ?> |
815
|
815
|
<span class="give-required-indicator">*</span> |
816
|
816
|
<?php } ?> |
817
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
817
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
818
|
818
|
</label> |
819
|
819
|
|
820
|
|
- <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
820
|
+ <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
821
|
821
|
echo 'required '; |
822
|
|
- } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
822
|
+ } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
823
|
823
|
</p> |
824
|
824
|
|
825
|
825
|
<p id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
826
|
826
|
<label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
827
|
|
- <?php _e( 'Confirm Password', 'give' ); ?> |
828
|
|
- <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
827
|
+ <?php _e('Confirm Password', 'give'); ?> |
|
828
|
+ <?php if (give_no_guest_checkout($form_id)) { ?> |
829
|
829
|
<span class="give-required-indicator">*</span> |
830
|
830
|
<?php } ?> |
831
|
|
- <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
831
|
+ <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
832
|
832
|
</label> |
833
|
833
|
|
834
|
|
- <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
834
|
+ <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
835
|
835
|
echo 'required '; |
836
|
|
- } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
836
|
+ } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
837
|
837
|
</p> |
838
|
|
- <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
838
|
+ <?php do_action('give_register_account_fields_after', $form_id); ?> |
839
|
839
|
</fieldset> |
840
|
840
|
|
841
|
|
- <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
841
|
+ <?php do_action('give_register_fields_after', $form_id); ?> |
842
|
842
|
|
843
|
843
|
<input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
844
|
844
|
|
845
|
|
- <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
845
|
+ <?php do_action('give_purchase_form_user_info', $form_id); ?> |
846
|
846
|
|
847
|
847
|
</fieldset> |
848
|
848
|
<?php |
849
|
849
|
echo ob_get_clean(); |
850
|
850
|
} |
851
|
851
|
|
852
|
|
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
852
|
+add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
853
|
853
|
|
854
|
854
|
/** |
855
|
855
|
* Gets the login fields for the login form on the checkout. This function hooks |
|
@@ -862,76 +862,76 @@ discard block |
|
|
block discarded – undo |
862
|
862
|
* |
863
|
863
|
* @return string |
864
|
864
|
*/ |
865
|
|
-function give_get_login_fields( $form_id ) { |
|
865
|
+function give_get_login_fields($form_id) { |
866
|
866
|
|
867
|
867
|
global $give_options; |
868
|
868
|
|
869
|
|
- $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
870
|
|
- $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
869
|
+ $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
870
|
+ $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
871
|
871
|
|
872
|
872
|
ob_start(); |
873
|
873
|
?> |
874
|
874
|
<fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
875
|
|
- <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
876
|
|
- if ( ! give_no_guest_checkout( $form_id ) ) { |
877
|
|
- echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
875
|
+ <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
876
|
+ if ( ! give_no_guest_checkout($form_id)) { |
|
877
|
+ echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
878
|
878
|
} ?> |
879
|
879
|
</legend> |
880
|
|
- <?php if ( $show_register_form == 'both' ) { ?> |
|
880
|
+ <?php if ($show_register_form == 'both') { ?> |
881
|
881
|
<p class="give-new-account-link"> |
882
|
|
- <?php _e( 'Need to create an account?', 'give' ); ?> |
883
|
|
- <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-login" |
|
882
|
+ <?php _e('Need to create an account?', 'give'); ?> |
|
883
|
+ <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-login" |
884
|
884
|
data-action="give_checkout_register"> |
885
|
|
- <?php _e( 'Register', 'give' ); |
886
|
|
- if ( ! give_no_guest_checkout( $form_id ) ) { |
887
|
|
- echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
885
|
+ <?php _e('Register', 'give'); |
|
886
|
+ if ( ! give_no_guest_checkout($form_id)) { |
|
887
|
+ echo ' '.__('or checkout as a guest.', 'give'); |
888
|
888
|
} ?> |
889
|
889
|
</a> |
890
|
890
|
</p> |
891
|
891
|
<p class="give-loading-text"> |
892
|
|
- <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
892
|
+ <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
893
|
893
|
<?php } ?> |
894
|
|
- <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
894
|
+ <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
895
|
895
|
<p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
896
|
896
|
<label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
897
|
|
- <?php _e( 'Username', 'give' ); ?> |
898
|
|
- <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
897
|
+ <?php _e('Username', 'give'); ?> |
|
898
|
+ <?php if (give_no_guest_checkout($form_id)) { ?> |
899
|
899
|
<span class="give-required-indicator">*</span> |
900
|
900
|
<?php } ?> |
901
|
901
|
</label> |
902
|
902
|
|
903
|
|
- <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
903
|
+ <input class="<?php if (give_no_guest_checkout($form_id)) { |
904
|
904
|
echo 'required '; |
905
|
|
- } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
905
|
+ } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
906
|
906
|
</p> |
907
|
907
|
|
908
|
908
|
<p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
909
|
909
|
<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
910
|
|
- <?php _e( 'Password', 'give' ); ?> |
911
|
|
- <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
910
|
+ <?php _e('Password', 'give'); ?> |
|
911
|
+ <?php if (give_no_guest_checkout($form_id)) { ?> |
912
|
912
|
<span class="give-required-indicator">*</span> |
913
|
913
|
<?php } ?> |
914
|
914
|
</label> |
915
|
|
- <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
915
|
+ <input class="<?php if (give_no_guest_checkout($form_id)) { |
916
|
916
|
echo 'required '; |
917
|
|
- } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
917
|
+ } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
918
|
918
|
<input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
919
|
919
|
</p> |
920
|
920
|
|
921
|
921
|
<p id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
922
|
|
- <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
923
|
|
- <?php if ( $show_register_form !== 'login' ) { ?> |
924
|
|
- <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
922
|
+ <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
923
|
+ <?php if ($show_register_form !== 'login') { ?> |
|
924
|
+ <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
925
|
925
|
<?php } ?> |
926
|
926
|
<span class="give-loading-animation"></span> |
927
|
927
|
</p> |
928
|
|
- <?php do_action( 'give_checkout_login_fields_after' ); ?> |
|
928
|
+ <?php do_action('give_checkout_login_fields_after'); ?> |
929
|
929
|
</fieldset><!--end #give-login-fields--> |
930
|
930
|
<?php |
931
|
931
|
echo ob_get_clean(); |
932
|
932
|
} |
933
|
933
|
|
934
|
|
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
934
|
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
935
|
935
|
|
936
|
936
|
/** |
937
|
937
|
* Payment Mode Select |
|
@@ -947,48 +947,48 @@ discard block |
|
|
block discarded – undo |
947
|
947
|
* |
948
|
948
|
* @return void |
949
|
949
|
*/ |
950
|
|
-function give_payment_mode_select( $form_id ) { |
|
950
|
+function give_payment_mode_select($form_id) { |
951
|
951
|
|
952
|
952
|
$gateways = give_get_enabled_payment_gateways(); |
953
|
953
|
|
954
|
|
- do_action( 'give_payment_mode_top', $form_id ); ?> |
|
954
|
+ do_action('give_payment_mode_top', $form_id); ?> |
955
|
955
|
|
956
|
956
|
<fieldset id="give-payment-mode-select"> |
957
|
|
- <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
957
|
+ <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
958
|
958
|
<div id="give-payment-mode-wrap"> |
959
|
|
- <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
960
|
|
- <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span></legend> |
|
959
|
+ <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
960
|
+ <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span></legend> |
961
|
961
|
<?php |
962
|
962
|
|
963
|
|
- do_action( 'give_payment_mode_before_gateways' ) ?> |
|
963
|
+ do_action('give_payment_mode_before_gateways') ?> |
964
|
964
|
|
965
|
965
|
<ul id="give-gateway-radio-list"> |
966
|
|
- <?php foreach ( $gateways as $gateway_id => $gateway ) : |
967
|
|
- $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
966
|
+ <?php foreach ($gateways as $gateway_id => $gateway) : |
|
967
|
+ $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
968
|
968
|
$checked_class = $checked ? ' give-gateway-option-selected' : ''; |
969
|
|
- 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 ) . '">'; |
970
|
|
- 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'] ); |
|
969
|
+ 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).'">'; |
|
970
|
+ 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']); |
971
|
971
|
echo '</label></li>'; |
972
|
972
|
endforeach; ?> |
973
|
973
|
</ul> |
974
|
|
- <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
974
|
+ <?php do_action('give_payment_mode_after_gateways'); ?> |
975
|
975
|
</div> |
976
|
|
- <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
976
|
+ <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
977
|
977
|
</fieldset> |
978
|
978
|
|
979
|
|
- <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
979
|
+ <?php do_action('give_payment_mode_bottom', $form_id); ?> |
980
|
980
|
|
981
|
981
|
<div id="give_purchase_form_wrap"> |
982
|
982
|
|
983
|
|
- <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
983
|
+ <?php do_action('give_purchase_form', $form_id); ?> |
984
|
984
|
|
985
|
985
|
</div><!-- the checkout fields are loaded into this--> |
986
|
986
|
|
987
|
|
- <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
987
|
+ <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
988
|
988
|
|
989
|
989
|
} |
990
|
990
|
|
991
|
|
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
991
|
+add_action('give_payment_mode_select', 'give_payment_mode_select'); |
992
|
992
|
|
993
|
993
|
|
994
|
994
|
/** |
|
@@ -1003,35 +1003,35 @@ discard block |
|
|
block discarded – undo |
1003
|
1003
|
* |
1004
|
1004
|
* @return void |
1005
|
1005
|
*/ |
1006
|
|
-function give_terms_agreement( $form_id ) { |
|
1006
|
+function give_terms_agreement($form_id) { |
1007
|
1007
|
|
1008
|
|
- $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
1009
|
|
- $label = get_post_meta( $form_id, '_give_agree_label', true ); |
1010
|
|
- $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1008
|
+ $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1009
|
+ $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1010
|
+ $terms = get_post_meta($form_id, '_give_agree_text', true); |
1011
|
1011
|
|
1012
|
|
- if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1012
|
+ if ($form_option === 'yes' && ! empty($terms)) { ?> |
1013
|
1013
|
<fieldset id="give_terms_agreement"> |
1014
|
1014
|
<div id="give_terms" style="display:none;"> |
1015
|
1015
|
<?php |
1016
|
|
- do_action( 'give_before_terms' ); |
1017
|
|
- echo wpautop( stripslashes( $terms ) ); |
1018
|
|
- do_action( 'give_after_terms' ); |
|
1016
|
+ do_action('give_before_terms'); |
|
1017
|
+ echo wpautop(stripslashes($terms)); |
|
1018
|
+ do_action('give_after_terms'); |
1019
|
1019
|
?> |
1020
|
1020
|
</div> |
1021
|
1021
|
<div id="give_show_terms"> |
1022
|
|
- <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
1023
|
|
- <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
1022
|
+ <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
1023
|
+ <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
1024
|
1024
|
</div> |
1025
|
1025
|
|
1026
|
1026
|
<label |
1027
|
|
- for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
1027
|
+ for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
1028
|
1028
|
<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1029
|
1029
|
</fieldset> |
1030
|
1030
|
<?php |
1031
|
1031
|
} |
1032
|
1032
|
} |
1033
|
1033
|
|
1034
|
|
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1034
|
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
1035
|
1035
|
|
1036
|
1036
|
/** |
1037
|
1037
|
* Checkout Final Total |
|
@@ -1043,27 +1043,27 @@ discard block |
|
|
block discarded – undo |
1043
|
1043
|
* @since 1.0 |
1044
|
1044
|
* @return void |
1045
|
1045
|
*/ |
1046
|
|
-function give_checkout_final_total( $form_id ) { |
|
1046
|
+function give_checkout_final_total($form_id) { |
1047
|
1047
|
|
1048
|
|
- if ( isset( $_POST['give_total'] ) ) { |
1049
|
|
- $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1048
|
+ if (isset($_POST['give_total'])) { |
|
1049
|
+ $total = apply_filters('give_donation_total', $_POST['give_total']); |
1050
|
1050
|
} else { |
1051
|
1051
|
//default total |
1052
|
|
- $total = give_get_default_form_amount( $form_id ); |
|
1052
|
+ $total = give_get_default_form_amount($form_id); |
1053
|
1053
|
} |
1054
|
1054
|
//Only proceed if give_total available |
1055
|
|
- if ( empty( $total ) ) { |
|
1055
|
+ if (empty($total)) { |
1056
|
1056
|
return; |
1057
|
1057
|
} |
1058
|
1058
|
?> |
1059
|
1059
|
<p id="give-final-total-wrap" class="form-wrap "> |
1060
|
|
- <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
1061
|
|
- <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1060
|
+ <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
1061
|
+ <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
1062
|
1062
|
</p> |
1063
|
1063
|
<?php |
1064
|
1064
|
} |
1065
|
1065
|
|
1066
|
|
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1066
|
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
1067
|
1067
|
|
1068
|
1068
|
|
1069
|
1069
|
/** |
|
@@ -1075,22 +1075,22 @@ discard block |
|
|
block discarded – undo |
1075
|
1075
|
* |
1076
|
1076
|
* @return void |
1077
|
1077
|
*/ |
1078
|
|
-function give_checkout_submit( $form_id ) { |
|
1078
|
+function give_checkout_submit($form_id) { |
1079
|
1079
|
?> |
1080
|
1080
|
<fieldset id="give_purchase_submit"> |
1081
|
|
- <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1081
|
+ <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
1082
|
1082
|
|
1083
|
|
- <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1083
|
+ <?php give_checkout_hidden_fields($form_id); ?> |
1084
|
1084
|
|
1085
|
|
- <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1085
|
+ <?php echo give_checkout_button_purchase($form_id); ?> |
1086
|
1086
|
|
1087
|
|
- <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1087
|
+ <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
1088
|
1088
|
|
1089
|
1089
|
</fieldset> |
1090
|
1090
|
<?php |
1091
|
1091
|
} |
1092
|
1092
|
|
1093
|
|
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1093
|
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
1094
|
1094
|
|
1095
|
1095
|
|
1096
|
1096
|
/** |
|
@@ -1103,10 +1103,10 @@ discard block |
|
|
block discarded – undo |
1103
|
1103
|
* |
1104
|
1104
|
* @return string |
1105
|
1105
|
*/ |
1106
|
|
-function give_checkout_button_purchase( $form_id ) { |
|
1106
|
+function give_checkout_button_purchase($form_id) { |
1107
|
1107
|
|
1108
|
|
- $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
1109
|
|
- $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
1108
|
+ $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1109
|
+ $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
1110
|
1110
|
|
1111
|
1111
|
ob_start(); |
1112
|
1112
|
|
|
@@ -1117,7 +1117,7 @@ discard block |
|
|
block discarded – undo |
1117
|
1117
|
<span class="give-loading-animation"></span> |
1118
|
1118
|
</div> |
1119
|
1119
|
<?php |
1120
|
|
- return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1120
|
+ return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
1121
|
1121
|
} |
1122
|
1122
|
|
1123
|
1123
|
/** |
|
@@ -1131,11 +1131,11 @@ discard block |
|
|
block discarded – undo |
1131
|
1131
|
* |
1132
|
1132
|
* @return void |
1133
|
1133
|
*/ |
1134
|
|
-function give_agree_to_terms_js( $form_id ) { |
|
1134
|
+function give_agree_to_terms_js($form_id) { |
1135
|
1135
|
|
1136
|
|
- $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1136
|
+ $form_option = get_post_meta($form_id, '_give_terms_option', true); |
1137
|
1137
|
|
1138
|
|
- if ( $form_option === 'yes' ) { |
|
1138
|
+ if ($form_option === 'yes') { |
1139
|
1139
|
?> |
1140
|
1140
|
<script type="text/javascript"> |
1141
|
1141
|
jQuery(document).ready(function ($) { |
|
@@ -1151,7 +1151,7 @@ discard block |
|
|
block discarded – undo |
1151
|
1151
|
} |
1152
|
1152
|
} |
1153
|
1153
|
|
1154
|
|
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1154
|
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
1155
|
1155
|
|
1156
|
1156
|
|
1157
|
1157
|
/** |
|
@@ -1164,19 +1164,19 @@ discard block |
|
|
block discarded – undo |
1164
|
1164
|
* |
1165
|
1165
|
* @return void |
1166
|
1166
|
*/ |
1167
|
|
-function give_form_content( $form_id, $args ) { |
|
1167
|
+function give_form_content($form_id, $args) { |
1168
|
1168
|
|
1169
|
|
- $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1169
|
+ $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
1170
|
1170
|
? $args['show_content'] |
1171
|
|
- : get_post_meta( $form_id, '_give_content_option', true ); |
|
1171
|
+ : get_post_meta($form_id, '_give_content_option', true); |
1172
|
1172
|
|
1173
|
|
- if ( $show_content !== 'none' ) { |
|
1173
|
+ if ($show_content !== 'none') { |
1174
|
1174
|
//add action according to value |
1175
|
|
- add_action( $show_content, 'give_form_display_content' ); |
|
1175
|
+ add_action($show_content, 'give_form_display_content'); |
1176
|
1176
|
} |
1177
|
1177
|
} |
1178
|
1178
|
|
1179
|
|
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1179
|
+add_action('give_pre_form_output', 'give_form_content', 10, 2); |
1180
|
1180
|
|
1181
|
1181
|
/** |
1182
|
1182
|
* Show Give Goals |
|
@@ -1189,24 +1189,24 @@ discard block |
|
|
block discarded – undo |
1189
|
1189
|
* @return mixed |
1190
|
1190
|
*/ |
1191
|
1191
|
|
1192
|
|
-function give_show_goal_progress( $form_id, $args ) { |
|
1192
|
+function give_show_goal_progress($form_id, $args) { |
1193
|
1193
|
|
1194
|
|
- $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
1195
|
|
- $form = new Give_Donate_Form( $form_id ); |
|
1194
|
+ $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
1195
|
+ $form = new Give_Donate_Form($form_id); |
1196
|
1196
|
$goal = $form->goal; |
1197
|
1197
|
$income = $form->get_earnings(); |
1198
|
|
- $color = get_post_meta( $form_id, '_give_goal_color', true ); |
1199
|
|
- $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
1200
|
|
- $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1198
|
+ $color = get_post_meta($form_id, '_give_goal_color', true); |
|
1199
|
+ $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1200
|
+ $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
1201
|
1201
|
|
1202
|
1202
|
//Sanity check - respect shortcode args |
1203
|
|
- if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
1203
|
+ if (isset($args['show_goal']) && $args['show_goal'] === false) { |
1204
|
1204
|
return false; |
1205
|
1205
|
} |
1206
|
1206
|
|
1207
|
1207
|
//Sanity check - ensure form has goal set to output |
1208
|
|
- if ( empty( $form->ID ) |
1209
|
|
- || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
1208
|
+ if (empty($form->ID) |
|
1209
|
+ || (is_singular('give_forms') && $goal_option !== 'yes') |
1210
|
1210
|
|| $goal_option !== 'yes' |
1211
|
1211
|
|| $goal == 0 |
1212
|
1212
|
) { |
|
@@ -1214,26 +1214,26 @@ discard block |
|
|
block discarded – undo |
1214
|
1214
|
return false; |
1215
|
1215
|
} |
1216
|
1216
|
|
1217
|
|
- $progress = round( ( $income / $goal ) * 100, 2 ); |
|
1217
|
+ $progress = round(($income / $goal) * 100, 2); |
1218
|
1218
|
|
1219
|
|
- if ( $income > $goal ) { |
|
1219
|
+ if ($income > $goal) { |
1220
|
1220
|
$progress = 100; |
1221
|
1221
|
} |
1222
|
1222
|
|
1223
|
1223
|
$output = '<div class="give-goal-progress">'; |
1224
|
1224
|
|
1225
|
1225
|
//Goal Progress Text |
1226
|
|
- if ( ! empty( $show_text ) ) { |
|
1226
|
+ if ( ! empty($show_text)) { |
1227
|
1227
|
$output .= '<div class="raised">'; |
1228
|
|
- $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . give_currency_filter( give_format_amount( $income ) ) . '</span>', '<span class="goal-text">' . give_currency_filter( give_format_amount( $goal ) ) ) . '</span>'; |
|
1228
|
+ $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.give_currency_filter(give_format_amount($income)).'</span>', '<span class="goal-text">'.give_currency_filter(give_format_amount($goal))).'</span>'; |
1229
|
1229
|
$output .= '</div>'; |
1230
|
1230
|
} |
1231
|
1231
|
//Goal Progress Bar |
1232
|
|
- if ( ! empty( $show_bar ) ) { |
|
1232
|
+ if ( ! empty($show_bar)) { |
1233
|
1233
|
$output .= '<div class="give-progress-bar">'; |
1234
|
|
- $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
1235
|
|
- if ( ! empty( $color ) ) { |
1236
|
|
- $output .= 'background-color:' . $color; |
|
1234
|
+ $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
1235
|
+ if ( ! empty($color)) { |
|
1236
|
+ $output .= 'background-color:'.$color; |
1237
|
1237
|
} |
1238
|
1238
|
$output .= '"></span>'; |
1239
|
1239
|
$output .= '</div><!-- /.give-progress-bar -->'; |
|
@@ -1241,13 +1241,13 @@ discard block |
|
|
block discarded – undo |
1241
|
1241
|
|
1242
|
1242
|
$output .= '</div><!-- /.goal-progress -->'; |
1243
|
1243
|
|
1244
|
|
- echo apply_filters( 'give_goal_output', $output ); |
|
1244
|
+ echo apply_filters('give_goal_output', $output); |
1245
|
1245
|
|
1246
|
1246
|
return false; |
1247
|
1247
|
|
1248
|
1248
|
} |
1249
|
1249
|
|
1250
|
|
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1250
|
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
1251
|
1251
|
|
1252
|
1252
|
/** |
1253
|
1253
|
* Renders Post Form Content |
|
@@ -1259,17 +1259,17 @@ discard block |
|
|
block discarded – undo |
1259
|
1259
|
* @return void |
1260
|
1260
|
* @since 1.0 |
1261
|
1261
|
*/ |
1262
|
|
-function give_form_display_content( $form_id ) { |
|
1262
|
+function give_form_display_content($form_id) { |
1263
|
1263
|
|
1264
|
|
- $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1264
|
+ $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
1265
|
1265
|
|
1266
|
|
- if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
1267
|
|
- $content = apply_filters( 'the_content', $content ); |
|
1266
|
+ if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1267
|
+ $content = apply_filters('the_content', $content); |
1268
|
1268
|
} |
1269
|
1269
|
|
1270
|
|
- $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1270
|
+ $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
1271
|
1271
|
|
1272
|
|
- echo apply_filters( 'give_form_content_output', $output ); |
|
1272
|
+ echo apply_filters('give_form_content_output', $output); |
1273
|
1273
|
} |
1274
|
1274
|
|
1275
|
1275
|
|
|
@@ -1282,16 +1282,16 @@ discard block |
|
|
block discarded – undo |
1282
|
1282
|
* |
1283
|
1283
|
* @return void |
1284
|
1284
|
*/ |
1285
|
|
-function give_checkout_hidden_fields( $form_id ) { |
|
1285
|
+function give_checkout_hidden_fields($form_id) { |
1286
|
1286
|
|
1287
|
|
- do_action( 'give_hidden_fields_before', $form_id ); |
1288
|
|
- if ( is_user_logged_in() ) { ?> |
|
1287
|
+ do_action('give_hidden_fields_before', $form_id); |
|
1288
|
+ if (is_user_logged_in()) { ?> |
1289
|
1289
|
<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1290
|
1290
|
<?php } ?> |
1291
|
1291
|
<input type="hidden" name="give_action" value="purchase"/> |
1292
|
|
- <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1292
|
+ <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
1293
|
1293
|
<?php |
1294
|
|
- do_action( 'give_hidden_fields_after', $form_id ); |
|
1294
|
+ do_action('give_hidden_fields_after', $form_id); |
1295
|
1295
|
|
1296
|
1296
|
} |
1297
|
1297
|
|
|
@@ -1306,20 +1306,20 @@ discard block |
|
|
block discarded – undo |
1306
|
1306
|
* |
1307
|
1307
|
* @return string $content Filtered content |
1308
|
1308
|
*/ |
1309
|
|
-function give_filter_success_page_content( $content ) { |
|
1309
|
+function give_filter_success_page_content($content) { |
1310
|
1310
|
|
1311
|
1311
|
global $give_options; |
1312
|
1312
|
|
1313
|
|
- if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
1314
|
|
- if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
1315
|
|
- $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1313
|
+ if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1314
|
+ if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1315
|
+ $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
1316
|
1316
|
} |
1317
|
1317
|
} |
1318
|
1318
|
|
1319
|
1319
|
return $content; |
1320
|
1320
|
} |
1321
|
1321
|
|
1322
|
|
-add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1322
|
+add_filter('the_content', 'give_filter_success_page_content'); |
1323
|
1323
|
|
1324
|
1324
|
|
1325
|
1325
|
/** |
|
@@ -1331,11 +1331,11 @@ discard block |
|
|
block discarded – undo |
1331
|
1331
|
|
1332
|
1332
|
function give_test_mode_frontend_warning() { |
1333
|
1333
|
|
1334
|
|
- $test_mode = give_get_option( 'test_mode' ); |
|
1334
|
+ $test_mode = give_get_option('test_mode'); |
1335
|
1335
|
|
1336
|
|
- if ( $test_mode == 'on' ) { |
1337
|
|
- 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>'; |
|
1336
|
+ if ($test_mode == 'on') { |
|
1337
|
+ 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>'; |
1338
|
1338
|
} |
1339
|
1339
|
} |
1340
|
1340
|
|
1341
|
|
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1341
|
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |