@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,47 +23,47 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation 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 = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = 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 ( 'trash' === $form->post_status || ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
| 58 | + if ('trash' === $form->post_status || ! current_user_can('edit_give_forms', $form->ID)) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //Get the form wrap CSS classes. |
| 63 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 64 | 64 | |
| 65 | 65 | //Get the <form> tag wrap CSS classes. |
| 66 | - $form_classes = $form->get_form_classes( $args ); |
|
| 66 | + $form_classes = $form->get_form_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | ob_start(); |
| 69 | 69 | |
@@ -75,23 +75,23 @@ discard block |
||
| 75 | 75 | * @param int $form_id The form ID. |
| 76 | 76 | * @param array $args An array of form arguments. |
| 77 | 77 | */ |
| 78 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 78 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 79 | 79 | |
| 80 | 80 | ?> |
| 81 | 81 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 82 | 82 | |
| 83 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 83 | + <?php if ($form->is_close_donation_form()) { |
|
| 84 | 84 | |
| 85 | 85 | //Get Goal thank you message. |
| 86 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 87 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
| 86 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 87 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
| 88 | 88 | |
| 89 | 89 | //Print thank you message. |
| 90 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
| 90 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
| 91 | 91 | |
| 92 | 92 | } else { |
| 93 | 93 | |
| 94 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
| 94 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Filter the title |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param int $form_id |
| 102 | 102 | * @param Give_Donate_Form $form |
| 103 | 103 | */ |
| 104 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>', $form_id, $form ); |
|
| 104 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>', $form_id, $form); |
|
| 105 | 105 | |
| 106 | 106 | } |
| 107 | 107 | |
@@ -113,19 +113,19 @@ discard block |
||
| 113 | 113 | * @param int $form_id The form ID. |
| 114 | 114 | * @param array $args An array of form arguments. |
| 115 | 115 | */ |
| 116 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 116 | + do_action('give_pre_form', $form->ID, $args); |
|
| 117 | 117 | ?> |
| 118 | 118 | |
| 119 | 119 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 120 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 120 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 121 | 121 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 122 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 122 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 123 | 123 | <input type="hidden" name="give-current-url" |
| 124 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 124 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 125 | 125 | <input type="hidden" name="give-form-url" |
| 126 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 126 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 127 | 127 | <input type="hidden" name="give-form-minimum" |
| 128 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 128 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 129 | 129 | |
| 130 | 130 | <!-- The following field is for robots only, invisible to humans: --> |
| 131 | 131 | <span class="give-hidden" style="display: none !important;"> |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | <?php |
| 138 | 138 | |
| 139 | 139 | //Price ID hidden field for variable (mult-level) donation forms. |
| 140 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 140 | + if (give_has_variable_prices($form_id)) { |
|
| 141 | 141 | //get default selected price ID. |
| 142 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 142 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 143 | 143 | $price_id = 0; |
| 144 | 144 | //loop through prices. |
| 145 | - foreach ( $prices as $price ) { |
|
| 146 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 145 | + foreach ($prices as $price) { |
|
| 146 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 147 | 147 | $price_id = $price['_give_id']['level_id']; |
| 148 | 148 | }; |
| 149 | 149 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param int $form_id The form ID. |
| 160 | 160 | * @param array $args An array of form arguments. |
| 161 | 161 | */ |
| 162 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 162 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * Fires while outputing donation form, for payment gatways fields. |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param int $form_id The form ID. |
| 170 | 170 | * @param array $args An array of form arguments. |
| 171 | 171 | */ |
| 172 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 172 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * Fires while outputing donation form, after all other fields. |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param int $form_id The form ID. |
| 180 | 180 | * @param array $args An array of form arguments. |
| 181 | 181 | */ |
| 182 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 182 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 183 | 183 | |
| 184 | 184 | ?> |
| 185 | 185 | </form> |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * @param int $form_id The form ID. |
| 194 | 194 | * @param array $args An array of form arguments. |
| 195 | 195 | */ |
| 196 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 196 | + do_action('give_post_form', $form->ID, $args); |
|
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | ?> |
| 200 | 200 | |
| 201 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 201 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 202 | 202 | <?php |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | * @param int $form_id The form ID. |
| 210 | 210 | * @param array $args An array of form arguments. |
| 211 | 211 | */ |
| 212 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 212 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 213 | 213 | |
| 214 | 214 | $final_output = ob_get_clean(); |
| 215 | 215 | |
| 216 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 216 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return string |
| 232 | 232 | */ |
| 233 | -function give_show_purchase_form( $form_id ) { |
|
| 233 | +function give_show_purchase_form($form_id) { |
|
| 234 | 234 | |
| 235 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 235 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 236 | 236 | |
| 237 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 237 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 238 | 238 | $form_id = $_POST['give_form_id']; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -243,33 +243,33 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @since 1.7 |
| 245 | 245 | */ |
| 246 | - do_action( 'give_donation_form_top', $form_id ); |
|
| 246 | + do_action('give_donation_form_top', $form_id); |
|
| 247 | 247 | |
| 248 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 248 | + if (give_can_checkout() && isset($form_id)) { |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * Fires while displaying donation form, before registration login. |
| 252 | 252 | * |
| 253 | 253 | * @since 1.7 |
| 254 | 254 | */ |
| 255 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 255 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | 258 | * Fire when register/login form fields render. |
| 259 | 259 | * |
| 260 | 260 | * @since 1.7 |
| 261 | 261 | */ |
| 262 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 262 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | 265 | * Fire when credit card form fields render. |
| 266 | 266 | * |
| 267 | 267 | * @since 1.7 |
| 268 | 268 | */ |
| 269 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 269 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 270 | 270 | |
| 271 | 271 | // Load the credit card form and allow gateways to load their own if they wish. |
| 272 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 272 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 273 | 273 | /** |
| 274 | 274 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 275 | 275 | * |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @param int $form_id The form ID. |
| 279 | 279 | */ |
| 280 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 280 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 281 | 281 | } else { |
| 282 | 282 | /** |
| 283 | 283 | * Fires while displaying donation form, credit card form fields. |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param int $form_id The form ID. |
| 288 | 288 | */ |
| 289 | - do_action( 'give_cc_form', $form_id ); |
|
| 289 | + do_action('give_cc_form', $form_id); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @since 1.7 |
| 296 | 296 | */ |
| 297 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 297 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 298 | 298 | |
| 299 | 299 | } else { |
| 300 | 300 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @since 1.7 |
| 304 | 304 | */ |
| 305 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 305 | + do_action('give_donation_form_no_access', $form_id); |
|
| 306 | 306 | |
| 307 | 307 | } |
| 308 | 308 | |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @since 1.7 |
| 313 | 313 | */ |
| 314 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
| 314 | + do_action('give_donation_form_bottom', $form_id); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 317 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * Give Show Login/Register Form Fields. |
@@ -325,11 +325,11 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | * @return void |
| 327 | 327 | */ |
| 328 | -function give_show_register_login_fields( $form_id ) { |
|
| 328 | +function give_show_register_login_fields($form_id) { |
|
| 329 | 329 | |
| 330 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 330 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 331 | 331 | |
| 332 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 332 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 333 | 333 | ?> |
| 334 | 334 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 335 | 335 | <?php |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | * |
| 339 | 339 | * @since 1.7 |
| 340 | 340 | */ |
| 341 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 341 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 342 | 342 | ?> |
| 343 | 343 | </div> |
| 344 | 344 | <?php |
| 345 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 345 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 346 | 346 | ?> |
| 347 | 347 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 348 | 348 | <?php |
@@ -351,23 +351,23 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @since 1.7 |
| 353 | 353 | */ |
| 354 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 354 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 355 | 355 | ?> |
| 356 | 356 | </div> |
| 357 | 357 | <?php |
| 358 | 358 | endif; |
| 359 | 359 | |
| 360 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 360 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 361 | 361 | /** |
| 362 | 362 | * Fire when user info render. |
| 363 | 363 | * |
| 364 | 364 | * @since 1.7 |
| 365 | 365 | */ |
| 366 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 366 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 370 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 371 | 371 | |
| 372 | 372 | /** |
| 373 | 373 | * Donation Amount Field. |
@@ -381,16 +381,16 @@ discard block |
||
| 381 | 381 | * |
| 382 | 382 | * @return void |
| 383 | 383 | */ |
| 384 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 384 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 385 | 385 | |
| 386 | 386 | $give_options = give_get_settings(); |
| 387 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 388 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 389 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 390 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 391 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 392 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 393 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 387 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 388 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 389 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 390 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 391 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 392 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 393 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 394 | 394 | |
| 395 | 395 | /** |
| 396 | 396 | * Fires while displaying donation form, before donation level fields. |
@@ -400,20 +400,20 @@ discard block |
||
| 400 | 400 | * @param int $form_id The form ID. |
| 401 | 401 | * @param array $args An array of form arguments. |
| 402 | 402 | */ |
| 403 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 403 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 404 | 404 | |
| 405 | 405 | //Set Price, No Custom Amount Allowed means hidden price field. |
| 406 | - if ( $allow_custom_amount == 'no' ) { |
|
| 406 | + if ($allow_custom_amount == 'no') { |
|
| 407 | 407 | ?> |
| 408 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 408 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 409 | 409 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 410 | 410 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 411 | 411 | <div class="set-price give-donation-amount form-row-wide"> |
| 412 | - <?php if ( $currency_position == 'before' ) { |
|
| 412 | + <?php if ($currency_position == 'before') { |
|
| 413 | 413 | echo $currency_output; |
| 414 | 414 | } ?> |
| 415 | 415 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 416 | - <?php if ( $currency_position == 'after' ) { |
|
| 416 | + <?php if ($currency_position == 'after') { |
|
| 417 | 417 | echo $currency_output; |
| 418 | 418 | } ?> |
| 419 | 419 | </div> |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | ?> |
| 424 | 424 | <div class="give-total-wrap"> |
| 425 | 425 | <div class="give-donation-amount form-row-wide"> |
| 426 | - <?php if ( $currency_position == 'before' ) { |
|
| 426 | + <?php if ($currency_position == 'before') { |
|
| 427 | 427 | echo $currency_output; |
| 428 | 428 | } ?> |
| 429 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 429 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 430 | 430 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 431 | 431 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 432 | - <?php if ( $currency_position == 'after' ) { |
|
| 432 | + <?php if ($currency_position == 'after') { |
|
| 433 | 433 | echo $currency_output; |
| 434 | 434 | } ?> |
| 435 | 435 | </div> |
@@ -444,16 +444,16 @@ discard block |
||
| 444 | 444 | * @param int $form_id The form ID. |
| 445 | 445 | * @param array $args An array of form arguments. |
| 446 | 446 | */ |
| 447 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 447 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 448 | 448 | |
| 449 | 449 | //Custom Amount Text. |
| 450 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
| 450 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
| 451 | 451 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 452 | 452 | <?php } |
| 453 | 453 | |
| 454 | 454 | //Output Variable Pricing Levels. |
| 455 | - if ( $variable_pricing ) { |
|
| 456 | - give_output_levels( $form_id ); |
|
| 455 | + if ($variable_pricing) { |
|
| 456 | + give_output_levels($form_id); |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -464,10 +464,10 @@ discard block |
||
| 464 | 464 | * @param int $form_id The form ID. |
| 465 | 465 | * @param array $args An array of form arguments. |
| 466 | 466 | */ |
| 467 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 467 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 470 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 471 | 471 | |
| 472 | 472 | /** |
| 473 | 473 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -478,32 +478,32 @@ discard block |
||
| 478 | 478 | * |
| 479 | 479 | * @return string Donation levels. |
| 480 | 480 | */ |
| 481 | -function give_output_levels( $form_id ) { |
|
| 481 | +function give_output_levels($form_id) { |
|
| 482 | 482 | |
| 483 | 483 | //Get variable pricing. |
| 484 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 485 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 486 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 487 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 488 | - if ( empty( $custom_amount_text ) ) { |
|
| 489 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 484 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 485 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 486 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 487 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 488 | + if (empty($custom_amount_text)) { |
|
| 489 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $output = ''; |
| 493 | 493 | $counter = 0; |
| 494 | 494 | |
| 495 | - switch ( $display_style ) { |
|
| 495 | + switch ($display_style) { |
|
| 496 | 496 | case 'buttons': |
| 497 | 497 | |
| 498 | 498 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 499 | 499 | |
| 500 | - foreach ( $prices as $price ) { |
|
| 501 | - $counter ++; |
|
| 502 | - $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 ); |
|
| 503 | - $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 ); |
|
| 500 | + foreach ($prices as $price) { |
|
| 501 | + $counter++; |
|
| 502 | + $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); |
|
| 503 | + $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); |
|
| 504 | 504 | |
| 505 | 505 | $output .= '<li>'; |
| 506 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 506 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 507 | 507 | $output .= $level_text; |
| 508 | 508 | $output .= '</button>'; |
| 509 | 509 | $output .= '</li>'; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | //Custom Amount. |
| 514 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 514 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 515 | 515 | $output .= '<li>'; |
| 516 | 516 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 517 | 517 | $output .= $custom_amount_text; |
@@ -527,23 +527,23 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 529 | 529 | |
| 530 | - foreach ( $prices as $price ) { |
|
| 531 | - $counter ++; |
|
| 532 | - $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 ); |
|
| 533 | - $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 ); |
|
| 530 | + foreach ($prices as $price) { |
|
| 531 | + $counter++; |
|
| 532 | + $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); |
|
| 533 | + $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); |
|
| 534 | 534 | |
| 535 | 535 | $output .= '<li>'; |
| 536 | - $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'] ) . '">'; |
|
| 537 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 536 | + $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']).'">'; |
|
| 537 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 538 | 538 | $output .= '</li>'; |
| 539 | 539 | |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | //Custom Amount. |
| 543 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 543 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 544 | 544 | $output .= '<li>'; |
| 545 | 545 | $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">'; |
| 546 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 546 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 547 | 547 | $output .= '</li>'; |
| 548 | 548 | } |
| 549 | 549 | |
@@ -553,23 +553,23 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | case 'dropdown': |
| 555 | 555 | |
| 556 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 557 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 556 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 557 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 558 | 558 | |
| 559 | 559 | //first loop through prices. |
| 560 | - foreach ( $prices as $price ) { |
|
| 561 | - $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 ); |
|
| 562 | - $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 ); |
|
| 560 | + foreach ($prices as $price) { |
|
| 561 | + $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); |
|
| 562 | + $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); |
|
| 563 | 563 | |
| 564 | - $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'] ) . '">'; |
|
| 564 | + $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']).'">'; |
|
| 565 | 565 | $output .= $level_text; |
| 566 | 566 | $output .= '</option>'; |
| 567 | 567 | |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | //Custom Amount. |
| 571 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 572 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 571 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 572 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | $output .= '</select>'; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | break; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 580 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | /** |
@@ -592,26 +592,26 @@ discard block |
||
| 592 | 592 | * |
| 593 | 593 | * @return string Checkout button. |
| 594 | 594 | */ |
| 595 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 595 | +function give_display_checkout_button($form_id, $args) { |
|
| 596 | 596 | |
| 597 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 597 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 598 | 598 | ? $args['display_style'] |
| 599 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 599 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 600 | 600 | |
| 601 | 601 | //no btn for onpage. |
| 602 | - if ( $display_option === 'onpage' ) { |
|
| 602 | + if ($display_option === 'onpage') { |
|
| 603 | 603 | return; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 607 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 606 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 607 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 608 | 608 | |
| 609 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 609 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 610 | 610 | |
| 611 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 611 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 614 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | 617 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -622,57 +622,57 @@ discard block |
||
| 622 | 622 | * |
| 623 | 623 | * @return void |
| 624 | 624 | */ |
| 625 | -function give_user_info_fields( $form_id ) { |
|
| 625 | +function give_user_info_fields($form_id) { |
|
| 626 | 626 | // Get user info. |
| 627 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 627 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 628 | 628 | |
| 629 | 629 | /** |
| 630 | 630 | * Fire before user personal information fields |
| 631 | 631 | * |
| 632 | 632 | * @since 1.7 |
| 633 | 633 | */ |
| 634 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 634 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 635 | 635 | ?> |
| 636 | 636 | <fieldset id="give_checkout_user_info"> |
| 637 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 637 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 638 | 638 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
| 639 | 639 | <label class="give-label" for="give-first"> |
| 640 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 641 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 640 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 641 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 642 | 642 | <span class="give-required-indicator">*</span> |
| 643 | 643 | <?php endif ?> |
| 644 | 644 | <span class="give-tooltip give-icon give-icon-question" |
| 645 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 645 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 646 | 646 | </label> |
| 647 | 647 | <input |
| 648 | 648 | class="give-input required" |
| 649 | 649 | type="text" |
| 650 | 650 | name="give_first" |
| 651 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 651 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 652 | 652 | id="give-first" |
| 653 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 654 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 653 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 654 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 655 | 655 | /> |
| 656 | 656 | </p> |
| 657 | 657 | |
| 658 | 658 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
| 659 | 659 | <label class="give-label" for="give-last"> |
| 660 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 661 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 660 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 661 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 662 | 662 | <span class="give-required-indicator">*</span> |
| 663 | 663 | <?php endif ?> |
| 664 | 664 | <span class="give-tooltip give-icon give-icon-question" |
| 665 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 665 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 666 | 666 | </label> |
| 667 | 667 | |
| 668 | 668 | <input |
| 669 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 669 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 670 | 670 | type="text" |
| 671 | 671 | name="give_last" |
| 672 | 672 | id="give-last" |
| 673 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 674 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 675 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 673 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 674 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 675 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 676 | 676 | /> |
| 677 | 677 | </p> |
| 678 | 678 | |
@@ -682,26 +682,26 @@ discard block |
||
| 682 | 682 | * |
| 683 | 683 | * @since 1.7 |
| 684 | 684 | */ |
| 685 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 685 | + do_action('give_donation_form_before_email', $form_id); |
|
| 686 | 686 | ?> |
| 687 | 687 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 688 | 688 | <label class="give-label" for="give-email"> |
| 689 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 690 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 689 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 690 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 691 | 691 | <span class="give-required-indicator">*</span> |
| 692 | 692 | <?php } ?> |
| 693 | 693 | <span class="give-tooltip give-icon give-icon-question" |
| 694 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 694 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 695 | 695 | </label> |
| 696 | 696 | |
| 697 | 697 | <input |
| 698 | 698 | class="give-input required" |
| 699 | 699 | type="email" |
| 700 | 700 | name="give_email" |
| 701 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 701 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 702 | 702 | id="give-email" |
| 703 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 704 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 703 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 704 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 705 | 705 | /> |
| 706 | 706 | |
| 707 | 707 | </p> |
@@ -711,14 +711,14 @@ discard block |
||
| 711 | 711 | * |
| 712 | 712 | * @since 1.7 |
| 713 | 713 | */ |
| 714 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 714 | + do_action('give_donation_form_after_email', $form_id); |
|
| 715 | 715 | |
| 716 | 716 | /** |
| 717 | 717 | * Fire after personal email field |
| 718 | 718 | * |
| 719 | 719 | * @since 1.7 |
| 720 | 720 | */ |
| 721 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 721 | + do_action('give_donation_form_user_info', $form_id); |
|
| 722 | 722 | ?> |
| 723 | 723 | </fieldset> |
| 724 | 724 | <?php |
@@ -727,11 +727,11 @@ discard block |
||
| 727 | 727 | * |
| 728 | 728 | * @since 1.7 |
| 729 | 729 | */ |
| 730 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 730 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 733 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 734 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * Renders the credit card info form. |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | * |
| 743 | 743 | * @return void |
| 744 | 744 | */ |
| 745 | -function give_get_cc_form( $form_id ) { |
|
| 745 | +function give_get_cc_form($form_id) { |
|
| 746 | 746 | |
| 747 | 747 | ob_start(); |
| 748 | 748 | |
@@ -753,53 +753,53 @@ discard block |
||
| 753 | 753 | * |
| 754 | 754 | * @param int $form_id The form ID. |
| 755 | 755 | */ |
| 756 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 756 | + do_action('give_before_cc_fields', $form_id); |
|
| 757 | 757 | ?> |
| 758 | 758 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 759 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 760 | - <?php if ( is_ssl() ) : ?> |
|
| 759 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 760 | + <?php if (is_ssl()) : ?> |
|
| 761 | 761 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 762 | 762 | <span class="give-icon padlock"></span> |
| 763 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 763 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 764 | 764 | </div> |
| 765 | 765 | <?php endif; ?> |
| 766 | 766 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 767 | 767 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 768 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 768 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 769 | 769 | <span class="give-required-indicator">*</span> |
| 770 | 770 | <span class="give-tooltip give-icon give-icon-question" |
| 771 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 771 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 772 | 772 | <span class="card-type"></span> |
| 773 | 773 | </label> |
| 774 | 774 | |
| 775 | 775 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 776 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 776 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 777 | 777 | required aria-required="true"/> |
| 778 | 778 | </p> |
| 779 | 779 | |
| 780 | 780 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
| 781 | 781 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 782 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 782 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 783 | 783 | <span class="give-required-indicator">*</span> |
| 784 | 784 | <span class="give-tooltip give-icon give-icon-question" |
| 785 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 785 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 786 | 786 | </label> |
| 787 | 787 | |
| 788 | 788 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 789 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 789 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 790 | 790 | required aria-required="true"/> |
| 791 | 791 | </p> |
| 792 | 792 | |
| 793 | 793 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 794 | 794 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 795 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 795 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 796 | 796 | <span class="give-required-indicator">*</span> |
| 797 | 797 | <span class="give-tooltip give-icon give-icon-question" |
| 798 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 798 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 799 | 799 | </label> |
| 800 | 800 | |
| 801 | 801 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 802 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 802 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 803 | 803 | required aria-required="true"/> |
| 804 | 804 | </p> |
| 805 | 805 | <?php |
@@ -810,14 +810,14 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @param int $form_id The form ID. |
| 812 | 812 | */ |
| 813 | - do_action( 'give_before_cc_expiration' ); |
|
| 813 | + do_action('give_before_cc_expiration'); |
|
| 814 | 814 | ?> |
| 815 | 815 | <p class="card-expiration form-row form-row-one-third"> |
| 816 | 816 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 817 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 817 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 818 | 818 | <span class="give-required-indicator">*</span> |
| 819 | 819 | <span class="give-tooltip give-icon give-icon-question" |
| 820 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 820 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 821 | 821 | </label> |
| 822 | 822 | |
| 823 | 823 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | class="card-expiry-year"/> |
| 827 | 827 | |
| 828 | 828 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 829 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 829 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 830 | 830 | required aria-required="true"/> |
| 831 | 831 | </p> |
| 832 | 832 | <?php |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | * |
| 838 | 838 | * @param int $form_id The form ID. |
| 839 | 839 | */ |
| 840 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 840 | + do_action('give_after_cc_expiration', $form_id); |
|
| 841 | 841 | ?> |
| 842 | 842 | </fieldset> |
| 843 | 843 | <?php |
@@ -848,12 +848,12 @@ discard block |
||
| 848 | 848 | * |
| 849 | 849 | * @param int $form_id The form ID. |
| 850 | 850 | */ |
| 851 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 851 | + do_action('give_after_cc_fields', $form_id); |
|
| 852 | 852 | |
| 853 | 853 | echo ob_get_clean(); |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 856 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 857 | 857 | |
| 858 | 858 | /** |
| 859 | 859 | * Outputs the default credit card address fields. |
@@ -864,24 +864,24 @@ discard block |
||
| 864 | 864 | * |
| 865 | 865 | * @return void |
| 866 | 866 | */ |
| 867 | -function give_default_cc_address_fields( $form_id ) { |
|
| 867 | +function give_default_cc_address_fields($form_id) { |
|
| 868 | 868 | // Get user info. |
| 869 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 869 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 870 | 870 | |
| 871 | 871 | $logged_in = is_user_logged_in(); |
| 872 | 872 | |
| 873 | - if ( $logged_in ) { |
|
| 874 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 873 | + if ($logged_in) { |
|
| 874 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 875 | 875 | } |
| 876 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 877 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 878 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 879 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 876 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 877 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 878 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 879 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 880 | 880 | |
| 881 | 881 | ob_start(); |
| 882 | 882 | ?> |
| 883 | 883 | <fieldset id="give_cc_address" class="cc-address"> |
| 884 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 884 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 885 | 885 | <?php |
| 886 | 886 | /** |
| 887 | 887 | * Fires while rendering credit card billing form, before address fields. |
@@ -890,79 +890,79 @@ discard block |
||
| 890 | 890 | * |
| 891 | 891 | * @param int $form_id The form ID. |
| 892 | 892 | */ |
| 893 | - do_action( 'give_cc_billing_top' ); |
|
| 893 | + do_action('give_cc_billing_top'); |
|
| 894 | 894 | ?> |
| 895 | 895 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
| 896 | 896 | <label for="card_address" class="give-label"> |
| 897 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 897 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 898 | 898 | <?php |
| 899 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 899 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 900 | 900 | <span class="give-required-indicator">*</span> |
| 901 | 901 | <?php endif; ?> |
| 902 | 902 | <span class="give-tooltip give-icon give-icon-question" |
| 903 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 903 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 904 | 904 | </label> |
| 905 | 905 | |
| 906 | 906 | <input |
| 907 | 907 | type="text" |
| 908 | 908 | id="card_address" |
| 909 | 909 | name="card_address" |
| 910 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 911 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 912 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 913 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 910 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 911 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 912 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 913 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 914 | 914 | /> |
| 915 | 915 | </p> |
| 916 | 916 | |
| 917 | 917 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
| 918 | 918 | <label for="card_address_2" class="give-label"> |
| 919 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 920 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 919 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 920 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 921 | 921 | <span class="give-required-indicator">*</span> |
| 922 | 922 | <?php endif; ?> |
| 923 | 923 | <span class="give-tooltip give-icon give-icon-question" |
| 924 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 924 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 925 | 925 | </label> |
| 926 | 926 | |
| 927 | 927 | <input |
| 928 | 928 | type="text" |
| 929 | 929 | id="card_address_2" |
| 930 | 930 | name="card_address_2" |
| 931 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 932 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 933 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 934 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 931 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 932 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 933 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 934 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 935 | 935 | /> |
| 936 | 936 | </p> |
| 937 | 937 | |
| 938 | 938 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
| 939 | 939 | <label for="card_city" class="give-label"> |
| 940 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 941 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 940 | + <?php esc_html_e('City', 'give'); ?> |
|
| 941 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 942 | 942 | <span class="give-required-indicator">*</span> |
| 943 | 943 | <?php endif; ?> |
| 944 | 944 | <span class="give-tooltip give-icon give-icon-question" |
| 945 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 945 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 946 | 946 | </label> |
| 947 | 947 | <input |
| 948 | 948 | type="text" |
| 949 | 949 | id="card_city" |
| 950 | 950 | name="card_city" |
| 951 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 952 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 953 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 954 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 951 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 952 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 953 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 954 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 955 | 955 | /> |
| 956 | 956 | </p> |
| 957 | 957 | |
| 958 | 958 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
| 959 | 959 | <label for="card_zip" class="give-label"> |
| 960 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 961 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 960 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 961 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 962 | 962 | <span class="give-required-indicator">*</span> |
| 963 | 963 | <?php endif; ?> |
| 964 | 964 | <span class="give-tooltip give-icon give-icon-question" |
| 965 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 965 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 966 | 966 | </label> |
| 967 | 967 | |
| 968 | 968 | <input |
@@ -970,40 +970,40 @@ discard block |
||
| 970 | 970 | size="4" |
| 971 | 971 | id="card_zip" |
| 972 | 972 | name="card_zip" |
| 973 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 974 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 975 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 976 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 973 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 974 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 975 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 976 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 977 | 977 | /> |
| 978 | 978 | </p> |
| 979 | 979 | |
| 980 | 980 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
| 981 | 981 | <label for="billing_country" class="give-label"> |
| 982 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 983 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 982 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 983 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 984 | 984 | <span class="give-required-indicator">*</span> |
| 985 | 985 | <?php endif; ?> |
| 986 | 986 | <span class="give-tooltip give-icon give-icon-question" |
| 987 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 987 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 988 | 988 | </label> |
| 989 | 989 | |
| 990 | 990 | <select |
| 991 | 991 | name="billing_country" |
| 992 | 992 | id="billing_country" |
| 993 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 994 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 993 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 994 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 995 | 995 | > |
| 996 | 996 | <?php |
| 997 | 997 | |
| 998 | 998 | $selected_country = give_get_country(); |
| 999 | 999 | |
| 1000 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1000 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1001 | 1001 | $selected_country = $give_user_info['billing_country']; |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | $countries = give_get_country_list(); |
| 1005 | - foreach ( $countries as $country_code => $country ) { |
|
| 1006 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1005 | + foreach ($countries as $country_code => $country) { |
|
| 1006 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | ?> |
| 1009 | 1009 | </select> |
@@ -1011,39 +1011,39 @@ discard block |
||
| 1011 | 1011 | |
| 1012 | 1012 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
| 1013 | 1013 | <label for="card_state" class="give-label"> |
| 1014 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 1015 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
| 1014 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 1015 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
| 1016 | 1016 | <span class="give-required-indicator">*</span> |
| 1017 | 1017 | <?php endif; ?> |
| 1018 | 1018 | <span class="give-tooltip give-icon give-icon-question" |
| 1019 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 1019 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 1020 | 1020 | </label> |
| 1021 | 1021 | |
| 1022 | 1022 | <?php |
| 1023 | 1023 | $selected_state = give_get_state(); |
| 1024 | - $states = give_get_states( $selected_country ); |
|
| 1024 | + $states = give_get_states($selected_country); |
|
| 1025 | 1025 | |
| 1026 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1026 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1027 | 1027 | $selected_state = $give_user_info['card_state']; |
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | - if ( ! empty( $states ) ) : ?> |
|
| 1030 | + if ( ! empty($states)) : ?> |
|
| 1031 | 1031 | <select |
| 1032 | 1032 | name="card_state" |
| 1033 | 1033 | id="card_state" |
| 1034 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1035 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ) { |
|
| 1034 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1035 | + <?php if (give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : '') { |
|
| 1036 | 1036 | ; |
| 1037 | 1037 | } ?>> |
| 1038 | 1038 | <?php |
| 1039 | - foreach ( $states as $state_code => $state ) { |
|
| 1040 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1039 | + foreach ($states as $state_code => $state) { |
|
| 1040 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1041 | 1041 | } |
| 1042 | 1042 | ?> |
| 1043 | 1043 | </select> |
| 1044 | 1044 | <?php else : ?> |
| 1045 | 1045 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1046 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1046 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 1047 | 1047 | <?php endif; ?> |
| 1048 | 1048 | </p> |
| 1049 | 1049 | <?php |
@@ -1054,14 +1054,14 @@ discard block |
||
| 1054 | 1054 | * |
| 1055 | 1055 | * @param int $form_id The form ID. |
| 1056 | 1056 | */ |
| 1057 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1057 | + do_action('give_cc_billing_bottom'); |
|
| 1058 | 1058 | ?> |
| 1059 | 1059 | </fieldset> |
| 1060 | 1060 | <?php |
| 1061 | 1061 | echo ob_get_clean(); |
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1064 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1065 | 1065 | |
| 1066 | 1066 | |
| 1067 | 1067 | /** |
@@ -1073,27 +1073,27 @@ discard block |
||
| 1073 | 1073 | * |
| 1074 | 1074 | * @return string |
| 1075 | 1075 | */ |
| 1076 | -function give_get_register_fields( $form_id ) { |
|
| 1076 | +function give_get_register_fields($form_id) { |
|
| 1077 | 1077 | |
| 1078 | 1078 | global $user_ID; |
| 1079 | 1079 | |
| 1080 | - if ( is_user_logged_in() ) { |
|
| 1081 | - $user_data = get_userdata( $user_ID ); |
|
| 1080 | + if (is_user_logged_in()) { |
|
| 1081 | + $user_data = get_userdata($user_ID); |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1084 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1085 | 1085 | |
| 1086 | 1086 | ob_start(); ?> |
| 1087 | 1087 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1088 | 1088 | |
| 1089 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1089 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1090 | 1090 | <div class="give-login-account-wrap"> |
| 1091 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1092 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1093 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1091 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1092 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1093 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1094 | 1094 | </p> |
| 1095 | 1095 | <p class="give-loading-text"> |
| 1096 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
| 1096 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
| 1097 | 1097 | </div> |
| 1098 | 1098 | <?php } ?> |
| 1099 | 1099 | |
@@ -1105,15 +1105,15 @@ discard block |
||
| 1105 | 1105 | * |
| 1106 | 1106 | * @param int $form_id The form ID. |
| 1107 | 1107 | */ |
| 1108 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1108 | + do_action('give_register_fields_before', $form_id); |
|
| 1109 | 1109 | ?> |
| 1110 | 1110 | |
| 1111 | 1111 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1112 | 1112 | <legend> |
| 1113 | 1113 | <?php |
| 1114 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1115 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1116 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1114 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1115 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1116 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1117 | 1117 | } |
| 1118 | 1118 | ?> |
| 1119 | 1119 | </legend> |
@@ -1125,52 +1125,52 @@ discard block |
||
| 1125 | 1125 | * |
| 1126 | 1126 | * @param int $form_id The form ID. |
| 1127 | 1127 | */ |
| 1128 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1128 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1129 | 1129 | ?> |
| 1130 | 1130 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
| 1131 | 1131 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1132 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1133 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1132 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1133 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1134 | 1134 | <span class="give-required-indicator">*</span> |
| 1135 | 1135 | <?php } ?> |
| 1136 | 1136 | <span class="give-tooltip give-icon give-icon-question" |
| 1137 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1137 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1138 | 1138 | </label> |
| 1139 | 1139 | |
| 1140 | 1140 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1141 | 1141 | type="text" |
| 1142 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1142 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1143 | 1143 | </div> |
| 1144 | 1144 | |
| 1145 | 1145 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
| 1146 | 1146 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1147 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1148 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1147 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1148 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1149 | 1149 | <span class="give-required-indicator">*</span> |
| 1150 | 1150 | <?php } ?> |
| 1151 | 1151 | <span class="give-tooltip give-icon give-icon-question" |
| 1152 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1152 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1153 | 1153 | </label> |
| 1154 | 1154 | |
| 1155 | 1155 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1156 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1157 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1156 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1157 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1158 | 1158 | </div> |
| 1159 | 1159 | |
| 1160 | 1160 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1161 | 1161 | class="give-register-password form-row form-row-one-third"> |
| 1162 | 1162 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1163 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1164 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1163 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1164 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1165 | 1165 | <span class="give-required-indicator">*</span> |
| 1166 | 1166 | <?php } ?> |
| 1167 | 1167 | <span class="give-tooltip give-icon give-icon-question" |
| 1168 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1168 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1169 | 1169 | </label> |
| 1170 | 1170 | |
| 1171 | 1171 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1172 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1173 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1172 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1173 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1174 | 1174 | </div> |
| 1175 | 1175 | <?php |
| 1176 | 1176 | /** |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | * |
| 1181 | 1181 | * @param int $form_id The form ID. |
| 1182 | 1182 | */ |
| 1183 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1183 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1184 | 1184 | ?> |
| 1185 | 1185 | </fieldset> |
| 1186 | 1186 | |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | * |
| 1193 | 1193 | * @param int $form_id The form ID. |
| 1194 | 1194 | */ |
| 1195 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1195 | + do_action('give_register_fields_after', $form_id); |
|
| 1196 | 1196 | ?> |
| 1197 | 1197 | |
| 1198 | 1198 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | * |
| 1204 | 1204 | * @since 1.7 |
| 1205 | 1205 | */ |
| 1206 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1206 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1207 | 1207 | ?> |
| 1208 | 1208 | |
| 1209 | 1209 | </fieldset> |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | echo ob_get_clean(); |
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1214 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1215 | 1215 | |
| 1216 | 1216 | /** |
| 1217 | 1217 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1224,32 +1224,32 @@ discard block |
||
| 1224 | 1224 | * |
| 1225 | 1225 | * @return string |
| 1226 | 1226 | */ |
| 1227 | -function give_get_login_fields( $form_id ) { |
|
| 1227 | +function give_get_login_fields($form_id) { |
|
| 1228 | 1228 | |
| 1229 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1230 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1229 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1230 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1231 | 1231 | |
| 1232 | 1232 | ob_start(); |
| 1233 | 1233 | ?> |
| 1234 | 1234 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1235 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1236 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1237 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1235 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1236 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1237 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1238 | 1238 | } ?> |
| 1239 | 1239 | </legend> |
| 1240 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1240 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1241 | 1241 | <p class="give-new-account-link"> |
| 1242 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1243 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1242 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1243 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1244 | 1244 | data-action="give_checkout_register"> |
| 1245 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1246 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1247 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 1245 | + <?php esc_html_e('Register', 'give'); |
|
| 1246 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1247 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 1248 | 1248 | } ?> |
| 1249 | 1249 | </a> |
| 1250 | 1250 | </p> |
| 1251 | 1251 | <p class="give-loading-text"> |
| 1252 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
| 1252 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
| 1253 | 1253 | <?php } ?> |
| 1254 | 1254 | <?php |
| 1255 | 1255 | /** |
@@ -1259,48 +1259,48 @@ discard block |
||
| 1259 | 1259 | * |
| 1260 | 1260 | * @param int $form_id The form ID. |
| 1261 | 1261 | */ |
| 1262 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1262 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1263 | 1263 | ?> |
| 1264 | 1264 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
| 1265 | 1265 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1266 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1267 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1266 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1267 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1268 | 1268 | <span class="give-required-indicator">*</span> |
| 1269 | 1269 | <?php } ?> |
| 1270 | 1270 | </label> |
| 1271 | 1271 | |
| 1272 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1272 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1273 | 1273 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1274 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1274 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1275 | 1275 | </div> |
| 1276 | 1276 | |
| 1277 | 1277 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
| 1278 | 1278 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1279 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1280 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1279 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1280 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1281 | 1281 | <span class="give-required-indicator">*</span> |
| 1282 | 1282 | <?php } ?> |
| 1283 | 1283 | </label> |
| 1284 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1284 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1285 | 1285 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1286 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1286 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1287 | 1287 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1288 | 1288 | </div> |
| 1289 | 1289 | |
| 1290 | 1290 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1291 | 1291 | <span class="give-forgot-password "> |
| 1292 | 1292 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1293 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1293 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1294 | 1294 | </span> |
| 1295 | 1295 | </div> |
| 1296 | 1296 | |
| 1297 | 1297 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1298 | 1298 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1299 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1300 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1299 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1300 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1301 | 1301 | <input type="button" data-action="give_cancel_login" |
| 1302 | 1302 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1303 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1303 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1304 | 1304 | <?php } ?> |
| 1305 | 1305 | <span class="give-loading-animation"></span> |
| 1306 | 1306 | </div> |
@@ -1312,14 +1312,14 @@ discard block |
||
| 1312 | 1312 | * |
| 1313 | 1313 | * @param int $form_id The form ID. |
| 1314 | 1314 | */ |
| 1315 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1315 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1316 | 1316 | ?> |
| 1317 | 1317 | </fieldset><!--end #give-login-fields--> |
| 1318 | 1318 | <?php |
| 1319 | 1319 | echo ob_get_clean(); |
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1322 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1323 | 1323 | |
| 1324 | 1324 | /** |
| 1325 | 1325 | * Payment Mode Select. |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | * |
| 1336 | 1336 | * @return void |
| 1337 | 1337 | */ |
| 1338 | -function give_payment_mode_select( $form_id ) { |
|
| 1338 | +function give_payment_mode_select($form_id) { |
|
| 1339 | 1339 | |
| 1340 | 1340 | $gateways = give_get_enabled_payment_gateways(); |
| 1341 | 1341 | |
@@ -1346,10 +1346,10 @@ discard block |
||
| 1346 | 1346 | * |
| 1347 | 1347 | * @param int $form_id The form ID. |
| 1348 | 1348 | */ |
| 1349 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1349 | + do_action('give_payment_mode_top', $form_id); |
|
| 1350 | 1350 | ?> |
| 1351 | 1351 | |
| 1352 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1352 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1353 | 1353 | echo 'style="display: none;"'; |
| 1354 | 1354 | } ?>> |
| 1355 | 1355 | <?php |
@@ -1360,14 +1360,14 @@ discard block |
||
| 1360 | 1360 | * |
| 1361 | 1361 | * @param int $form_id The form ID. |
| 1362 | 1362 | */ |
| 1363 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1363 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1364 | 1364 | ?> |
| 1365 | 1365 | <legend |
| 1366 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend> |
|
| 1366 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend> |
|
| 1367 | 1367 | |
| 1368 | 1368 | <div id="give-payment-mode-wrap"> |
| 1369 | 1369 | <span class="give-loading-text"><span |
| 1370 | - class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
| 1370 | + class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
| 1371 | 1371 | |
| 1372 | 1372 | <?php |
| 1373 | 1373 | /** |
@@ -1375,26 +1375,26 @@ discard block |
||
| 1375 | 1375 | * |
| 1376 | 1376 | * @since 1.7 |
| 1377 | 1377 | */ |
| 1378 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1378 | + do_action('give_payment_mode_before_gateways') |
|
| 1379 | 1379 | ?> |
| 1380 | 1380 | <ul id="give-gateway-radio-list"> |
| 1381 | 1381 | <?php |
| 1382 | 1382 | /** |
| 1383 | 1383 | * Loop through the active payment gateways. |
| 1384 | 1384 | */ |
| 1385 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1385 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1386 | 1386 | |
| 1387 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1387 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1388 | 1388 | //Determine the default gateway. |
| 1389 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1389 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1390 | 1390 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; ?> |
| 1391 | 1391 | <li> |
| 1392 | 1392 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1393 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1394 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1395 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1393 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1394 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1395 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1396 | 1396 | class="give-gateway-option<?php echo $checked_class; ?>" |
| 1397 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1397 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1398 | 1398 | </li> |
| 1399 | 1399 | <?php |
| 1400 | 1400 | endforeach; |
@@ -1406,7 +1406,7 @@ discard block |
||
| 1406 | 1406 | * |
| 1407 | 1407 | * @since 1.7 |
| 1408 | 1408 | */ |
| 1409 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1409 | + do_action('give_payment_mode_after_gateways'); |
|
| 1410 | 1410 | ?> |
| 1411 | 1411 | </div> |
| 1412 | 1412 | <?php |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | * |
| 1418 | 1418 | * @param int $form_id The form ID. |
| 1419 | 1419 | */ |
| 1420 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1420 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1421 | 1421 | ?> |
| 1422 | 1422 | </fieldset> |
| 1423 | 1423 | |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | * |
| 1430 | 1430 | * @param int $form_id The form ID. |
| 1431 | 1431 | */ |
| 1432 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1432 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1433 | 1433 | ?> |
| 1434 | 1434 | |
| 1435 | 1435 | <div id="give_purchase_form_wrap"> |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | * |
| 1441 | 1441 | * @since 1.7 |
| 1442 | 1442 | */ |
| 1443 | - do_action( 'give_donation_form', $form_id ); |
|
| 1443 | + do_action('give_donation_form', $form_id); |
|
| 1444 | 1444 | ?> |
| 1445 | 1445 | |
| 1446 | 1446 | </div> |
@@ -1451,10 +1451,10 @@ discard block |
||
| 1451 | 1451 | * |
| 1452 | 1452 | * @since 1.7 |
| 1453 | 1453 | */ |
| 1454 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1454 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1457 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1458 | 1458 | |
| 1459 | 1459 | /** |
| 1460 | 1460 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1467,25 +1467,25 @@ discard block |
||
| 1467 | 1467 | * |
| 1468 | 1468 | * @return void|bool |
| 1469 | 1469 | */ |
| 1470 | -function give_terms_agreement( $form_id ) { |
|
| 1471 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1470 | +function give_terms_agreement($form_id) { |
|
| 1471 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1472 | 1472 | |
| 1473 | 1473 | // Bailout if per form and global term and conditions is not setup. |
| 1474 | - if ( 'yes' !== $form_option ) { |
|
| 1474 | + if ('yes' !== $form_option) { |
|
| 1475 | 1475 | return false; |
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1479 | - $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' ); |
|
| 1478 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1479 | + $terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', ''); |
|
| 1480 | 1480 | |
| 1481 | 1481 | // Set term and conditions label and text on basis of per form and global setting. |
| 1482 | 1482 | // $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
| 1483 | 1483 | // $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' ); |
| 1484 | 1484 | |
| 1485 | 1485 | // Bailout: Check if term and conditions text is empty or not. |
| 1486 | - if ( empty( $terms ) ) { |
|
| 1487 | - if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) { |
|
| 1488 | - echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) ); |
|
| 1486 | + if (empty($terms)) { |
|
| 1487 | + if (is_user_logged_in() && current_user_can('manage_options')) { |
|
| 1488 | + echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit')); |
|
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | 1491 | return false; |
@@ -1493,7 +1493,7 @@ discard block |
||
| 1493 | 1493 | |
| 1494 | 1494 | ?> |
| 1495 | 1495 | <fieldset id="give_terms_agreement"> |
| 1496 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1496 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1497 | 1497 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1498 | 1498 | <?php |
| 1499 | 1499 | /** |
@@ -1501,22 +1501,22 @@ discard block |
||
| 1501 | 1501 | * |
| 1502 | 1502 | * @since 1.0 |
| 1503 | 1503 | */ |
| 1504 | - do_action( 'give_before_terms' ); |
|
| 1504 | + do_action('give_before_terms'); |
|
| 1505 | 1505 | |
| 1506 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1506 | + echo wpautop(stripslashes($terms)); |
|
| 1507 | 1507 | /** |
| 1508 | 1508 | * Fires while rendering terms of agreement, after the fields. |
| 1509 | 1509 | * |
| 1510 | 1510 | * @since 1.0 |
| 1511 | 1511 | */ |
| 1512 | - do_action( 'give_after_terms' ); |
|
| 1512 | + do_action('give_after_terms'); |
|
| 1513 | 1513 | ?> |
| 1514 | 1514 | </div> |
| 1515 | 1515 | <div id="give_show_terms"> |
| 1516 | 1516 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1517 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1517 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1518 | 1518 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1519 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1519 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1520 | 1520 | </div> |
| 1521 | 1521 | |
| 1522 | 1522 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" /> |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | <?php |
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1529 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1530 | 1530 | |
| 1531 | 1531 | /** |
| 1532 | 1532 | * Checkout Final Total. |
@@ -1539,29 +1539,29 @@ discard block |
||
| 1539 | 1539 | * |
| 1540 | 1540 | * @return void |
| 1541 | 1541 | */ |
| 1542 | -function give_checkout_final_total( $form_id ) { |
|
| 1542 | +function give_checkout_final_total($form_id) { |
|
| 1543 | 1543 | |
| 1544 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1545 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1544 | + if (isset($_POST['give_total'])) { |
|
| 1545 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1546 | 1546 | } else { |
| 1547 | 1547 | //default total. |
| 1548 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1548 | + $total = give_get_default_form_amount($form_id); |
|
| 1549 | 1549 | } |
| 1550 | 1550 | //Only proceed if give_total available. |
| 1551 | - if ( empty( $total ) ) { |
|
| 1551 | + if (empty($total)) { |
|
| 1552 | 1552 | return; |
| 1553 | 1553 | } |
| 1554 | 1554 | ?> |
| 1555 | 1555 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1556 | 1556 | <span |
| 1557 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1557 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1558 | 1558 | <span class="give-final-total-amount" |
| 1559 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1559 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1560 | 1560 | </p> |
| 1561 | 1561 | <?php |
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1564 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1565 | 1565 | |
| 1566 | 1566 | /** |
| 1567 | 1567 | * Renders the Checkout Submit section. |
@@ -1572,7 +1572,7 @@ discard block |
||
| 1572 | 1572 | * |
| 1573 | 1573 | * @return void |
| 1574 | 1574 | */ |
| 1575 | -function give_checkout_submit( $form_id ) { |
|
| 1575 | +function give_checkout_submit($form_id) { |
|
| 1576 | 1576 | ?> |
| 1577 | 1577 | <fieldset id="give_purchase_submit"> |
| 1578 | 1578 | <?php |
@@ -1581,24 +1581,24 @@ discard block |
||
| 1581 | 1581 | * |
| 1582 | 1582 | * @since 1.7 |
| 1583 | 1583 | */ |
| 1584 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1584 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1585 | 1585 | |
| 1586 | - give_checkout_hidden_fields( $form_id ); |
|
| 1586 | + give_checkout_hidden_fields($form_id); |
|
| 1587 | 1587 | |
| 1588 | - echo give_checkout_button_purchase( $form_id ); |
|
| 1588 | + echo give_checkout_button_purchase($form_id); |
|
| 1589 | 1589 | |
| 1590 | 1590 | /** |
| 1591 | 1591 | * Fire after donation form submit. |
| 1592 | 1592 | * |
| 1593 | 1593 | * @since 1.7 |
| 1594 | 1594 | */ |
| 1595 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1595 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1596 | 1596 | ?> |
| 1597 | 1597 | </fieldset> |
| 1598 | 1598 | <?php |
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1601 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1602 | 1602 | |
| 1603 | 1603 | /** |
| 1604 | 1604 | * Give Checkout Button. |
@@ -1611,10 +1611,10 @@ discard block |
||
| 1611 | 1611 | * |
| 1612 | 1612 | * @return string |
| 1613 | 1613 | */ |
| 1614 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1614 | +function give_checkout_button_purchase($form_id) { |
|
| 1615 | 1615 | |
| 1616 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1617 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1616 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1617 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1618 | 1618 | ob_start(); ?> |
| 1619 | 1619 | <div class="give-submit-button-wrap give-clearfix"> |
| 1620 | 1620 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1622,7 +1622,7 @@ discard block |
||
| 1622 | 1622 | <span class="give-loading-animation"></span> |
| 1623 | 1623 | </div> |
| 1624 | 1624 | <?php |
| 1625 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1625 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1626 | 1626 | } |
| 1627 | 1627 | |
| 1628 | 1628 | /** |
@@ -1636,18 +1636,18 @@ discard block |
||
| 1636 | 1636 | * |
| 1637 | 1637 | * @return void |
| 1638 | 1638 | */ |
| 1639 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1639 | +function give_agree_to_terms_js($form_id) { |
|
| 1640 | 1640 | |
| 1641 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1641 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1642 | 1642 | |
| 1643 | - if ( $form_option === 'yes' ) { |
|
| 1643 | + if ($form_option === 'yes') { |
|
| 1644 | 1644 | ?> |
| 1645 | 1645 | <script type="text/javascript"> |
| 1646 | 1646 | jQuery(document).ready(function ($) { |
| 1647 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1647 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1648 | 1648 | e.preventDefault(); |
| 1649 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1650 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1649 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1650 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1651 | 1651 | return false; |
| 1652 | 1652 | }); |
| 1653 | 1653 | }); |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | } |
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1659 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1660 | 1660 | |
| 1661 | 1661 | /** |
| 1662 | 1662 | * Show Give Goals. |
@@ -1670,17 +1670,17 @@ discard block |
||
| 1670 | 1670 | * |
| 1671 | 1671 | * @return mixed |
| 1672 | 1672 | */ |
| 1673 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1673 | +function give_show_goal_progress($form_id, $args) { |
|
| 1674 | 1674 | |
| 1675 | 1675 | ob_start(); |
| 1676 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1676 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1677 | 1677 | |
| 1678 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1678 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1679 | 1679 | |
| 1680 | 1680 | return true; |
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1683 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1684 | 1684 | |
| 1685 | 1685 | /** |
| 1686 | 1686 | * Adds Actions to Render Form Content. |
@@ -1692,19 +1692,19 @@ discard block |
||
| 1692 | 1692 | * |
| 1693 | 1693 | * @return void |
| 1694 | 1694 | */ |
| 1695 | -function give_form_content( $form_id, $args ) { |
|
| 1695 | +function give_form_content($form_id, $args) { |
|
| 1696 | 1696 | |
| 1697 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1697 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1698 | 1698 | ? $args['show_content'] |
| 1699 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1699 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1700 | 1700 | |
| 1701 | - if ( $show_content !== 'none' ) { |
|
| 1701 | + if ($show_content !== 'none') { |
|
| 1702 | 1702 | //add action according to value. |
| 1703 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1703 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1704 | 1704 | } |
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1707 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1708 | 1708 | |
| 1709 | 1709 | /** |
| 1710 | 1710 | * Renders Post Form Content. |
@@ -1718,24 +1718,24 @@ discard block |
||
| 1718 | 1718 | * |
| 1719 | 1719 | * @return void |
| 1720 | 1720 | */ |
| 1721 | -function give_form_display_content( $form_id, $args ) { |
|
| 1721 | +function give_form_display_content($form_id, $args) { |
|
| 1722 | 1722 | |
| 1723 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1724 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1723 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1724 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1725 | 1725 | ? $args['show_content'] |
| 1726 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1726 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1727 | 1727 | |
| 1728 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
| 1729 | - $content = apply_filters( 'the_content', $content ); |
|
| 1728 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
| 1729 | + $content = apply_filters('the_content', $content); |
|
| 1730 | 1730 | } |
| 1731 | 1731 | |
| 1732 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
| 1732 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
| 1733 | 1733 | |
| 1734 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1734 | + echo apply_filters('give_form_content_output', $output); |
|
| 1735 | 1735 | |
| 1736 | 1736 | //remove action to prevent content output on addition forms on page. |
| 1737 | 1737 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1738 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1738 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | 1741 | /** |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | * |
| 1748 | 1748 | * @return void |
| 1749 | 1749 | */ |
| 1750 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1750 | +function give_checkout_hidden_fields($form_id) { |
|
| 1751 | 1751 | |
| 1752 | 1752 | /** |
| 1753 | 1753 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1756,13 +1756,13 @@ discard block |
||
| 1756 | 1756 | * |
| 1757 | 1757 | * @param int $form_id The form ID. |
| 1758 | 1758 | */ |
| 1759 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1759 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1760 | 1760 | |
| 1761 | - if ( is_user_logged_in() ) { ?> |
|
| 1761 | + if (is_user_logged_in()) { ?> |
|
| 1762 | 1762 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1763 | 1763 | <?php } ?> |
| 1764 | 1764 | <input type="hidden" name="give_action" value="purchase"/> |
| 1765 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1765 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1766 | 1766 | <?php |
| 1767 | 1767 | /** |
| 1768 | 1768 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1771,7 +1771,7 @@ discard block |
||
| 1771 | 1771 | * |
| 1772 | 1772 | * @param int $form_id The form ID. |
| 1773 | 1773 | */ |
| 1774 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1774 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1775 | 1775 | |
| 1776 | 1776 | } |
| 1777 | 1777 | |
@@ -1786,20 +1786,20 @@ discard block |
||
| 1786 | 1786 | * |
| 1787 | 1787 | * @return string $content Filtered content. |
| 1788 | 1788 | */ |
| 1789 | -function give_filter_success_page_content( $content ) { |
|
| 1789 | +function give_filter_success_page_content($content) { |
|
| 1790 | 1790 | |
| 1791 | 1791 | $give_options = give_get_settings(); |
| 1792 | 1792 | |
| 1793 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1794 | - if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1795 | - $content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1793 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1794 | + if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1795 | + $content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1796 | 1796 | } |
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | return $content; |
| 1800 | 1800 | } |
| 1801 | 1801 | |
| 1802 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1802 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1803 | 1803 | |
| 1804 | 1804 | /** |
| 1805 | 1805 | * Test Mode Frontend Warning. |
@@ -1810,12 +1810,12 @@ discard block |
||
| 1810 | 1810 | */ |
| 1811 | 1811 | function give_test_mode_frontend_warning() { |
| 1812 | 1812 | |
| 1813 | - if ( give_is_test_mode() ) { |
|
| 1814 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 1813 | + if (give_is_test_mode()) { |
|
| 1814 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 1815 | 1815 | } |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1818 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1819 | 1819 | |
| 1820 | 1820 | /** |
| 1821 | 1821 | * Members-only Form. |
@@ -1829,21 +1829,21 @@ discard block |
||
| 1829 | 1829 | * |
| 1830 | 1830 | * @return string |
| 1831 | 1831 | */ |
| 1832 | -function give_members_only_form( $final_output, $args ) { |
|
| 1832 | +function give_members_only_form($final_output, $args) { |
|
| 1833 | 1833 | |
| 1834 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1834 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1835 | 1835 | |
| 1836 | 1836 | //Sanity Check: Must have form_id & not be logged in. |
| 1837 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1837 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1838 | 1838 | return $final_output; |
| 1839 | 1839 | } |
| 1840 | 1840 | |
| 1841 | 1841 | //Logged in only and Register / Login set to none. |
| 1842 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1842 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1843 | 1843 | |
| 1844 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1844 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1845 | 1845 | |
| 1846 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1846 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1847 | 1847 | |
| 1848 | 1848 | } |
| 1849 | 1849 | |
@@ -1851,4 +1851,4 @@ discard block |
||
| 1851 | 1851 | |
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1854 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|