@@ -10,7 +10,7 @@ discard block |
||
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,47 +23,47 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string $purchase_form |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | 62 | //Get the form wrap CSS classes. |
63 | - $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
64 | 64 | |
65 | 65 | //Get the <form> tag wrap CSS classes. |
66 | - $form_classes = $form->get_form_classes($args); |
|
66 | + $form_classes = $form->get_form_classes($args); |
|
67 | 67 | |
68 | 68 | ob_start(); |
69 | 69 | |
@@ -75,35 +75,35 @@ discard block |
||
75 | 75 | * @param int $form ->ID The current form ID |
76 | 76 | * @param array $args An array of form args |
77 | 77 | */ |
78 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
78 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
79 | 79 | |
80 | 80 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
81 | 81 | |
82 | - <?php if ( $form->is_close_donation_form() ) { |
|
82 | + <?php if ($form->is_close_donation_form()) { |
|
83 | 83 | |
84 | 84 | //Get Goal thank you message. |
85 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
86 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
85 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
86 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
87 | 87 | |
88 | 88 | //Print thank you message. |
89 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
89 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
90 | 90 | |
91 | 91 | } else { |
92 | 92 | |
93 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
93 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
94 | 94 | |
95 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
95 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | - do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
99 | + do_action('give_pre_form', $form->ID, $args); ?> |
|
100 | 100 | |
101 | 101 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
102 | 102 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
103 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
104 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
105 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
106 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
103 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
104 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
105 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
106 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
107 | 107 | |
108 | 108 | <!-- The following field is for robots only, invisible to humans: --> |
109 | 109 | <span class="give-hidden" style="display: none !important;"> |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | <?php |
115 | 115 | |
116 | 116 | //Price ID hidden field for variable (mult-level) donation forms |
117 | - if ( give_has_variable_prices( $form_id ) ) { |
|
117 | + if (give_has_variable_prices($form_id)) { |
|
118 | 118 | //get default selected price ID |
119 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
119 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
120 | 120 | $price_id = 0; |
121 | 121 | //loop through prices |
122 | - foreach ( $prices as $price ) { |
|
123 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
122 | + foreach ($prices as $price) { |
|
123 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
124 | 124 | $price_id = $price['_give_id']['level_id']; |
125 | 125 | }; |
126 | 126 | } |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
129 | 129 | <?php } |
130 | 130 | |
131 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
131 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
132 | 132 | |
133 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
133 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
134 | 134 | |
135 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
135 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
136 | 136 | |
137 | 137 | ?> |
138 | 138 | </form> |
139 | 139 | |
140 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
140 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
141 | 141 | |
142 | 142 | <?php } ?> |
143 | 143 | |
144 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
144 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
145 | 145 | <?php |
146 | 146 | |
147 | 147 | /** |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @param int $form ->ID The current form ID |
153 | 153 | * @param array $args An array of form args |
154 | 154 | */ |
155 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
155 | + do_action('give_post_form_output', $form->ID, $args); |
|
156 | 156 | |
157 | 157 | $final_output = ob_get_clean(); |
158 | 158 | |
159 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
159 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -175,43 +175,43 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return string |
177 | 177 | */ |
178 | -function give_show_purchase_form( $form_id ) { |
|
178 | +function give_show_purchase_form($form_id) { |
|
179 | 179 | |
180 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
180 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
181 | 181 | |
182 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
182 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
183 | 183 | $form_id = $_POST['give_form_id']; |
184 | 184 | } |
185 | 185 | |
186 | - do_action( 'give_purchase_form_top', $form_id ); |
|
186 | + do_action('give_purchase_form_top', $form_id); |
|
187 | 187 | |
188 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
188 | + if (give_can_checkout() && isset($form_id)) { |
|
189 | 189 | |
190 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
190 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
191 | 191 | |
192 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
192 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
193 | 193 | |
194 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
194 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
195 | 195 | |
196 | 196 | // Load the credit card form and allow gateways to load their own if they wish |
197 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
198 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
197 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
198 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
199 | 199 | } else { |
200 | - do_action( 'give_cc_form', $form_id ); |
|
200 | + do_action('give_cc_form', $form_id); |
|
201 | 201 | } |
202 | 202 | |
203 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
203 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
204 | 204 | |
205 | 205 | } else { |
206 | 206 | // Can't checkout |
207 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
207 | + do_action('give_purchase_form_no_access', $form_id); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
211 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
211 | + do_action('give_purchase_form_bottom', $form_id); |
|
212 | 212 | } |
213 | 213 | |
214 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
214 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
215 | 215 | |
216 | 216 | /** |
217 | 217 | * |
@@ -223,26 +223,26 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void |
225 | 225 | */ |
226 | -function give_show_register_login_fields( $form_id ) { |
|
226 | +function give_show_register_login_fields($form_id) { |
|
227 | 227 | |
228 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
228 | + $show_register_form = give_show_login_register_option($form_id); |
|
229 | 229 | |
230 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
230 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
231 | 231 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
232 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
232 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
233 | 233 | </div> |
234 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
234 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
235 | 235 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
236 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
236 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
237 | 237 | </div> |
238 | 238 | <?php endif; ?> |
239 | 239 | |
240 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
241 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
240 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
241 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
245 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Donation Amount Field |
@@ -256,33 +256,33 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return void |
258 | 258 | */ |
259 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
259 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
260 | 260 | |
261 | 261 | global $give_options; |
262 | 262 | |
263 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
264 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
265 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
266 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
267 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
268 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
269 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
263 | + $variable_pricing = give_has_variable_prices($form_id); |
|
264 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
265 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
266 | + $symbol = give_currency_symbol(give_get_currency()); |
|
267 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
268 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
269 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
270 | 270 | |
271 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
271 | + do_action('give_before_donation_levels', $form_id, $args); |
|
272 | 272 | |
273 | 273 | //Set Price, No Custom Amount Allowed means hidden price field |
274 | - if ( $allow_custom_amount == 'no' ) { |
|
274 | + if ($allow_custom_amount == 'no') { |
|
275 | 275 | ?> |
276 | 276 | |
277 | - <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
277 | + <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
278 | 278 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
279 | 279 | value="<?php echo $default_amount; ?>" required> |
280 | 280 | <div class="set-price give-donation-amount form-row-wide"> |
281 | - <?php if ( $currency_position == 'before' ) { |
|
281 | + <?php if ($currency_position == 'before') { |
|
282 | 282 | echo $currency_output; |
283 | 283 | } ?> |
284 | 284 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
285 | - <?php if ( $currency_position == 'after' ) { |
|
285 | + <?php if ($currency_position == 'after') { |
|
286 | 286 | echo $currency_output; |
287 | 287 | } ?> |
288 | 288 | </div> |
@@ -292,34 +292,34 @@ discard block |
||
292 | 292 | ?> |
293 | 293 | <div class="give-total-wrap"> |
294 | 294 | <div class="give-donation-amount form-row-wide"> |
295 | - <?php if ( $currency_position == 'before' ) { |
|
295 | + <?php if ($currency_position == 'before') { |
|
296 | 296 | echo $currency_output; |
297 | 297 | } ?> |
298 | - <label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
298 | + <label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
299 | 299 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
300 | - <?php if ( $currency_position == 'after' ) { |
|
300 | + <?php if ($currency_position == 'after') { |
|
301 | 301 | echo $currency_output; |
302 | 302 | } ?> |
303 | 303 | </div> |
304 | 304 | </div> |
305 | 305 | <?php } |
306 | 306 | |
307 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
307 | + do_action('give_after_donation_amount', $form_id, $args); |
|
308 | 308 | |
309 | 309 | //Custom Amount Text |
310 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
310 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
311 | 311 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
312 | 312 | <?php } |
313 | 313 | |
314 | 314 | //Output Variable Pricing Levels |
315 | - if ( $variable_pricing ) { |
|
316 | - give_output_levels( $form_id ); |
|
315 | + if ($variable_pricing) { |
|
316 | + give_output_levels($form_id); |
|
317 | 317 | } |
318 | 318 | |
319 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
319 | + do_action('give_after_donation_levels', $form_id, $args); |
|
320 | 320 | } |
321 | 321 | |
322 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
322 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
323 | 323 | |
324 | 324 | |
325 | 325 | /** |
@@ -331,32 +331,32 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @return string |
333 | 333 | */ |
334 | -function give_output_levels( $form_id ) { |
|
334 | +function give_output_levels($form_id) { |
|
335 | 335 | |
336 | 336 | //Get variable pricing |
337 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
338 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
339 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
340 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
341 | - if ( empty( $custom_amount_text ) ) { |
|
342 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
337 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
338 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
339 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
340 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
341 | + if (empty($custom_amount_text)) { |
|
342 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | $output = ''; |
346 | 346 | $counter = 0; |
347 | 347 | |
348 | - switch ( $display_style ) { |
|
348 | + switch ($display_style) { |
|
349 | 349 | case 'buttons': |
350 | 350 | |
351 | 351 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
352 | 352 | |
353 | - foreach ( $prices as $price ) { |
|
354 | - $counter ++; |
|
355 | - $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 ); |
|
356 | - $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 ); |
|
353 | + foreach ($prices as $price) { |
|
354 | + $counter++; |
|
355 | + $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); |
|
356 | + $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); |
|
357 | 357 | |
358 | 358 | $output .= '<li>'; |
359 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
359 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
360 | 360 | $output .= $level_text; |
361 | 361 | $output .= '</button>'; |
362 | 362 | $output .= '</li>'; |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } |
365 | 365 | |
366 | 366 | //Custom Amount |
367 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
367 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
368 | 368 | $output .= '<li>'; |
369 | 369 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
370 | 370 | $output .= $custom_amount_text; |
@@ -380,23 +380,23 @@ discard block |
||
380 | 380 | |
381 | 381 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
382 | 382 | |
383 | - foreach ( $prices as $price ) { |
|
384 | - $counter ++; |
|
385 | - $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 ); |
|
386 | - $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 ); |
|
383 | + foreach ($prices as $price) { |
|
384 | + $counter++; |
|
385 | + $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); |
|
386 | + $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); |
|
387 | 387 | |
388 | 388 | $output .= '<li>'; |
389 | - $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'] ) . '">'; |
|
390 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
389 | + $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']).'">'; |
|
390 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
391 | 391 | $output .= '</li>'; |
392 | 392 | |
393 | 393 | } |
394 | 394 | |
395 | 395 | //Custom Amount |
396 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
396 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
397 | 397 | $output .= '<li>'; |
398 | 398 | $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">'; |
399 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
399 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
400 | 400 | $output .= '</li>'; |
401 | 401 | } |
402 | 402 | |
@@ -406,23 +406,23 @@ discard block |
||
406 | 406 | |
407 | 407 | case 'dropdown': |
408 | 408 | |
409 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
410 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
409 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
410 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
411 | 411 | |
412 | 412 | //first loop through prices |
413 | - foreach ( $prices as $price ) { |
|
414 | - $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 ); |
|
415 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
413 | + foreach ($prices as $price) { |
|
414 | + $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); |
|
415 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
416 | 416 | |
417 | - $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'] ) . '">'; |
|
417 | + $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']).'">'; |
|
418 | 418 | $output .= $level_text; |
419 | 419 | $output .= '</option>'; |
420 | 420 | |
421 | 421 | } |
422 | 422 | |
423 | 423 | //Custom Amount |
424 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
425 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
424 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
425 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | $output .= '</select>'; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | break; |
431 | 431 | } |
432 | 432 | |
433 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
433 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -442,26 +442,26 @@ discard block |
||
442 | 442 | * @param array $args |
443 | 443 | * |
444 | 444 | */ |
445 | -function give_display_checkout_button( $form_id, $args ) { |
|
445 | +function give_display_checkout_button($form_id, $args) { |
|
446 | 446 | |
447 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
447 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
448 | 448 | ? $args['display_style'] |
449 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
449 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
450 | 450 | |
451 | 451 | //no btn for onpage |
452 | - if ( $display_option === 'onpage' ) { |
|
452 | + if ($display_option === 'onpage') { |
|
453 | 453 | return; |
454 | 454 | } |
455 | 455 | |
456 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
457 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
456 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
457 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
458 | 458 | |
459 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
459 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
460 | 460 | |
461 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
461 | + echo apply_filters('give_display_checkout_button', $output); |
|
462 | 462 | } |
463 | 463 | |
464 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
464 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
465 | 465 | |
466 | 466 | /** |
467 | 467 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -472,71 +472,71 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return void |
474 | 474 | */ |
475 | -function give_user_info_fields( $form_id ) { |
|
475 | +function give_user_info_fields($form_id) { |
|
476 | 476 | |
477 | - if ( is_user_logged_in() ) : |
|
478 | - $user_data = get_userdata( get_current_user_id() ); |
|
477 | + if (is_user_logged_in()) : |
|
478 | + $user_data = get_userdata(get_current_user_id()); |
|
479 | 479 | endif; |
480 | 480 | |
481 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
481 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
482 | 482 | ?> |
483 | 483 | <fieldset id="give_checkout_user_info"> |
484 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
484 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
485 | 485 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
486 | 486 | <label class="give-label" for="give-first"> |
487 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
488 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
487 | + <?php esc_html_e('First Name', 'give'); ?> |
|
488 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
489 | 489 | <span class="give-required-indicator">*</span> |
490 | 490 | <?php } ?> |
491 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
491 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
492 | 492 | </label> |
493 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_html_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 ) ) { |
|
493 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_html_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)) { |
|
494 | 494 | echo ' required '; |
495 | 495 | } ?>/> |
496 | 496 | </p> |
497 | 497 | |
498 | 498 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
499 | 499 | <label class="give-label" for="give-last"> |
500 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
501 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
500 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
501 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
502 | 502 | <span class="give-required-indicator">*</span> |
503 | 503 | <?php } ?> |
504 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
504 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
505 | 505 | </label> |
506 | 506 | |
507 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
507 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
508 | 508 | echo ' required'; |
509 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_html_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 ) ) { |
|
509 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_html_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)) { |
|
510 | 510 | echo ' required '; |
511 | 511 | } ?> /> |
512 | 512 | </p> |
513 | 513 | |
514 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
514 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
515 | 515 | <p id="give-email-wrap" class="form-row form-row-wide"> |
516 | 516 | <label class="give-label" for="give-email"> |
517 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
518 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
517 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
518 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
519 | 519 | <span class="give-required-indicator">*</span> |
520 | 520 | <?php } ?> |
521 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
521 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
522 | 522 | </label> |
523 | 523 | |
524 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_html_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 ) ) { |
|
524 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_html_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)) { |
|
525 | 525 | echo ' required '; |
526 | 526 | } ?>/> |
527 | 527 | |
528 | 528 | </p> |
529 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
529 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
530 | 530 | |
531 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
531 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
532 | 532 | </fieldset> |
533 | 533 | <?php |
534 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
534 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
535 | 535 | |
536 | 536 | } |
537 | 537 | |
538 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
539 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
538 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
539 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
540 | 540 | |
541 | 541 | /** |
542 | 542 | * Renders the credit card info form. |
@@ -547,73 +547,73 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @return void |
549 | 549 | */ |
550 | -function give_get_cc_form( $form_id ) { |
|
550 | +function give_get_cc_form($form_id) { |
|
551 | 551 | |
552 | 552 | ob_start(); |
553 | 553 | |
554 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
554 | + do_action('give_before_cc_fields', $form_id); ?> |
|
555 | 555 | |
556 | 556 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
557 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
558 | - <?php if ( is_ssl() ) : ?> |
|
557 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
558 | + <?php if (is_ssl()) : ?> |
|
559 | 559 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
560 | 560 | <span class="give-icon padlock"></span> |
561 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
561 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
562 | 562 | </div> |
563 | 563 | <?php endif; ?> |
564 | 564 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
565 | 565 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
566 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
566 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
567 | 567 | <span class="give-required-indicator">*</span> |
568 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
568 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
569 | 569 | <span class="card-type"></span> |
570 | 570 | </label> |
571 | 571 | |
572 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_html_e( 'Card number', 'give' ); ?>" required/> |
|
572 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_html_e('Card number', 'give'); ?>" required/> |
|
573 | 573 | </p> |
574 | 574 | |
575 | 575 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
576 | 576 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
577 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
577 | + <?php esc_html_e('CVC', 'give'); ?> |
|
578 | 578 | <span class="give-required-indicator">*</span> |
579 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
579 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
580 | 580 | </label> |
581 | 581 | |
582 | - <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 esc_html_e( 'Security code', 'give' ); ?>" required/> |
|
582 | + <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 esc_html_e('Security code', 'give'); ?>" required/> |
|
583 | 583 | </p> |
584 | 584 | |
585 | 585 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
586 | 586 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
587 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
587 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
588 | 588 | <span class="give-required-indicator">*</span> |
589 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
589 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
590 | 590 | </label> |
591 | 591 | |
592 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_html_e( 'Card name', 'give' ); ?>" required/> |
|
592 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_html_e('Card name', 'give'); ?>" required/> |
|
593 | 593 | </p> |
594 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
594 | + <?php do_action('give_before_cc_expiration'); ?> |
|
595 | 595 | <p class="card-expiration form-row form-row-one-third"> |
596 | 596 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
597 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
597 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
598 | 598 | <span class="give-required-indicator">*</span> |
599 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
599 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
600 | 600 | </label> |
601 | 601 | |
602 | 602 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
603 | 603 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
604 | 604 | |
605 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_html_e( 'MM / YY', 'give' ); ?>" required/> |
|
605 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_html_e('MM / YY', 'give'); ?>" required/> |
|
606 | 606 | </p> |
607 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
607 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
608 | 608 | |
609 | 609 | </fieldset> |
610 | 610 | <?php |
611 | - do_action( 'give_after_cc_fields', $form_id ); |
|
611 | + do_action('give_after_cc_fields', $form_id); |
|
612 | 612 | |
613 | 613 | echo ob_get_clean(); |
614 | 614 | } |
615 | 615 | |
616 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
616 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
617 | 617 | |
618 | 618 | /** |
619 | 619 | * Outputs the default credit card address fields |
@@ -624,110 +624,110 @@ discard block |
||
624 | 624 | * |
625 | 625 | * @return void |
626 | 626 | */ |
627 | -function give_default_cc_address_fields( $form_id ) { |
|
627 | +function give_default_cc_address_fields($form_id) { |
|
628 | 628 | |
629 | 629 | $logged_in = is_user_logged_in(); |
630 | 630 | |
631 | - if ( $logged_in ) { |
|
632 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
631 | + if ($logged_in) { |
|
632 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
633 | 633 | } |
634 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
635 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
636 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
637 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
634 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
635 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
636 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
637 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
638 | 638 | ob_start(); ?> |
639 | 639 | <fieldset id="give_cc_address" class="cc-address"> |
640 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
641 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
640 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
641 | + <?php do_action('give_cc_billing_top'); ?> |
|
642 | 642 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
643 | 643 | <label for="card_address" class="give-label"> |
644 | - <?php esc_html_e( 'Address', 'give' ); ?> |
|
644 | + <?php esc_html_e('Address', 'give'); ?> |
|
645 | 645 | <?php |
646 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
646 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
647 | 647 | <span class="give-required-indicator">*</span> |
648 | 648 | <?php } ?> |
649 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
649 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
650 | 650 | </label> |
651 | 651 | |
652 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
652 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
653 | 653 | echo ' required'; |
654 | - } ?>" placeholder="<?php esc_html_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
654 | + } ?>" placeholder="<?php esc_html_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
655 | 655 | echo ' required '; |
656 | 656 | } ?>/> |
657 | 657 | </p> |
658 | 658 | |
659 | 659 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
660 | 660 | <label for="card_address_2" class="give-label"> |
661 | - <?php esc_html_e( 'Address Line 2', 'give' ); ?> |
|
662 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
661 | + <?php esc_html_e('Address Line 2', 'give'); ?> |
|
662 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
663 | 663 | <span class="give-required-indicator">*</span> |
664 | 664 | <?php } ?> |
665 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
665 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
666 | 666 | </label> |
667 | 667 | |
668 | - <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 ) ) { |
|
668 | + <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)) { |
|
669 | 669 | echo ' required'; |
670 | - } ?>" placeholder="<?php esc_html_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
670 | + } ?>" placeholder="<?php esc_html_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
671 | 671 | echo ' required '; |
672 | 672 | } ?>/> |
673 | 673 | </p> |
674 | 674 | |
675 | 675 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
676 | 676 | <label for="card_city" class="give-label"> |
677 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
678 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
677 | + <?php esc_html_e('City', 'give'); ?> |
|
678 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
679 | 679 | <span class="give-required-indicator">*</span> |
680 | 680 | <?php } ?> |
681 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
681 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The city for your billing address.', 'give'); ?>"></span> |
|
682 | 682 | </label> |
683 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
683 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
684 | 684 | echo ' required'; |
685 | - } ?>" placeholder="<?php esc_html_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
685 | + } ?>" placeholder="<?php esc_html_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
686 | 686 | echo ' required '; |
687 | 687 | } ?>/> |
688 | 688 | </p> |
689 | 689 | |
690 | 690 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
691 | 691 | <label for="card_zip" class="give-label"> |
692 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
693 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
692 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
693 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
694 | 694 | <span class="give-required-indicator">*</span> |
695 | 695 | <?php } ?> |
696 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
696 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
697 | 697 | </label> |
698 | 698 | |
699 | - <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 ) ) { |
|
699 | + <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)) { |
|
700 | 700 | echo ' required'; |
701 | - } ?>" placeholder="<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
701 | + } ?>" placeholder="<?php esc_html_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
702 | 702 | echo ' required '; |
703 | 703 | } ?>/> |
704 | 704 | </p> |
705 | 705 | |
706 | 706 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
707 | 707 | <label for="billing_country" class="give-label"> |
708 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
709 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
708 | + <?php esc_html_e('Country', 'give'); ?> |
|
709 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
710 | 710 | <span class="give-required-indicator">*</span> |
711 | 711 | <?php } ?> |
712 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
712 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The country for your billing address.', 'give'); ?>"></span> |
|
713 | 713 | </label> |
714 | 714 | |
715 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
715 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
716 | 716 | echo ' required'; |
717 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
717 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
718 | 718 | echo ' required '; |
719 | 719 | } ?>> |
720 | 720 | <?php |
721 | 721 | |
722 | 722 | $selected_country = give_get_country(); |
723 | 723 | |
724 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
724 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
725 | 725 | $selected_country = $user_address['country']; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $countries = give_get_country_list(); |
729 | - foreach ( $countries as $country_code => $country ) { |
|
730 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
729 | + foreach ($countries as $country_code => $country) { |
|
730 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
731 | 731 | } |
732 | 732 | ?> |
733 | 733 | </select> |
@@ -735,44 +735,44 @@ discard block |
||
735 | 735 | |
736 | 736 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
737 | 737 | <label for="card_state" class="give-label"> |
738 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
739 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
738 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
739 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
740 | 740 | <span class="give-required-indicator">*</span> |
741 | 741 | <?php } ?> |
742 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
742 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
743 | 743 | </label> |
744 | 744 | |
745 | 745 | <?php |
746 | 746 | $selected_state = give_get_state(); |
747 | - $states = give_get_states( $selected_country ); |
|
747 | + $states = give_get_states($selected_country); |
|
748 | 748 | |
749 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
749 | + if ($logged_in && ! empty($user_address['state'])) { |
|
750 | 750 | $selected_state = $user_address['state']; |
751 | 751 | } |
752 | 752 | |
753 | - if ( ! empty( $states ) ) : ?> |
|
754 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
753 | + if ( ! empty($states)) : ?> |
|
754 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
755 | 755 | echo ' required'; |
756 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
756 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
757 | 757 | echo ' required '; |
758 | 758 | } ?>> |
759 | 759 | <?php |
760 | - foreach ( $states as $state_code => $state ) { |
|
761 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
760 | + foreach ($states as $state_code => $state) { |
|
761 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
762 | 762 | } |
763 | 763 | ?> |
764 | 764 | </select> |
765 | 765 | <?php else : ?> |
766 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e( 'State / Province', 'give' ); ?>"/> |
|
766 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e('State / Province', 'give'); ?>"/> |
|
767 | 767 | <?php endif; ?> |
768 | 768 | </p> |
769 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
769 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
770 | 770 | </fieldset> |
771 | 771 | <?php |
772 | 772 | echo ob_get_clean(); |
773 | 773 | } |
774 | 774 | |
775 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
775 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
776 | 776 | |
777 | 777 | |
778 | 778 | /** |
@@ -784,93 +784,93 @@ discard block |
||
784 | 784 | * |
785 | 785 | * @return string |
786 | 786 | */ |
787 | -function give_get_register_fields( $form_id ) { |
|
787 | +function give_get_register_fields($form_id) { |
|
788 | 788 | |
789 | 789 | global $user_ID; |
790 | 790 | |
791 | - if ( is_user_logged_in() ) { |
|
792 | - $user_data = get_userdata( $user_ID ); |
|
791 | + if (is_user_logged_in()) { |
|
792 | + $user_data = get_userdata($user_ID); |
|
793 | 793 | } |
794 | 794 | |
795 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
795 | + $show_register_form = give_show_login_register_option($form_id); |
|
796 | 796 | |
797 | 797 | ob_start(); ?> |
798 | 798 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
799 | 799 | |
800 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
800 | + <?php if ($show_register_form == 'both') { ?> |
|
801 | 801 | <div class="give-login-account-wrap"> |
802 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
803 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
802 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
803 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
804 | 804 | </p> |
805 | 805 | <p class="give-loading-text"> |
806 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
806 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
807 | 807 | </div> |
808 | 808 | <?php } ?> |
809 | 809 | |
810 | - <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
810 | + <?php do_action('give_register_fields_before', $form_id); ?> |
|
811 | 811 | |
812 | 812 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
813 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
814 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
815 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
813 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
814 | + if ( ! give_logged_in_only($form_id)) { |
|
815 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
816 | 816 | } ?></legend> |
817 | - <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
817 | + <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
818 | 818 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
819 | 819 | <label for="give-user-login-<?php echo $form_id; ?>"> |
820 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
821 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
820 | + <?php esc_html_e('Username', 'give'); ?> |
|
821 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
822 | 822 | <span class="give-required-indicator">*</span> |
823 | 823 | <?php } ?> |
824 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
824 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
825 | 825 | </label> |
826 | 826 | |
827 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
827 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
828 | 828 | echo 'required '; |
829 | - } ?>give-input" type="text" placeholder="<?php esc_html_e( 'Username', 'give' ); ?>" title="<?php esc_html_e( 'Username', 'give' ); ?>"/> |
|
829 | + } ?>give-input" type="text" placeholder="<?php esc_html_e('Username', 'give'); ?>" title="<?php esc_html_e('Username', 'give'); ?>"/> |
|
830 | 830 | </div> |
831 | 831 | |
832 | 832 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
833 | 833 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
834 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
835 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
834 | + <?php esc_html_e('Password', 'give'); ?> |
|
835 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
836 | 836 | <span class="give-required-indicator">*</span> |
837 | 837 | <?php } ?> |
838 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
838 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The password used to access your account.', 'give'); ?>"></span> |
|
839 | 839 | </label> |
840 | 840 | |
841 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
841 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
842 | 842 | echo 'required '; |
843 | - } ?>give-input" placeholder="<?php esc_html_e( 'Password', 'give' ); ?>" type="password"/> |
|
843 | + } ?>give-input" placeholder="<?php esc_html_e('Password', 'give'); ?>" type="password"/> |
|
844 | 844 | </div> |
845 | 845 | |
846 | 846 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
847 | 847 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
848 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
849 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
848 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
849 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
850 | 850 | <span class="give-required-indicator">*</span> |
851 | 851 | <?php } ?> |
852 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
852 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
853 | 853 | </label> |
854 | 854 | |
855 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
855 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
856 | 856 | echo 'required '; |
857 | - } ?>give-input" placeholder="<?php esc_html_e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
857 | + } ?>give-input" placeholder="<?php esc_html_e('Confirm password', 'give'); ?>" type="password"/> |
|
858 | 858 | </div> |
859 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
859 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
860 | 860 | </fieldset> |
861 | 861 | |
862 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
862 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
863 | 863 | |
864 | 864 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
865 | 865 | |
866 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
866 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
867 | 867 | |
868 | 868 | </fieldset> |
869 | 869 | <?php |
870 | 870 | echo ob_get_clean(); |
871 | 871 | } |
872 | 872 | |
873 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
873 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -883,79 +883,79 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return string |
885 | 885 | */ |
886 | -function give_get_login_fields( $form_id ) { |
|
886 | +function give_get_login_fields($form_id) { |
|
887 | 887 | |
888 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
889 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
888 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
889 | + $show_register_form = give_show_login_register_option($form_id); |
|
890 | 890 | |
891 | 891 | ob_start(); |
892 | 892 | ?> |
893 | 893 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
894 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
895 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
896 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
894 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
895 | + if ( ! give_logged_in_only($form_id)) { |
|
896 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
897 | 897 | } ?> |
898 | 898 | </legend> |
899 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
899 | + <?php if ($show_register_form == 'both') { ?> |
|
900 | 900 | <p class="give-new-account-link"> |
901 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
902 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
903 | - <?php esc_html_e( 'Register', 'give' ); |
|
904 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
905 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
901 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
902 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
903 | + <?php esc_html_e('Register', 'give'); |
|
904 | + if ( ! give_logged_in_only($form_id)) { |
|
905 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
906 | 906 | } ?> |
907 | 907 | </a> |
908 | 908 | </p> |
909 | 909 | <p class="give-loading-text"> |
910 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
910 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
911 | 911 | <?php } ?> |
912 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
912 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
913 | 913 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
914 | 914 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
915 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
916 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
915 | + <?php esc_html_e('Username', 'give'); ?> |
|
916 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
917 | 917 | <span class="give-required-indicator">*</span> |
918 | 918 | <?php } ?> |
919 | 919 | </label> |
920 | 920 | |
921 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
921 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
922 | 922 | echo 'required '; |
923 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_html_e( 'Your username', 'give' ); ?>"/> |
|
923 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_html_e('Your username', 'give'); ?>"/> |
|
924 | 924 | </div> |
925 | 925 | |
926 | 926 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
927 | 927 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
928 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
929 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
928 | + <?php esc_html_e('Password', 'give'); ?> |
|
929 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
930 | 930 | <span class="give-required-indicator">*</span> |
931 | 931 | <?php } ?> |
932 | 932 | </label> |
933 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
933 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
934 | 934 | echo 'required '; |
935 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_html_e( 'Your password', 'give' ); ?>"/> |
|
935 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_html_e('Your password', 'give'); ?>"/> |
|
936 | 936 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
937 | 937 | </div> |
938 | 938 | |
939 | 939 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
940 | 940 | <span class="give-forgot-password "> |
941 | - <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset password?' ) ?></a> |
|
941 | + <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset password?') ?></a> |
|
942 | 942 | </span> |
943 | 943 | </div> |
944 | 944 | |
945 | 945 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
946 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_html_e( 'Login', 'give' ); ?>"/> |
|
947 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
948 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_html_e( 'Cancel', 'give' ); ?>"/> |
|
946 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_html_e('Login', 'give'); ?>"/> |
|
947 | + <?php if ($show_register_form !== 'login') { ?> |
|
948 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_html_e('Cancel', 'give'); ?>"/> |
|
949 | 949 | <?php } ?> |
950 | 950 | <span class="give-loading-animation"></span> |
951 | 951 | </div> |
952 | - <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
952 | + <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
953 | 953 | </fieldset><!--end #give-login-fields--> |
954 | 954 | <?php |
955 | 955 | echo ob_get_clean(); |
956 | 956 | } |
957 | 957 | |
958 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
958 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
959 | 959 | |
960 | 960 | /** |
961 | 961 | * Payment Mode Select |
@@ -971,49 +971,49 @@ discard block |
||
971 | 971 | * |
972 | 972 | * @return void |
973 | 973 | */ |
974 | -function give_payment_mode_select( $form_id ) { |
|
974 | +function give_payment_mode_select($form_id) { |
|
975 | 975 | |
976 | 976 | $gateways = give_get_enabled_payment_gateways(); |
977 | 977 | |
978 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
978 | + do_action('give_payment_mode_top', $form_id); ?> |
|
979 | 979 | |
980 | 980 | <fieldset id="give-payment-mode-select"> |
981 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
981 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
982 | 982 | <div id="give-payment-mode-wrap"> |
983 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
984 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
983 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
984 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
985 | 985 | </legend> |
986 | 986 | <?php |
987 | 987 | |
988 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
988 | + do_action('give_payment_mode_before_gateways') ?> |
|
989 | 989 | |
990 | 990 | <ul id="give-gateway-radio-list"> |
991 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
992 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
991 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
992 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
993 | 993 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
994 | - 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 ) . '">'; |
|
995 | - 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'] ); |
|
994 | + 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).'">'; |
|
995 | + 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']); |
|
996 | 996 | echo '</label></li>'; |
997 | 997 | endforeach; ?> |
998 | 998 | </ul> |
999 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
999 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
1000 | 1000 | </div> |
1001 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
1001 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
1002 | 1002 | </fieldset> |
1003 | 1003 | |
1004 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
1004 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
1005 | 1005 | |
1006 | 1006 | <div id="give_purchase_form_wrap"> |
1007 | 1007 | |
1008 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
1008 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
1009 | 1009 | |
1010 | 1010 | </div><!-- the checkout fields are loaded into this--> |
1011 | 1011 | |
1012 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
1012 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
1013 | 1013 | |
1014 | 1014 | } |
1015 | 1015 | |
1016 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1016 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1017 | 1017 | |
1018 | 1018 | |
1019 | 1019 | /** |
@@ -1027,36 +1027,36 @@ discard block |
||
1027 | 1027 | * |
1028 | 1028 | * @return void |
1029 | 1029 | */ |
1030 | -function give_terms_agreement( $form_id ) { |
|
1030 | +function give_terms_agreement($form_id) { |
|
1031 | 1031 | |
1032 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1033 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1034 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1032 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1033 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1034 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1035 | 1035 | |
1036 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1036 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1037 | 1037 | <fieldset id="give_terms_agreement"> |
1038 | - <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
1038 | + <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
1039 | 1039 | <?php |
1040 | - do_action( 'give_before_terms' ); |
|
1041 | - echo wpautop( stripslashes( $terms ) ); |
|
1042 | - do_action( 'give_after_terms' ); |
|
1040 | + do_action('give_before_terms'); |
|
1041 | + echo wpautop(stripslashes($terms)); |
|
1042 | + do_action('give_after_terms'); |
|
1043 | 1043 | ?> |
1044 | 1044 | </div> |
1045 | 1045 | <div id="give_show_terms"> |
1046 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1047 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1046 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1047 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1048 | 1048 | </div> |
1049 | 1049 | |
1050 | 1050 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1051 | 1051 | <label |
1052 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label> |
|
1052 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label> |
|
1053 | 1053 | |
1054 | 1054 | </fieldset> |
1055 | 1055 | <?php |
1056 | 1056 | } |
1057 | 1057 | } |
1058 | 1058 | |
1059 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1059 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1060 | 1060 | |
1061 | 1061 | /** |
1062 | 1062 | * Checkout Final Total |
@@ -1069,27 +1069,27 @@ discard block |
||
1069 | 1069 | * |
1070 | 1070 | * @return void |
1071 | 1071 | */ |
1072 | -function give_checkout_final_total( $form_id ) { |
|
1072 | +function give_checkout_final_total($form_id) { |
|
1073 | 1073 | |
1074 | - if ( isset( $_POST['give_total'] ) ) { |
|
1075 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1074 | + if (isset($_POST['give_total'])) { |
|
1075 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1076 | 1076 | } else { |
1077 | 1077 | //default total |
1078 | - $total = give_get_default_form_amount( $form_id ); |
|
1078 | + $total = give_get_default_form_amount($form_id); |
|
1079 | 1079 | } |
1080 | 1080 | //Only proceed if give_total available |
1081 | - if ( empty( $total ) ) { |
|
1081 | + if (empty($total)) { |
|
1082 | 1082 | return; |
1083 | 1083 | } |
1084 | 1084 | ?> |
1085 | 1085 | <p id="give-final-total-wrap" class="form-wrap "> |
1086 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1087 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1086 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1087 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1088 | 1088 | </p> |
1089 | 1089 | <?php |
1090 | 1090 | } |
1091 | 1091 | |
1092 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1092 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1093 | 1093 | |
1094 | 1094 | |
1095 | 1095 | /** |
@@ -1101,22 +1101,22 @@ discard block |
||
1101 | 1101 | * |
1102 | 1102 | * @return void |
1103 | 1103 | */ |
1104 | -function give_checkout_submit( $form_id ) { |
|
1104 | +function give_checkout_submit($form_id) { |
|
1105 | 1105 | ?> |
1106 | 1106 | <fieldset id="give_purchase_submit"> |
1107 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1107 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1108 | 1108 | |
1109 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1109 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1110 | 1110 | |
1111 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1111 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1112 | 1112 | |
1113 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1113 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1114 | 1114 | |
1115 | 1115 | </fieldset> |
1116 | 1116 | <?php |
1117 | 1117 | } |
1118 | 1118 | |
1119 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1119 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | /** |
@@ -1129,17 +1129,17 @@ discard block |
||
1129 | 1129 | * |
1130 | 1130 | * @return string |
1131 | 1131 | */ |
1132 | -function give_checkout_button_purchase( $form_id ) { |
|
1132 | +function give_checkout_button_purchase($form_id) { |
|
1133 | 1133 | |
1134 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1135 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1134 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1135 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1136 | 1136 | ob_start(); ?> |
1137 | 1137 | <div class="give-submit-button-wrap give-clearfix"> |
1138 | 1138 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
1139 | 1139 | <span class="give-loading-animation"></span> |
1140 | 1140 | </div> |
1141 | 1141 | <?php |
1142 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1142 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | /** |
@@ -1152,18 +1152,18 @@ discard block |
||
1152 | 1152 | * |
1153 | 1153 | * @return void |
1154 | 1154 | */ |
1155 | -function give_agree_to_terms_js( $form_id ) { |
|
1155 | +function give_agree_to_terms_js($form_id) { |
|
1156 | 1156 | |
1157 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1157 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1158 | 1158 | |
1159 | - if ( $form_option === 'yes' ) { |
|
1159 | + if ($form_option === 'yes') { |
|
1160 | 1160 | ?> |
1161 | 1161 | <script type="text/javascript"> |
1162 | 1162 | jQuery(document).ready(function ($) { |
1163 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
1163 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1164 | 1164 | e.preventDefault(); |
1165 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1166 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
1165 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
1166 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1167 | 1167 | return false; |
1168 | 1168 | }); |
1169 | 1169 | }); |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | |
1175 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1175 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1176 | 1176 | |
1177 | 1177 | /** |
1178 | 1178 | * Show Give Goals |
@@ -1187,17 +1187,17 @@ discard block |
||
1187 | 1187 | * @return mixed |
1188 | 1188 | */ |
1189 | 1189 | |
1190 | -function give_show_goal_progress( $form_id, $args ) { |
|
1190 | +function give_show_goal_progress($form_id, $args) { |
|
1191 | 1191 | |
1192 | 1192 | ob_start(); |
1193 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1193 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1194 | 1194 | |
1195 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1195 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1196 | 1196 | |
1197 | 1197 | return true; |
1198 | 1198 | } |
1199 | 1199 | |
1200 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1200 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * Adds Actions to Render Form Content |
@@ -1209,19 +1209,19 @@ discard block |
||
1209 | 1209 | * |
1210 | 1210 | * @return void |
1211 | 1211 | */ |
1212 | -function give_form_content( $form_id, $args ) { |
|
1212 | +function give_form_content($form_id, $args) { |
|
1213 | 1213 | |
1214 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1214 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1215 | 1215 | ? $args['show_content'] |
1216 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1216 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1217 | 1217 | |
1218 | - if ( $show_content !== 'none' ) { |
|
1218 | + if ($show_content !== 'none') { |
|
1219 | 1219 | //add action according to value |
1220 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1220 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1221 | 1221 | } |
1222 | 1222 | } |
1223 | 1223 | |
1224 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1224 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1225 | 1225 | |
1226 | 1226 | /** |
1227 | 1227 | * Renders Post Form Content |
@@ -1233,24 +1233,24 @@ discard block |
||
1233 | 1233 | * @return void |
1234 | 1234 | * @since 1.0 |
1235 | 1235 | */ |
1236 | -function give_form_display_content( $form_id, $args ) { |
|
1236 | +function give_form_display_content($form_id, $args) { |
|
1237 | 1237 | |
1238 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1239 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1238 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1239 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1240 | 1240 | ? $args['show_content'] |
1241 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1241 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1242 | 1242 | |
1243 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1244 | - $content = apply_filters( 'the_content', $content ); |
|
1243 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1244 | + $content = apply_filters('the_content', $content); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1247 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1248 | 1248 | |
1249 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1249 | + echo apply_filters('give_form_content_output', $output); |
|
1250 | 1250 | |
1251 | 1251 | //remove action to prevent content output on addition forms on page |
1252 | 1252 | //@see: https://github.com/WordImpress/Give/issues/634 |
1253 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1253 | + remove_action($show_content, 'give_form_display_content'); |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | |
@@ -1263,16 +1263,16 @@ discard block |
||
1263 | 1263 | * |
1264 | 1264 | * @return void |
1265 | 1265 | */ |
1266 | -function give_checkout_hidden_fields( $form_id ) { |
|
1266 | +function give_checkout_hidden_fields($form_id) { |
|
1267 | 1267 | |
1268 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1269 | - if ( is_user_logged_in() ) { ?> |
|
1268 | + do_action('give_hidden_fields_before', $form_id); |
|
1269 | + if (is_user_logged_in()) { ?> |
|
1270 | 1270 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1271 | 1271 | <?php } ?> |
1272 | 1272 | <input type="hidden" name="give_action" value="purchase"/> |
1273 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1273 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1274 | 1274 | <?php |
1275 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1275 | + do_action('give_hidden_fields_after', $form_id); |
|
1276 | 1276 | |
1277 | 1277 | } |
1278 | 1278 | |
@@ -1287,20 +1287,20 @@ discard block |
||
1287 | 1287 | * |
1288 | 1288 | * @return string $content Filtered content |
1289 | 1289 | */ |
1290 | -function give_filter_success_page_content( $content ) { |
|
1290 | +function give_filter_success_page_content($content) { |
|
1291 | 1291 | |
1292 | 1292 | global $give_options; |
1293 | 1293 | |
1294 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1295 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1296 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1294 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1295 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1296 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1297 | 1297 | } |
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | return $content; |
1301 | 1301 | } |
1302 | 1302 | |
1303 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1303 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1304 | 1304 | |
1305 | 1305 | |
1306 | 1306 | /** |
@@ -1312,14 +1312,14 @@ discard block |
||
1312 | 1312 | |
1313 | 1313 | function give_test_mode_frontend_warning() { |
1314 | 1314 | |
1315 | - $test_mode = give_get_option( 'test_mode' ); |
|
1315 | + $test_mode = give_get_option('test_mode'); |
|
1316 | 1316 | |
1317 | - if ( $test_mode == 'on' ) { |
|
1318 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
1317 | + if ($test_mode == 'on') { |
|
1318 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice', 'give').'</strong>: '.esc_html__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
1319 | 1319 | } |
1320 | 1320 | } |
1321 | 1321 | |
1322 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1322 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1323 | 1323 | |
1324 | 1324 | |
1325 | 1325 | /** |
@@ -1335,21 +1335,21 @@ discard block |
||
1335 | 1335 | * @return string |
1336 | 1336 | */ |
1337 | 1337 | |
1338 | -function give_members_only_form( $final_output, $args ) { |
|
1338 | +function give_members_only_form($final_output, $args) { |
|
1339 | 1339 | |
1340 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1340 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1341 | 1341 | |
1342 | 1342 | //Sanity Check: Must have form_id & not be logged in |
1343 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1343 | + if (empty($form_id) || is_user_logged_in()) { |
|
1344 | 1344 | return $final_output; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | //Logged in only and Register / Login set to none |
1348 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1348 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1349 | 1349 | |
1350 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1350 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1351 | 1351 | |
1352 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1352 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1353 | 1353 | |
1354 | 1354 | } |
1355 | 1355 | |
@@ -1357,4 +1357,4 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | } |
1359 | 1359 | |
1360 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1360 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |