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