@@ -781,8 +781,11 @@ |
||
| 781 | 781 | } |
| 782 | 782 | ?> |
| 783 | 783 | </select> |
| 784 | - <?php else : ?> |
|
| 785 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 784 | + <?php else { |
|
| 785 | + : ?> |
|
| 786 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
| 787 | +} |
|
| 788 | +?>"/> |
|
| 786 | 789 | <?php endif; ?> |
| 787 | 790 | </p> |
| 788 | 791 | <?php do_action( 'give_cc_billing_bottom' ); ?> |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param array $args An array of form arguments. |
| 23 | 23 | * |
| 24 | - * @return string Donation form. |
|
| 24 | + * @return false|null Donation form. |
|
| 25 | 25 | */ |
| 26 | 26 | function give_get_donation_form( $args = array() ) { |
| 27 | 27 | |
@@ -1577,7 +1577,7 @@ discard block |
||
| 1577 | 1577 | * @param int $form_id The form ID. |
| 1578 | 1578 | * @param array $args An array of form arguments. |
| 1579 | 1579 | * |
| 1580 | - * @return mixed |
|
| 1580 | + * @return boolean |
|
| 1581 | 1581 | */ |
| 1582 | 1582 | function give_show_goal_progress( $form_id, $args ) { |
| 1583 | 1583 | |
@@ -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 = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
| 58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
| 58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //Get the form wrap CSS classes. |
| 63 | - $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 64 | 64 | |
| 65 | 65 | //Get the <form> tag wrap CSS classes. |
| 66 | - $form_classes = $form->get_form_classes($args); |
|
| 66 | + $form_classes = $form->get_form_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | ob_start(); |
| 69 | 69 | |
@@ -75,25 +75,25 @@ 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 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 96 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | * @param int $form_id The form ID. |
| 106 | 106 | * @param array $args An array of form arguments. |
| 107 | 107 | */ |
| 108 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 108 | + do_action('give_pre_form', $form->ID, $args); |
|
| 109 | 109 | ?> |
| 110 | 110 | |
| 111 | 111 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
| 112 | 112 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 113 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 114 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 115 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 116 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 113 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 114 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 115 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 116 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 117 | 117 | |
| 118 | 118 | <!-- The following field is for robots only, invisible to humans: --> |
| 119 | 119 | <span class="give-hidden" style="display: none !important;"> |
@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | <?php |
| 125 | 125 | |
| 126 | 126 | //Price ID hidden field for variable (mult-level) donation forms |
| 127 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 127 | + if (give_has_variable_prices($form_id)) { |
|
| 128 | 128 | //get default selected price ID |
| 129 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 129 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 130 | 130 | $price_id = 0; |
| 131 | 131 | //loop through prices |
| 132 | - foreach ( $prices as $price ) { |
|
| 133 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 132 | + foreach ($prices as $price) { |
|
| 133 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 134 | 134 | $price_id = $price['_give_id']['level_id']; |
| 135 | 135 | }; |
| 136 | 136 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param int $form_id The form ID. |
| 147 | 147 | * @param array $args An array of form arguments. |
| 148 | 148 | */ |
| 149 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 149 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Fires while outputing donation form, for payment gatways fields. |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param int $form_id The form ID. |
| 157 | 157 | * @param array $args An array of form arguments. |
| 158 | 158 | */ |
| 159 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 159 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * Fires while outputing donation form, after all other fields. |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param int $form_id The form ID. |
| 167 | 167 | * @param array $args An array of form arguments. |
| 168 | 168 | */ |
| 169 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 169 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 170 | 170 | |
| 171 | 171 | ?> |
| 172 | 172 | </form> |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | * @param int $form_id The form ID. |
| 181 | 181 | * @param array $args An array of form arguments. |
| 182 | 182 | */ |
| 183 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 183 | + do_action('give_post_form', $form->ID, $args); |
|
| 184 | 184 | |
| 185 | 185 | } |
| 186 | 186 | ?> |
| 187 | 187 | |
| 188 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 188 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 189 | 189 | <?php |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | * @param int $form_id The form ID. |
| 197 | 197 | * @param array $args An array of form arguments. |
| 198 | 198 | */ |
| 199 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 199 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 200 | 200 | |
| 201 | 201 | $final_output = ob_get_clean(); |
| 202 | 202 | |
| 203 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 203 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return string |
| 219 | 219 | */ |
| 220 | -function give_show_purchase_form( $form_id ) { |
|
| 220 | +function give_show_purchase_form($form_id) { |
|
| 221 | 221 | |
| 222 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 222 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 223 | 223 | |
| 224 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 224 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 225 | 225 | $form_id = $_POST['give_form_id']; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @param int $form_id The form ID. |
| 234 | 234 | */ |
| 235 | - do_action( 'give_purchase_form_top', $form_id ); |
|
| 235 | + do_action('give_purchase_form_top', $form_id); |
|
| 236 | 236 | |
| 237 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 237 | + if (give_can_checkout() && isset($form_id)) { |
|
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Fires while displaying donation form, before registeration login login. |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @param int $form_id The form ID. |
| 245 | 245 | */ |
| 246 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
| 246 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * Fires while displaying donation form, registeration login fields. |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @param int $form_id The form ID. |
| 254 | 254 | */ |
| 255 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
| 255 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | 258 | * Fires while displaying donation form, before credit card form fields. |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | * |
| 262 | 262 | * @param int $form_id The form ID. |
| 263 | 263 | */ |
| 264 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
| 264 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
| 265 | 265 | |
| 266 | 266 | // Load the credit card form and allow gateways to load their own if they wish |
| 267 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 267 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 268 | 268 | /** |
| 269 | 269 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 270 | 270 | * |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @param int $form_id The form ID. |
| 274 | 274 | */ |
| 275 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 275 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 276 | 276 | } else { |
| 277 | 277 | /** |
| 278 | 278 | * Fires while displaying donation form, credit card form fields. |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @param int $form_id The form ID. |
| 283 | 283 | */ |
| 284 | - do_action( 'give_cc_form', $form_id ); |
|
| 284 | + do_action('give_cc_form', $form_id); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * |
| 292 | 292 | * @param int $form_id The form ID. |
| 293 | 293 | */ |
| 294 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
| 294 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
| 295 | 295 | |
| 296 | 296 | } else { |
| 297 | 297 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * |
| 302 | 302 | * @param int $form_id The form ID. |
| 303 | 303 | */ |
| 304 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
| 304 | + do_action('give_purchase_form_no_access', $form_id); |
|
| 305 | 305 | |
| 306 | 306 | } |
| 307 | 307 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @param int $form_id The form ID. |
| 314 | 314 | */ |
| 315 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
| 315 | + do_action('give_purchase_form_bottom', $form_id); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
| 318 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return void |
| 328 | 328 | */ |
| 329 | -function give_show_register_login_fields( $form_id ) { |
|
| 329 | +function give_show_register_login_fields($form_id) { |
|
| 330 | 330 | |
| 331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 331 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 332 | 332 | |
| 333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 334 | 334 | ?> |
| 335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 336 | 336 | <?php |
@@ -341,11 +341,11 @@ discard block |
||
| 341 | 341 | * |
| 342 | 342 | * @param int $form_id The form ID. |
| 343 | 343 | */ |
| 344 | - do_action( 'give_purchase_form_register_fields', $form_id ); |
|
| 344 | + do_action('give_purchase_form_register_fields', $form_id); |
|
| 345 | 345 | ?> |
| 346 | 346 | </div> |
| 347 | 347 | <?php |
| 348 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 348 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 349 | 349 | ?> |
| 350 | 350 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 351 | 351 | <?php |
@@ -356,13 +356,13 @@ discard block |
||
| 356 | 356 | * |
| 357 | 357 | * @param int $form_id The form ID. |
| 358 | 358 | */ |
| 359 | - do_action( 'give_purchase_form_login_fields', $form_id ); |
|
| 359 | + do_action('give_purchase_form_login_fields', $form_id); |
|
| 360 | 360 | ?> |
| 361 | 361 | </div> |
| 362 | 362 | <?php |
| 363 | 363 | endif; |
| 364 | 364 | |
| 365 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 365 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 366 | 366 | /** |
| 367 | 367 | * Fires while displaying donation form, after login/registration. |
| 368 | 368 | * |
@@ -370,11 +370,11 @@ discard block |
||
| 370 | 370 | * |
| 371 | 371 | * @param int $form_id The form ID. |
| 372 | 372 | */ |
| 373 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
| 373 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 377 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Donation Amount Field. |
@@ -388,17 +388,17 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @return void |
| 390 | 390 | */ |
| 391 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 391 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 392 | 392 | |
| 393 | 393 | global $give_options; |
| 394 | 394 | |
| 395 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 396 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 397 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 398 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 399 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 400 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 401 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 395 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 396 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 397 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 398 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 399 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 400 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 401 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | 404 | * Fires while displaying donation form, before donation level fields. |
@@ -408,19 +408,19 @@ discard block |
||
| 408 | 408 | * @param int $form_id The form ID. |
| 409 | 409 | * @param array $args An array of form arguments. |
| 410 | 410 | */ |
| 411 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 411 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 412 | 412 | |
| 413 | 413 | //Set Price, No Custom Amount Allowed means hidden price field |
| 414 | - if ( $allow_custom_amount == 'no' ) { |
|
| 414 | + if ($allow_custom_amount == 'no') { |
|
| 415 | 415 | ?> |
| 416 | - <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
| 416 | + <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
| 417 | 417 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required> |
| 418 | 418 | <div class="set-price give-donation-amount form-row-wide"> |
| 419 | - <?php if ( $currency_position == 'before' ) { |
|
| 419 | + <?php if ($currency_position == 'before') { |
|
| 420 | 420 | echo $currency_output; |
| 421 | 421 | } ?> |
| 422 | 422 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 423 | - <?php if ( $currency_position == 'after' ) { |
|
| 423 | + <?php if ($currency_position == 'after') { |
|
| 424 | 424 | echo $currency_output; |
| 425 | 425 | } ?> |
| 426 | 426 | </div> |
@@ -430,12 +430,12 @@ discard block |
||
| 430 | 430 | ?> |
| 431 | 431 | <div class="give-total-wrap"> |
| 432 | 432 | <div class="give-donation-amount form-row-wide"> |
| 433 | - <?php if ( $currency_position == 'before' ) { |
|
| 433 | + <?php if ($currency_position == 'before') { |
|
| 434 | 434 | echo $currency_output; |
| 435 | 435 | } ?> |
| 436 | - <label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
| 436 | + <label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
| 437 | 437 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 438 | - <?php if ( $currency_position == 'after' ) { |
|
| 438 | + <?php if ($currency_position == 'after') { |
|
| 439 | 439 | echo $currency_output; |
| 440 | 440 | } ?> |
| 441 | 441 | </div> |
@@ -450,16 +450,16 @@ discard block |
||
| 450 | 450 | * @param int $form_id The form ID. |
| 451 | 451 | * @param array $args An array of form arguments. |
| 452 | 452 | */ |
| 453 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 453 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 454 | 454 | |
| 455 | 455 | //Custom Amount Text |
| 456 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
| 456 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
| 457 | 457 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 458 | 458 | <?php } |
| 459 | 459 | |
| 460 | 460 | //Output Variable Pricing Levels |
| 461 | - if ( $variable_pricing ) { |
|
| 462 | - give_output_levels( $form_id ); |
|
| 461 | + if ($variable_pricing) { |
|
| 462 | + give_output_levels($form_id); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | * @param int $form_id The form ID. |
| 471 | 471 | * @param array $args An array of form arguments. |
| 472 | 472 | */ |
| 473 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 473 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 476 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 477 | 477 | |
| 478 | 478 | /** |
| 479 | 479 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -484,32 +484,32 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @return string Donation levels. |
| 486 | 486 | */ |
| 487 | -function give_output_levels( $form_id ) { |
|
| 487 | +function give_output_levels($form_id) { |
|
| 488 | 488 | |
| 489 | 489 | //Get variable pricing |
| 490 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 491 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 492 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 493 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 494 | - if ( empty( $custom_amount_text ) ) { |
|
| 495 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 490 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 491 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 492 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 493 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 494 | + if (empty($custom_amount_text)) { |
|
| 495 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | $output = ''; |
| 499 | 499 | $counter = 0; |
| 500 | 500 | |
| 501 | - switch ( $display_style ) { |
|
| 501 | + switch ($display_style) { |
|
| 502 | 502 | case 'buttons': |
| 503 | 503 | |
| 504 | 504 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 505 | 505 | |
| 506 | - foreach ( $prices as $price ) { |
|
| 507 | - $counter ++; |
|
| 508 | - $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 ); |
|
| 509 | - $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 ); |
|
| 506 | + foreach ($prices as $price) { |
|
| 507 | + $counter++; |
|
| 508 | + $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); |
|
| 509 | + $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); |
|
| 510 | 510 | |
| 511 | 511 | $output .= '<li>'; |
| 512 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 512 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 513 | 513 | $output .= $level_text; |
| 514 | 514 | $output .= '</button>'; |
| 515 | 515 | $output .= '</li>'; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | //Custom Amount |
| 520 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 520 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 521 | 521 | $output .= '<li>'; |
| 522 | 522 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 523 | 523 | $output .= $custom_amount_text; |
@@ -533,23 +533,23 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 535 | 535 | |
| 536 | - foreach ( $prices as $price ) { |
|
| 537 | - $counter ++; |
|
| 538 | - $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 ); |
|
| 539 | - $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 ); |
|
| 536 | + foreach ($prices as $price) { |
|
| 537 | + $counter++; |
|
| 538 | + $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); |
|
| 539 | + $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); |
|
| 540 | 540 | |
| 541 | 541 | $output .= '<li>'; |
| 542 | - $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'] ) . '">'; |
|
| 543 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 542 | + $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']).'">'; |
|
| 543 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 544 | 544 | $output .= '</li>'; |
| 545 | 545 | |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | //Custom Amount |
| 549 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 549 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 550 | 550 | $output .= '<li>'; |
| 551 | 551 | $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">'; |
| 552 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 552 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 553 | 553 | $output .= '</li>'; |
| 554 | 554 | } |
| 555 | 555 | |
@@ -559,23 +559,23 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | case 'dropdown': |
| 561 | 561 | |
| 562 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 563 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 562 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 563 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 564 | 564 | |
| 565 | 565 | //first loop through prices |
| 566 | - foreach ( $prices as $price ) { |
|
| 567 | - $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 ); |
|
| 568 | - $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 ); |
|
| 566 | + foreach ($prices as $price) { |
|
| 567 | + $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); |
|
| 568 | + $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); |
|
| 569 | 569 | |
| 570 | - $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'] ) . '">'; |
|
| 570 | + $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']).'">'; |
|
| 571 | 571 | $output .= $level_text; |
| 572 | 572 | $output .= '</option>'; |
| 573 | 573 | |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | //Custom Amount |
| 577 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 578 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 577 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 578 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | $output .= '</select>'; |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | break; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 586 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
@@ -598,26 +598,26 @@ discard block |
||
| 598 | 598 | * |
| 599 | 599 | * @return string Checkout button. |
| 600 | 600 | */ |
| 601 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 601 | +function give_display_checkout_button($form_id, $args) { |
|
| 602 | 602 | |
| 603 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 603 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 604 | 604 | ? $args['display_style'] |
| 605 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 605 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 606 | 606 | |
| 607 | 607 | //no btn for onpage |
| 608 | - if ( $display_option === 'onpage' ) { |
|
| 608 | + if ($display_option === 'onpage') { |
|
| 609 | 609 | return; |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 613 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 612 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 613 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 614 | 614 | |
| 615 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 615 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 616 | 616 | |
| 617 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 617 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 620 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 621 | 621 | |
| 622 | 622 | /** |
| 623 | 623 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -628,10 +628,10 @@ discard block |
||
| 628 | 628 | * |
| 629 | 629 | * @return void |
| 630 | 630 | */ |
| 631 | -function give_user_info_fields( $form_id ) { |
|
| 631 | +function give_user_info_fields($form_id) { |
|
| 632 | 632 | |
| 633 | - if ( is_user_logged_in() ) : |
|
| 634 | - $user_data = get_userdata( get_current_user_id() ); |
|
| 633 | + if (is_user_logged_in()) : |
|
| 634 | + $user_data = get_userdata(get_current_user_id()); |
|
| 635 | 635 | endif; |
| 636 | 636 | |
| 637 | 637 | /** |
@@ -641,35 +641,35 @@ discard block |
||
| 641 | 641 | * |
| 642 | 642 | * @param int $form_id The form ID. |
| 643 | 643 | */ |
| 644 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
| 644 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
| 645 | 645 | ?> |
| 646 | 646 | <fieldset id="give_checkout_user_info"> |
| 647 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 647 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 648 | 648 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
| 649 | 649 | <label class="give-label" for="give-first"> |
| 650 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 651 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
| 650 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 651 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
| 652 | 652 | <span class="give-required-indicator">*</span> |
| 653 | 653 | <?php } ?> |
| 654 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 654 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 655 | 655 | </label> |
| 656 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
| 656 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
| 657 | 657 | echo ' required '; |
| 658 | 658 | } ?>/> |
| 659 | 659 | </p> |
| 660 | 660 | |
| 661 | 661 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
| 662 | 662 | <label class="give-label" for="give-last"> |
| 663 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 664 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
| 663 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 664 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
| 665 | 665 | <span class="give-required-indicator">*</span> |
| 666 | 666 | <?php } ?> |
| 667 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 667 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 668 | 668 | </label> |
| 669 | 669 | |
| 670 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 670 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 671 | 671 | echo ' required'; |
| 672 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 672 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 673 | 673 | echo ' required '; |
| 674 | 674 | } ?> /> |
| 675 | 675 | </p> |
@@ -682,18 +682,18 @@ discard block |
||
| 682 | 682 | * |
| 683 | 683 | * @param int $form_id The form ID. |
| 684 | 684 | */ |
| 685 | - do_action( 'give_purchase_form_before_email', $form_id ); |
|
| 685 | + do_action('give_purchase_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 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 693 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 694 | 694 | </label> |
| 695 | 695 | |
| 696 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
| 696 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
| 697 | 697 | echo ' required '; |
| 698 | 698 | } ?>/> |
| 699 | 699 | |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | * |
| 707 | 707 | * @param int $form_id The form ID. |
| 708 | 708 | */ |
| 709 | - do_action( 'give_purchase_form_after_email', $form_id ); |
|
| 709 | + do_action('give_purchase_form_after_email', $form_id); |
|
| 710 | 710 | |
| 711 | 711 | /** |
| 712 | 712 | * Fires while displaying donation form, on user information fields. |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | * |
| 716 | 716 | * @param int $form_id The form ID. |
| 717 | 717 | */ |
| 718 | - do_action( 'give_purchase_form_user_info', $form_id ); |
|
| 718 | + do_action('give_purchase_form_user_info', $form_id); |
|
| 719 | 719 | ?> |
| 720 | 720 | </fieldset> |
| 721 | 721 | <?php |
@@ -726,12 +726,12 @@ discard block |
||
| 726 | 726 | * |
| 727 | 727 | * @param int $form_id The form ID. |
| 728 | 728 | */ |
| 729 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
| 729 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
| 730 | 730 | |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
| 734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 733 | +add_action('give_purchase_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,45 +753,45 @@ 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 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 770 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 771 | 771 | <span class="card-type"></span> |
| 772 | 772 | </label> |
| 773 | 773 | |
| 774 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/> |
|
| 774 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/> |
|
| 775 | 775 | </p> |
| 776 | 776 | |
| 777 | 777 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
| 778 | 778 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 779 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 779 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 780 | 780 | <span class="give-required-indicator">*</span> |
| 781 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 781 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 782 | 782 | </label> |
| 783 | 783 | |
| 784 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" required/> |
|
| 784 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" required/> |
|
| 785 | 785 | </p> |
| 786 | 786 | |
| 787 | 787 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 788 | 788 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 789 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 789 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 790 | 790 | <span class="give-required-indicator">*</span> |
| 791 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 791 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 792 | 792 | </label> |
| 793 | 793 | |
| 794 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/> |
|
| 794 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/> |
|
| 795 | 795 | </p> |
| 796 | 796 | <?php |
| 797 | 797 | /** |
@@ -801,19 +801,19 @@ discard block |
||
| 801 | 801 | * |
| 802 | 802 | * @param int $form_id The form ID. |
| 803 | 803 | */ |
| 804 | - do_action( 'give_before_cc_expiration' ); |
|
| 804 | + do_action('give_before_cc_expiration'); |
|
| 805 | 805 | ?> |
| 806 | 806 | <p class="card-expiration form-row form-row-one-third"> |
| 807 | 807 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 808 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 808 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 809 | 809 | <span class="give-required-indicator">*</span> |
| 810 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 810 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 811 | 811 | </label> |
| 812 | 812 | |
| 813 | 813 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
| 814 | 814 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
| 815 | 815 | |
| 816 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/> |
|
| 816 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/> |
|
| 817 | 817 | </p> |
| 818 | 818 | <?php |
| 819 | 819 | /** |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | * |
| 824 | 824 | * @param int $form_id The form ID. |
| 825 | 825 | */ |
| 826 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 826 | + do_action('give_after_cc_expiration', $form_id); |
|
| 827 | 827 | ?> |
| 828 | 828 | </fieldset> |
| 829 | 829 | <?php |
@@ -834,12 +834,12 @@ discard block |
||
| 834 | 834 | * |
| 835 | 835 | * @param int $form_id The form ID. |
| 836 | 836 | */ |
| 837 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 837 | + do_action('give_after_cc_fields', $form_id); |
|
| 838 | 838 | |
| 839 | 839 | echo ob_get_clean(); |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 842 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 843 | 843 | |
| 844 | 844 | /** |
| 845 | 845 | * Outputs the default credit card address fields. |
@@ -850,22 +850,22 @@ discard block |
||
| 850 | 850 | * |
| 851 | 851 | * @return void |
| 852 | 852 | */ |
| 853 | -function give_default_cc_address_fields( $form_id ) { |
|
| 853 | +function give_default_cc_address_fields($form_id) { |
|
| 854 | 854 | |
| 855 | 855 | $logged_in = is_user_logged_in(); |
| 856 | 856 | |
| 857 | - if ( $logged_in ) { |
|
| 858 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 857 | + if ($logged_in) { |
|
| 858 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 859 | 859 | } |
| 860 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 861 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 862 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 863 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 860 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 861 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 862 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 863 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 864 | 864 | |
| 865 | 865 | ob_start(); |
| 866 | 866 | ?> |
| 867 | 867 | <fieldset id="give_cc_address" class="cc-address"> |
| 868 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 868 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 869 | 869 | <?php |
| 870 | 870 | /** |
| 871 | 871 | * Fires while rendering credit card billing form, before address fields. |
@@ -874,97 +874,97 @@ discard block |
||
| 874 | 874 | * |
| 875 | 875 | * @param int $form_id The form ID. |
| 876 | 876 | */ |
| 877 | - do_action( 'give_cc_billing_top' ); |
|
| 877 | + do_action('give_cc_billing_top'); |
|
| 878 | 878 | ?> |
| 879 | 879 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
| 880 | 880 | <label for="card_address" class="give-label"> |
| 881 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 881 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 882 | 882 | <?php |
| 883 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
| 883 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
| 884 | 884 | <span class="give-required-indicator">*</span> |
| 885 | 885 | <?php } ?> |
| 886 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 886 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 887 | 887 | </label> |
| 888 | 888 | |
| 889 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 889 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 890 | 890 | echo ' required'; |
| 891 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 891 | + } ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 892 | 892 | echo ' required '; |
| 893 | 893 | } ?>/> |
| 894 | 894 | </p> |
| 895 | 895 | |
| 896 | 896 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
| 897 | 897 | <label for="card_address_2" class="give-label"> |
| 898 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 899 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
| 898 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 899 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
| 900 | 900 | <span class="give-required-indicator">*</span> |
| 901 | 901 | <?php } ?> |
| 902 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 902 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 903 | 903 | </label> |
| 904 | 904 | |
| 905 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 905 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 906 | 906 | echo ' required'; |
| 907 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 907 | + } ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 908 | 908 | echo ' required '; |
| 909 | 909 | } ?>/> |
| 910 | 910 | </p> |
| 911 | 911 | |
| 912 | 912 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
| 913 | 913 | <label for="card_city" class="give-label"> |
| 914 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 915 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
| 914 | + <?php esc_html_e('City', 'give'); ?> |
|
| 915 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
| 916 | 916 | <span class="give-required-indicator">*</span> |
| 917 | 917 | <?php } ?> |
| 918 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 918 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 919 | 919 | </label> |
| 920 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 920 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 921 | 921 | echo ' required'; |
| 922 | - } ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 922 | + } ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 923 | 923 | echo ' required '; |
| 924 | 924 | } ?>/> |
| 925 | 925 | </p> |
| 926 | 926 | |
| 927 | 927 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
| 928 | 928 | <label for="card_zip" class="give-label"> |
| 929 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 930 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
| 929 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 930 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
| 931 | 931 | <span class="give-required-indicator">*</span> |
| 932 | 932 | <?php } ?> |
| 933 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 933 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 934 | 934 | </label> |
| 935 | 935 | |
| 936 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 936 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 937 | 937 | echo ' required'; |
| 938 | - } ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 938 | + } ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 939 | 939 | echo ' required '; |
| 940 | 940 | } ?>/> |
| 941 | 941 | </p> |
| 942 | 942 | |
| 943 | 943 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
| 944 | 944 | <label for="billing_country" class="give-label"> |
| 945 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 946 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
| 945 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 946 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
| 947 | 947 | <span class="give-required-indicator">*</span> |
| 948 | 948 | <?php } ?> |
| 949 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 949 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 950 | 950 | </label> |
| 951 | 951 | |
| 952 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 952 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 953 | 953 | echo ' required'; |
| 954 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 954 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 955 | 955 | echo ' required '; |
| 956 | 956 | } ?>> |
| 957 | 957 | <?php |
| 958 | 958 | |
| 959 | 959 | $selected_country = give_get_country(); |
| 960 | 960 | |
| 961 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
| 961 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
| 962 | 962 | $selected_country = $user_address['country']; |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | $countries = give_get_country_list(); |
| 966 | - foreach ( $countries as $country_code => $country ) { |
|
| 967 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 966 | + foreach ($countries as $country_code => $country) { |
|
| 967 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 968 | 968 | } |
| 969 | 969 | ?> |
| 970 | 970 | </select> |
@@ -972,35 +972,35 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
| 974 | 974 | <label for="card_state" class="give-label"> |
| 975 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 976 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
| 975 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 976 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
| 977 | 977 | <span class="give-required-indicator">*</span> |
| 978 | 978 | <?php } ?> |
| 979 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 979 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 980 | 980 | </label> |
| 981 | 981 | |
| 982 | 982 | <?php |
| 983 | 983 | $selected_state = give_get_state(); |
| 984 | - $states = give_get_states( $selected_country ); |
|
| 984 | + $states = give_get_states($selected_country); |
|
| 985 | 985 | |
| 986 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
| 986 | + if ($logged_in && ! empty($user_address['state'])) { |
|
| 987 | 987 | $selected_state = $user_address['state']; |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | - if ( ! empty( $states ) ) : ?> |
|
| 991 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 990 | + if ( ! empty($states)) : ?> |
|
| 991 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 992 | 992 | echo ' required'; |
| 993 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 993 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 994 | 994 | echo ' required '; |
| 995 | 995 | } ?>> |
| 996 | 996 | <?php |
| 997 | - foreach ( $states as $state_code => $state ) { |
|
| 998 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 997 | + foreach ($states as $state_code => $state) { |
|
| 998 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 999 | 999 | } |
| 1000 | 1000 | ?> |
| 1001 | 1001 | </select> |
| 1002 | 1002 | <?php else : ?> |
| 1003 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1003 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 1004 | 1004 | <?php endif; ?> |
| 1005 | 1005 | </p> |
| 1006 | 1006 | <?php |
@@ -1011,14 +1011,14 @@ discard block |
||
| 1011 | 1011 | * |
| 1012 | 1012 | * @param int $form_id The form ID. |
| 1013 | 1013 | */ |
| 1014 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1014 | + do_action('give_cc_billing_bottom'); |
|
| 1015 | 1015 | ?> |
| 1016 | 1016 | </fieldset> |
| 1017 | 1017 | <?php |
| 1018 | 1018 | echo ob_get_clean(); |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1021 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1022 | 1022 | |
| 1023 | 1023 | |
| 1024 | 1024 | /** |
@@ -1030,26 +1030,26 @@ discard block |
||
| 1030 | 1030 | * |
| 1031 | 1031 | * @return string |
| 1032 | 1032 | */ |
| 1033 | -function give_get_register_fields( $form_id ) { |
|
| 1033 | +function give_get_register_fields($form_id) { |
|
| 1034 | 1034 | |
| 1035 | 1035 | global $user_ID; |
| 1036 | 1036 | |
| 1037 | - if ( is_user_logged_in() ) { |
|
| 1038 | - $user_data = get_userdata( $user_ID ); |
|
| 1037 | + if (is_user_logged_in()) { |
|
| 1038 | + $user_data = get_userdata($user_ID); |
|
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1041 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1042 | 1042 | |
| 1043 | 1043 | ob_start(); ?> |
| 1044 | 1044 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1045 | 1045 | |
| 1046 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1046 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1047 | 1047 | <div class="give-login-account-wrap"> |
| 1048 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1049 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1048 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1049 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1050 | 1050 | </p> |
| 1051 | 1051 | <p class="give-loading-text"> |
| 1052 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
| 1052 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
| 1053 | 1053 | </div> |
| 1054 | 1054 | <?php } ?> |
| 1055 | 1055 | |
@@ -1061,15 +1061,15 @@ discard block |
||
| 1061 | 1061 | * |
| 1062 | 1062 | * @param int $form_id The form ID. |
| 1063 | 1063 | */ |
| 1064 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1064 | + do_action('give_register_fields_before', $form_id); |
|
| 1065 | 1065 | ?> |
| 1066 | 1066 | |
| 1067 | 1067 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1068 | 1068 | <legend> |
| 1069 | 1069 | <?php |
| 1070 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1071 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1072 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1070 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1071 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1072 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1073 | 1073 | } |
| 1074 | 1074 | ?> |
| 1075 | 1075 | </legend> |
@@ -1081,42 +1081,42 @@ discard block |
||
| 1081 | 1081 | * |
| 1082 | 1082 | * @param int $form_id The form ID. |
| 1083 | 1083 | */ |
| 1084 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1084 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1085 | 1085 | ?> |
| 1086 | 1086 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
| 1087 | 1087 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1088 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1089 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1088 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1089 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1090 | 1090 | <span class="give-required-indicator">*</span> |
| 1091 | 1091 | <?php } ?> |
| 1092 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1092 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1093 | 1093 | </label> |
| 1094 | 1094 | |
| 1095 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
| 1095 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
| 1096 | 1096 | </div> |
| 1097 | 1097 | |
| 1098 | 1098 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
| 1099 | 1099 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1100 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1101 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1100 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1101 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1102 | 1102 | <span class="give-required-indicator">*</span> |
| 1103 | 1103 | <?php } ?> |
| 1104 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1104 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1105 | 1105 | </label> |
| 1106 | 1106 | |
| 1107 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
| 1107 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
| 1108 | 1108 | </div> |
| 1109 | 1109 | |
| 1110 | 1110 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
| 1111 | 1111 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1112 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1113 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1112 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1113 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1114 | 1114 | <span class="give-required-indicator">*</span> |
| 1115 | 1115 | <?php } ?> |
| 1116 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1116 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1117 | 1117 | </label> |
| 1118 | 1118 | |
| 1119 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
| 1119 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
| 1120 | 1120 | </div> |
| 1121 | 1121 | <?php |
| 1122 | 1122 | /** |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | * |
| 1127 | 1127 | * @param int $form_id The form ID. |
| 1128 | 1128 | */ |
| 1129 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1129 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1130 | 1130 | ?> |
| 1131 | 1131 | </fieldset> |
| 1132 | 1132 | |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | * |
| 1139 | 1139 | * @param int $form_id The form ID. |
| 1140 | 1140 | */ |
| 1141 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1141 | + do_action('give_register_fields_after', $form_id); |
|
| 1142 | 1142 | ?> |
| 1143 | 1143 | |
| 1144 | 1144 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | * |
| 1152 | 1152 | * @param int $form_id The form ID. |
| 1153 | 1153 | */ |
| 1154 | - do_action( 'give_purchase_form_user_info', $form_id ); |
|
| 1154 | + do_action('give_purchase_form_user_info', $form_id); |
|
| 1155 | 1155 | ?> |
| 1156 | 1156 | |
| 1157 | 1157 | </fieldset> |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | echo ob_get_clean(); |
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
| 1162 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
| 1163 | 1163 | |
| 1164 | 1164 | /** |
| 1165 | 1165 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1172,31 +1172,31 @@ discard block |
||
| 1172 | 1172 | * |
| 1173 | 1173 | * @return string |
| 1174 | 1174 | */ |
| 1175 | -function give_get_login_fields( $form_id ) { |
|
| 1175 | +function give_get_login_fields($form_id) { |
|
| 1176 | 1176 | |
| 1177 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1178 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1177 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1178 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1179 | 1179 | |
| 1180 | 1180 | ob_start(); |
| 1181 | 1181 | ?> |
| 1182 | 1182 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1183 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1184 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1185 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1183 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1184 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1185 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1186 | 1186 | } ?> |
| 1187 | 1187 | </legend> |
| 1188 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1188 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1189 | 1189 | <p class="give-new-account-link"> |
| 1190 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1191 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
| 1192 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1193 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1194 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 1190 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1191 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
| 1192 | + <?php esc_html_e('Register', 'give'); |
|
| 1193 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1194 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 1195 | 1195 | } ?> |
| 1196 | 1196 | </a> |
| 1197 | 1197 | </p> |
| 1198 | 1198 | <p class="give-loading-text"> |
| 1199 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
| 1199 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
| 1200 | 1200 | <?php } ?> |
| 1201 | 1201 | <?php |
| 1202 | 1202 | /** |
@@ -1206,44 +1206,44 @@ discard block |
||
| 1206 | 1206 | * |
| 1207 | 1207 | * @param int $form_id The form ID. |
| 1208 | 1208 | */ |
| 1209 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1209 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1210 | 1210 | ?> |
| 1211 | 1211 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
| 1212 | 1212 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1213 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1214 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1213 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1214 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1215 | 1215 | <span class="give-required-indicator">*</span> |
| 1216 | 1216 | <?php } ?> |
| 1217 | 1217 | </label> |
| 1218 | 1218 | |
| 1219 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 1219 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
| 1220 | 1220 | echo 'required '; |
| 1221 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/> |
|
| 1221 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/> |
|
| 1222 | 1222 | </div> |
| 1223 | 1223 | |
| 1224 | 1224 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
| 1225 | 1225 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1226 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1227 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1226 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1227 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1228 | 1228 | <span class="give-required-indicator">*</span> |
| 1229 | 1229 | <?php } ?> |
| 1230 | 1230 | </label> |
| 1231 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 1231 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
| 1232 | 1232 | echo 'required '; |
| 1233 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/> |
|
| 1233 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/> |
|
| 1234 | 1234 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1235 | 1235 | </div> |
| 1236 | 1236 | |
| 1237 | 1237 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1238 | 1238 | <span class="give-forgot-password "> |
| 1239 | - <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset Password' ) ?></a> |
|
| 1239 | + <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset Password') ?></a> |
|
| 1240 | 1240 | </span> |
| 1241 | 1241 | </div> |
| 1242 | 1242 | |
| 1243 | 1243 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1244 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1245 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1246 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1244 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1245 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1246 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1247 | 1247 | <?php } ?> |
| 1248 | 1248 | <span class="give-loading-animation"></span> |
| 1249 | 1249 | </div> |
@@ -1255,14 +1255,14 @@ discard block |
||
| 1255 | 1255 | * |
| 1256 | 1256 | * @param int $form_id The form ID. |
| 1257 | 1257 | */ |
| 1258 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1258 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1259 | 1259 | ?> |
| 1260 | 1260 | </fieldset><!--end #give-login-fields--> |
| 1261 | 1261 | <?php |
| 1262 | 1262 | echo ob_get_clean(); |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1265 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1266 | 1266 | |
| 1267 | 1267 | /** |
| 1268 | 1268 | * Payment Mode Select. |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | * |
| 1279 | 1279 | * @return void |
| 1280 | 1280 | */ |
| 1281 | -function give_payment_mode_select( $form_id ) { |
|
| 1281 | +function give_payment_mode_select($form_id) { |
|
| 1282 | 1282 | |
| 1283 | 1283 | $gateways = give_get_enabled_payment_gateways(); |
| 1284 | 1284 | |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | * |
| 1290 | 1290 | * @param int $form_id The form ID. |
| 1291 | 1291 | */ |
| 1292 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
| 1292 | + do_action('give_payment_mode_top', $form_id); ?> |
|
| 1293 | 1293 | |
| 1294 | 1294 | <fieldset id="give-payment-mode-select"> |
| 1295 | 1295 | <?php |
@@ -1300,11 +1300,11 @@ discard block |
||
| 1300 | 1300 | * |
| 1301 | 1301 | * @param int $form_id The form ID. |
| 1302 | 1302 | */ |
| 1303 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1303 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1304 | 1304 | ?> |
| 1305 | 1305 | <div id="give-payment-mode-wrap"> |
| 1306 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1307 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
| 1306 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1307 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
| 1308 | 1308 | </legend> |
| 1309 | 1309 | <?php |
| 1310 | 1310 | /** |
@@ -1312,14 +1312,14 @@ discard block |
||
| 1312 | 1312 | * |
| 1313 | 1313 | * @since 1.0 |
| 1314 | 1314 | */ |
| 1315 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1315 | + do_action('give_payment_mode_before_gateways') |
|
| 1316 | 1316 | ?> |
| 1317 | 1317 | <ul id="give-gateway-radio-list"> |
| 1318 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1319 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
| 1318 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
| 1319 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
| 1320 | 1320 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
| 1321 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
| 1322 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
| 1321 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
| 1322 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
| 1323 | 1323 | echo '</label></li>'; |
| 1324 | 1324 | endforeach; ?> |
| 1325 | 1325 | </ul> |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | * |
| 1330 | 1330 | * @since 1.0 |
| 1331 | 1331 | */ |
| 1332 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1332 | + do_action('give_payment_mode_after_gateways'); |
|
| 1333 | 1333 | ?> |
| 1334 | 1334 | </div> |
| 1335 | 1335 | <?php |
@@ -1340,7 +1340,7 @@ discard block |
||
| 1340 | 1340 | * |
| 1341 | 1341 | * @param int $form_id The form ID. |
| 1342 | 1342 | */ |
| 1343 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1343 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1344 | 1344 | ?> |
| 1345 | 1345 | </fieldset> |
| 1346 | 1346 | |
@@ -1352,7 +1352,7 @@ discard block |
||
| 1352 | 1352 | * |
| 1353 | 1353 | * @param int $form_id The form ID. |
| 1354 | 1354 | */ |
| 1355 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1355 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1356 | 1356 | ?> |
| 1357 | 1357 | |
| 1358 | 1358 | <div id="give_purchase_form_wrap"> |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | * |
| 1366 | 1366 | * @param int $form_id The form ID. |
| 1367 | 1367 | */ |
| 1368 | - do_action( 'give_purchase_form', $form_id ); |
|
| 1368 | + do_action('give_purchase_form', $form_id); |
|
| 1369 | 1369 | ?> |
| 1370 | 1370 | |
| 1371 | 1371 | </div> |
@@ -1378,11 +1378,11 @@ discard block |
||
| 1378 | 1378 | * |
| 1379 | 1379 | * @param int $form_id The form ID. |
| 1380 | 1380 | */ |
| 1381 | - do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
| 1381 | + do_action('give_purchase_form_wrap_bottom', $form_id); |
|
| 1382 | 1382 | |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1385 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1386 | 1386 | |
| 1387 | 1387 | /** |
| 1388 | 1388 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1395,46 +1395,46 @@ discard block |
||
| 1395 | 1395 | * |
| 1396 | 1396 | * @return void |
| 1397 | 1397 | */ |
| 1398 | -function give_terms_agreement( $form_id ) { |
|
| 1398 | +function give_terms_agreement($form_id) { |
|
| 1399 | 1399 | |
| 1400 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1401 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
| 1402 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1400 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1401 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
| 1402 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1403 | 1403 | |
| 1404 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
| 1404 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
| 1405 | 1405 | <fieldset id="give_terms_agreement"> |
| 1406 | - <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
| 1406 | + <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
| 1407 | 1407 | <?php |
| 1408 | 1408 | /** |
| 1409 | 1409 | * Fires while rendering terms of agreement, before the fields. |
| 1410 | 1410 | * |
| 1411 | 1411 | * @since 1.0 |
| 1412 | 1412 | */ |
| 1413 | - do_action( 'give_before_terms' ); |
|
| 1413 | + do_action('give_before_terms'); |
|
| 1414 | 1414 | |
| 1415 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1415 | + echo wpautop(stripslashes($terms)); |
|
| 1416 | 1416 | /** |
| 1417 | 1417 | * Fires while rendering terms of agreement, after the fields. |
| 1418 | 1418 | * |
| 1419 | 1419 | * @since 1.0 |
| 1420 | 1420 | */ |
| 1421 | - do_action( 'give_after_terms' ); |
|
| 1421 | + do_action('give_after_terms'); |
|
| 1422 | 1422 | ?> |
| 1423 | 1423 | </div> |
| 1424 | 1424 | <div id="give_show_terms"> |
| 1425 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1426 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1425 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1426 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1427 | 1427 | </div> |
| 1428 | 1428 | |
| 1429 | 1429 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
| 1430 | - <label for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label> |
|
| 1430 | + <label for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label> |
|
| 1431 | 1431 | |
| 1432 | 1432 | </fieldset> |
| 1433 | 1433 | <?php |
| 1434 | 1434 | } |
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
| 1437 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
| 1438 | 1438 | |
| 1439 | 1439 | /** |
| 1440 | 1440 | * Checkout Final Total. |
@@ -1447,27 +1447,27 @@ discard block |
||
| 1447 | 1447 | * |
| 1448 | 1448 | * @return void |
| 1449 | 1449 | */ |
| 1450 | -function give_checkout_final_total( $form_id ) { |
|
| 1450 | +function give_checkout_final_total($form_id) { |
|
| 1451 | 1451 | |
| 1452 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1453 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1452 | + if (isset($_POST['give_total'])) { |
|
| 1453 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1454 | 1454 | } else { |
| 1455 | 1455 | //default total |
| 1456 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1456 | + $total = give_get_default_form_amount($form_id); |
|
| 1457 | 1457 | } |
| 1458 | 1458 | //Only proceed if give_total available |
| 1459 | - if ( empty( $total ) ) { |
|
| 1459 | + if (empty($total)) { |
|
| 1460 | 1460 | return; |
| 1461 | 1461 | } |
| 1462 | 1462 | ?> |
| 1463 | 1463 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1464 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1465 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1464 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1465 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1466 | 1466 | </p> |
| 1467 | 1467 | <?php |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1470 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1471 | 1471 | |
| 1472 | 1472 | /** |
| 1473 | 1473 | * Renders the Checkout Submit section. |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | * |
| 1479 | 1479 | * @return void |
| 1480 | 1480 | */ |
| 1481 | -function give_checkout_submit( $form_id ) { |
|
| 1481 | +function give_checkout_submit($form_id) { |
|
| 1482 | 1482 | ?> |
| 1483 | 1483 | <fieldset id="give_purchase_submit"> |
| 1484 | 1484 | <?php |
@@ -1489,11 +1489,11 @@ discard block |
||
| 1489 | 1489 | * |
| 1490 | 1490 | * @param int $form_id The form ID. |
| 1491 | 1491 | */ |
| 1492 | - do_action( 'give_purchase_form_before_submit', $form_id ); |
|
| 1492 | + do_action('give_purchase_form_before_submit', $form_id); |
|
| 1493 | 1493 | |
| 1494 | - give_checkout_hidden_fields( $form_id ); |
|
| 1494 | + give_checkout_hidden_fields($form_id); |
|
| 1495 | 1495 | |
| 1496 | - echo give_checkout_button_purchase( $form_id ); |
|
| 1496 | + echo give_checkout_button_purchase($form_id); |
|
| 1497 | 1497 | |
| 1498 | 1498 | /** |
| 1499 | 1499 | * Fires while rendering checkout submit, after the fields. |
@@ -1502,13 +1502,13 @@ discard block |
||
| 1502 | 1502 | * |
| 1503 | 1503 | * @param int $form_id The form ID. |
| 1504 | 1504 | */ |
| 1505 | - do_action( 'give_purchase_form_after_submit', $form_id ); |
|
| 1505 | + do_action('give_purchase_form_after_submit', $form_id); |
|
| 1506 | 1506 | ?> |
| 1507 | 1507 | </fieldset> |
| 1508 | 1508 | <?php |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1511 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1512 | 1512 | |
| 1513 | 1513 | /** |
| 1514 | 1514 | * Give Checkout Button. |
@@ -1521,17 +1521,17 @@ discard block |
||
| 1521 | 1521 | * |
| 1522 | 1522 | * @return string |
| 1523 | 1523 | */ |
| 1524 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1524 | +function give_checkout_button_purchase($form_id) { |
|
| 1525 | 1525 | |
| 1526 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1527 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1526 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1527 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1528 | 1528 | ob_start(); ?> |
| 1529 | 1529 | <div class="give-submit-button-wrap give-clearfix"> |
| 1530 | 1530 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
| 1531 | 1531 | <span class="give-loading-animation"></span> |
| 1532 | 1532 | </div> |
| 1533 | 1533 | <?php |
| 1534 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1534 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | 1537 | /** |
@@ -1545,18 +1545,18 @@ discard block |
||
| 1545 | 1545 | * |
| 1546 | 1546 | * @return void |
| 1547 | 1547 | */ |
| 1548 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1548 | +function give_agree_to_terms_js($form_id) { |
|
| 1549 | 1549 | |
| 1550 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1550 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1551 | 1551 | |
| 1552 | - if ( $form_option === 'yes' ) { |
|
| 1552 | + if ($form_option === 'yes') { |
|
| 1553 | 1553 | ?> |
| 1554 | 1554 | <script type="text/javascript"> |
| 1555 | 1555 | jQuery(document).ready(function ($) { |
| 1556 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1556 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1557 | 1557 | e.preventDefault(); |
| 1558 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1559 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1558 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1559 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1560 | 1560 | return false; |
| 1561 | 1561 | }); |
| 1562 | 1562 | }); |
@@ -1565,7 +1565,7 @@ discard block |
||
| 1565 | 1565 | } |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1568 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1569 | 1569 | |
| 1570 | 1570 | /** |
| 1571 | 1571 | * Show Give Goals. |
@@ -1579,17 +1579,17 @@ discard block |
||
| 1579 | 1579 | * |
| 1580 | 1580 | * @return mixed |
| 1581 | 1581 | */ |
| 1582 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1582 | +function give_show_goal_progress($form_id, $args) { |
|
| 1583 | 1583 | |
| 1584 | 1584 | ob_start(); |
| 1585 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1585 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1586 | 1586 | |
| 1587 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1587 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1588 | 1588 | |
| 1589 | 1589 | return true; |
| 1590 | 1590 | } |
| 1591 | 1591 | |
| 1592 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1592 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1593 | 1593 | |
| 1594 | 1594 | /** |
| 1595 | 1595 | * Adds Actions to Render Form Content. |
@@ -1601,19 +1601,19 @@ discard block |
||
| 1601 | 1601 | * |
| 1602 | 1602 | * @return void |
| 1603 | 1603 | */ |
| 1604 | -function give_form_content( $form_id, $args ) { |
|
| 1604 | +function give_form_content($form_id, $args) { |
|
| 1605 | 1605 | |
| 1606 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1606 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1607 | 1607 | ? $args['show_content'] |
| 1608 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1608 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1609 | 1609 | |
| 1610 | - if ( $show_content !== 'none' ) { |
|
| 1610 | + if ($show_content !== 'none') { |
|
| 1611 | 1611 | //add action according to value |
| 1612 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1612 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1613 | 1613 | } |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1616 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1617 | 1617 | |
| 1618 | 1618 | /** |
| 1619 | 1619 | * Renders Post Form Content. |
@@ -1627,24 +1627,24 @@ discard block |
||
| 1627 | 1627 | * |
| 1628 | 1628 | * @return void |
| 1629 | 1629 | */ |
| 1630 | -function give_form_display_content( $form_id, $args ) { |
|
| 1630 | +function give_form_display_content($form_id, $args) { |
|
| 1631 | 1631 | |
| 1632 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1633 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1632 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1633 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1634 | 1634 | ? $args['show_content'] |
| 1635 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1635 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1636 | 1636 | |
| 1637 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
| 1638 | - $content = apply_filters( 'the_content', $content ); |
|
| 1637 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
| 1638 | + $content = apply_filters('the_content', $content); |
|
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
| 1641 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
| 1642 | 1642 | |
| 1643 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1643 | + echo apply_filters('give_form_content_output', $output); |
|
| 1644 | 1644 | |
| 1645 | 1645 | //remove action to prevent content output on addition forms on page |
| 1646 | 1646 | //@see: https://github.com/WordImpress/Give/issues/634 |
| 1647 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1647 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | /** |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | * |
| 1657 | 1657 | * @return void |
| 1658 | 1658 | */ |
| 1659 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1659 | +function give_checkout_hidden_fields($form_id) { |
|
| 1660 | 1660 | |
| 1661 | 1661 | /** |
| 1662 | 1662 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1665,13 +1665,13 @@ discard block |
||
| 1665 | 1665 | * |
| 1666 | 1666 | * @param int $form_id The form ID. |
| 1667 | 1667 | */ |
| 1668 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1668 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1669 | 1669 | |
| 1670 | - if ( is_user_logged_in() ) { ?> |
|
| 1670 | + if (is_user_logged_in()) { ?> |
|
| 1671 | 1671 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1672 | 1672 | <?php } ?> |
| 1673 | 1673 | <input type="hidden" name="give_action" value="purchase"/> |
| 1674 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1674 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1675 | 1675 | <?php |
| 1676 | 1676 | /** |
| 1677 | 1677 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1680,7 +1680,7 @@ discard block |
||
| 1680 | 1680 | * |
| 1681 | 1681 | * @param int $form_id The form ID. |
| 1682 | 1682 | */ |
| 1683 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1683 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1684 | 1684 | |
| 1685 | 1685 | } |
| 1686 | 1686 | |
@@ -1695,20 +1695,20 @@ discard block |
||
| 1695 | 1695 | * |
| 1696 | 1696 | * @return string $content Filtered content. |
| 1697 | 1697 | */ |
| 1698 | -function give_filter_success_page_content( $content ) { |
|
| 1698 | +function give_filter_success_page_content($content) { |
|
| 1699 | 1699 | |
| 1700 | 1700 | global $give_options; |
| 1701 | 1701 | |
| 1702 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1703 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1704 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1702 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1703 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1704 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1705 | 1705 | } |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | 1708 | return $content; |
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1711 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1712 | 1712 | |
| 1713 | 1713 | /** |
| 1714 | 1714 | * Test Mode Frontend Warning. |
@@ -1719,14 +1719,14 @@ discard block |
||
| 1719 | 1719 | */ |
| 1720 | 1720 | function give_test_mode_frontend_warning() { |
| 1721 | 1721 | |
| 1722 | - $test_mode = give_get_option( 'test_mode' ); |
|
| 1722 | + $test_mode = give_get_option('test_mode'); |
|
| 1723 | 1723 | |
| 1724 | - if ( $test_mode == 'on' ) { |
|
| 1725 | - 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>'; |
|
| 1724 | + if ($test_mode == 'on') { |
|
| 1725 | + 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>'; |
|
| 1726 | 1726 | } |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1729 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1730 | 1730 | |
| 1731 | 1731 | /** |
| 1732 | 1732 | * Members-only Form. |
@@ -1740,21 +1740,21 @@ discard block |
||
| 1740 | 1740 | * |
| 1741 | 1741 | * @return string |
| 1742 | 1742 | */ |
| 1743 | -function give_members_only_form( $final_output, $args ) { |
|
| 1743 | +function give_members_only_form($final_output, $args) { |
|
| 1744 | 1744 | |
| 1745 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1745 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1746 | 1746 | |
| 1747 | 1747 | //Sanity Check: Must have form_id & not be logged in |
| 1748 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1748 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1749 | 1749 | return $final_output; |
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | 1752 | //Logged in only and Register / Login set to none |
| 1753 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1753 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1754 | 1754 | |
| 1755 | - $final_output = give_output_error( esc_html__( 'Please login in order to complete your donation.', 'give' ), false ); |
|
| 1755 | + $final_output = give_output_error(esc_html__('Please login in order to complete your donation.', 'give'), false); |
|
| 1756 | 1756 | |
| 1757 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1757 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1758 | 1758 | |
| 1759 | 1759 | } |
| 1760 | 1760 | |
@@ -1762,4 +1762,4 @@ discard block |
||
| 1762 | 1762 | |
| 1763 | 1763 | } |
| 1764 | 1764 | |
| 1765 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1765 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -713,7 +713,7 @@ |
||
| 713 | 713 | * @param bool $colon Check if add colon between heading and message. |
| 714 | 714 | * @param string $color Heading color. |
| 715 | 715 | * |
| 716 | - * @return mixed |
|
| 716 | + * @return string |
|
| 717 | 717 | */ |
| 718 | 718 | private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
| 719 | 719 | // Add colon. |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @subcommand donors |
| 327 | 327 | */ |
| 328 | 328 | public function donors( $args, $assoc_args ) { |
| 329 | - global $wp_query; |
|
| 329 | + global $wp_query; |
|
| 330 | 330 | $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
| 331 | 331 | $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
| 332 | 332 | $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | * @subcommand donations |
| 493 | 493 | */ |
| 494 | 494 | public function donations( $args, $assoc_args ) { |
| 495 | - global $wp_query; |
|
| 495 | + global $wp_query; |
|
| 496 | 496 | $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
| 497 | 497 | |
| 498 | 498 | // Cache previous number query var. |
@@ -716,9 +716,9 @@ discard block |
||
| 716 | 716 | * @return mixed |
| 717 | 717 | */ |
| 718 | 718 | private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
| 719 | - // Add colon. |
|
| 720 | - if ( $colon ) { |
|
| 721 | - $heading = $heading . ': '; |
|
| 719 | + // Add colon. |
|
| 720 | + if ( $colon ) { |
|
| 721 | + $heading = $heading . ': '; |
|
| 722 | 722 | } |
| 723 | 723 | return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
| 724 | 724 | } |
@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Exit if accessed directly. |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
| 10 | +if ( ! defined('ABSPATH')) { exit; } |
|
| 11 | 11 | |
| 12 | 12 | // Add give command. |
| 13 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
| 13 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -66,54 +66,54 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @subcommand details |
| 68 | 68 | */ |
| 69 | - public function details( $args, $assoc_args ) { |
|
| 69 | + public function details($args, $assoc_args) { |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Plugin Information |
| 73 | 73 | */ |
| 74 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
| 74 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * General Information. |
| 78 | 78 | */ |
| 79 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
| 79 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
| 80 | 80 | |
| 81 | - $success_page = give_get_option( 'success_page' ); |
|
| 82 | - $failure_page = give_get_option( 'failure_page' ); |
|
| 83 | - $history_page = give_get_option( 'history_page' ); |
|
| 81 | + $success_page = give_get_option('success_page'); |
|
| 82 | + $failure_page = give_get_option('failure_page'); |
|
| 83 | + $history_page = give_get_option('history_page'); |
|
| 84 | 84 | |
| 85 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
| 86 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
| 87 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
| 88 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
| 85 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
| 86 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
| 87 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
| 88 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Currency Information. |
| 92 | 92 | */ |
| 93 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
| 93 | + $default_gateway = give_get_option('default_gateway'); |
|
| 94 | 94 | |
| 95 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
| 95 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
| 96 | 96 | |
| 97 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
| 98 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
| 99 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
| 100 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
| 101 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
| 102 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
| 103 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
| 97 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
| 98 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
| 99 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
| 100 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
| 101 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
| 102 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
| 103 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
| 104 | 104 | |
| 105 | 105 | // Payment gateways Information. |
| 106 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
| 107 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
| 106 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
| 107 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
| 108 | 108 | |
| 109 | - if ( ! empty( $gateways ) ) { |
|
| 109 | + if ( ! empty($gateways)) { |
|
| 110 | 110 | self::$counter = 1; |
| 111 | - foreach ( $gateways as $gateway ) { |
|
| 112 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
| 111 | + foreach ($gateways as $gateway) { |
|
| 112 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
| 113 | 113 | self::$counter++; |
| 114 | 114 | } |
| 115 | 115 | } else { |
| 116 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
| 116 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | * |
| 146 | 146 | * @subcommand forms |
| 147 | 147 | */ |
| 148 | - public function forms( $args, $assoc_args ) { |
|
| 148 | + public function forms($args, $assoc_args) { |
|
| 149 | 149 | global $wp_query; |
| 150 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
| 151 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
| 150 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
| 151 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
| 152 | 152 | $start = time(); |
| 153 | 153 | |
| 154 | 154 | // Cache previous number query var. |
| 155 | 155 | $is_set_number = $cache_per_page = false; |
| 156 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
| 156 | + if (isset($wp_query->query_vars['number'])) { |
|
| 157 | 157 | $cache_per_page = $wp_query->query_vars['number']; |
| 158 | 158 | $is_set_number = true; |
| 159 | 159 | } |
@@ -162,46 +162,46 @@ discard block |
||
| 162 | 162 | $wp_query->query_vars['number'] = $number; |
| 163 | 163 | |
| 164 | 164 | // Get forms. |
| 165 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
| 165 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
| 166 | 166 | |
| 167 | 167 | // Reset number query var. |
| 168 | - if ( $is_set_number ) { |
|
| 168 | + if ($is_set_number) { |
|
| 169 | 169 | $wp_query->query_vars['number'] = $cache_per_page; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Bailout. |
| 173 | - if ( array_key_exists( 'error', $forms ) ) { |
|
| 173 | + if (array_key_exists('error', $forms)) { |
|
| 174 | 174 | |
| 175 | - WP_CLI::warning( $forms['error'] ); |
|
| 175 | + WP_CLI::warning($forms['error']); |
|
| 176 | 176 | return; |
| 177 | - } elseif ( empty( $forms['forms'] ) ) { |
|
| 177 | + } elseif (empty($forms['forms'])) { |
|
| 178 | 178 | |
| 179 | - WP_CLI::error( __( 'No form found.', 'give' ) ); |
|
| 179 | + WP_CLI::error(__('No form found.', 'give')); |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Param to check if form typeis already showed or not. |
| 184 | 184 | $is_show_form_type = false; |
| 185 | 185 | |
| 186 | - if ( 1 === count( $forms ) && $form_id ) { |
|
| 186 | + if (1 === count($forms) && $form_id) { |
|
| 187 | 187 | // Show single form. |
| 188 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
| 189 | - switch ( $key ) { |
|
| 188 | + foreach ($forms['forms'][0] as $key => $info) { |
|
| 189 | + switch ($key) { |
|
| 190 | 190 | case 'stats': |
| 191 | - $this->color_main_heading( ucfirst( $key ) ); |
|
| 191 | + $this->color_main_heading(ucfirst($key)); |
|
| 192 | 192 | |
| 193 | - foreach ( $info as $heading => $data ) { |
|
| 194 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
| 195 | - switch ( $heading ) { |
|
| 193 | + foreach ($info as $heading => $data) { |
|
| 194 | + $this->color_sub_heading(ucfirst($heading)); |
|
| 195 | + switch ($heading) { |
|
| 196 | 196 | default: |
| 197 | - foreach ( $data as $subheading => $subdata ) { |
|
| 197 | + foreach ($data as $subheading => $subdata) { |
|
| 198 | 198 | |
| 199 | - switch ( $subheading ) { |
|
| 199 | + switch ($subheading) { |
|
| 200 | 200 | case 'earnings': |
| 201 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
| 201 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
| 202 | 202 | break; |
| 203 | 203 | default: |
| 204 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
| 204 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -211,26 +211,26 @@ discard block |
||
| 211 | 211 | case 'pricing': |
| 212 | 212 | case 'info': |
| 213 | 213 | default: |
| 214 | - $this->color_main_heading( ucfirst( $key ) ); |
|
| 214 | + $this->color_main_heading(ucfirst($key)); |
|
| 215 | 215 | |
| 216 | 216 | // Show form type. |
| 217 | - if ( ! $is_show_form_type ) { |
|
| 218 | - $form = new Give_Donate_Form( $form_id ); |
|
| 217 | + if ( ! $is_show_form_type) { |
|
| 218 | + $form = new Give_Donate_Form($form_id); |
|
| 219 | 219 | $is_show_form_type = true; |
| 220 | 220 | |
| 221 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
| 221 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - foreach ( $info as $heading => $data ) { |
|
| 224 | + foreach ($info as $heading => $data) { |
|
| 225 | 225 | |
| 226 | - switch ( $heading ) { |
|
| 226 | + switch ($heading) { |
|
| 227 | 227 | case 'id': |
| 228 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
| 228 | + WP_CLI::log($this->color_message($heading, $data)); |
|
| 229 | 229 | break; |
| 230 | 230 | |
| 231 | 231 | default: |
| 232 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
| 233 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
| 232 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
| 233 | + WP_CLI::log($this->color_message($heading, $data)); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -241,37 +241,37 @@ discard block |
||
| 241 | 241 | $is_table_first_row_set = false; |
| 242 | 242 | $table_column_count = 0; |
| 243 | 243 | |
| 244 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
| 244 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
| 245 | 245 | |
| 246 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
| 246 | + foreach ($forms['forms'] as $index => $form_data) { |
|
| 247 | 247 | |
| 248 | 248 | // Default table data. |
| 249 | 249 | $table_first_row = array(); |
| 250 | 250 | $table_row = array(); |
| 251 | 251 | |
| 252 | - foreach ( $form_data['info'] as $key => $form ) { |
|
| 252 | + foreach ($form_data['info'] as $key => $form) { |
|
| 253 | 253 | |
| 254 | 254 | // Do not show thumbnail, content and link in table. |
| 255 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
| 255 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
| 256 | 256 | continue; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( ! $is_table_first_row_set ) { |
|
| 259 | + if ( ! $is_table_first_row_set) { |
|
| 260 | 260 | $table_first_row[] = $key; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $table_row[] = $form; |
| 264 | 264 | |
| 265 | - if ( 'status' === $key ) { |
|
| 265 | + if ('status' === $key) { |
|
| 266 | 266 | // First array item will be an form id in our case. |
| 267 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
| 267 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
| 268 | 268 | |
| 269 | 269 | $table_row[] = $form->get_type(); |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Set table first row. |
| 274 | - if ( ! $is_table_first_row_set ) { |
|
| 274 | + if ( ! $is_table_first_row_set) { |
|
| 275 | 275 | |
| 276 | 276 | // Add extra column to table. |
| 277 | 277 | $table_first_row[] = 'type'; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $table_data[] = $table_row; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $this->display_table( $table_data ); |
|
| 287 | + $this->display_table($table_data); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
@@ -325,29 +325,29 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | * @subcommand donors |
| 327 | 327 | */ |
| 328 | - public function donors( $args, $assoc_args ) { |
|
| 328 | + public function donors($args, $assoc_args) { |
|
| 329 | 329 | global $wp_query; |
| 330 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
| 331 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
| 332 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
| 333 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
| 334 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
| 330 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
| 331 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
| 332 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
| 333 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
| 334 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
| 335 | 335 | $start = time(); |
| 336 | 336 | |
| 337 | - if ( $create ) { |
|
| 337 | + if ($create) { |
|
| 338 | 338 | $number = 1; |
| 339 | 339 | |
| 340 | 340 | // Create one or more donors. |
| 341 | - if ( ! $email ) { |
|
| 341 | + if ( ! $email) { |
|
| 342 | 342 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
| 343 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
| 343 | + $number = is_numeric($create) ? absint($create) : 1; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - for ( $i = 0; $i < $number; $i++ ) { |
|
| 347 | - if ( ! $email ) { |
|
| 346 | + for ($i = 0; $i < $number; $i++) { |
|
| 347 | + if ( ! $email) { |
|
| 348 | 348 | |
| 349 | 349 | // Generate fake email. |
| 350 | - $email = 'customer-' . uniqid() . '@test.com'; |
|
| 350 | + $email = 'customer-'.uniqid().'@test.com'; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $args = array( |
@@ -355,33 +355,33 @@ discard block |
||
| 355 | 355 | 'name' => $name, |
| 356 | 356 | ); |
| 357 | 357 | |
| 358 | - $customer_id = Give()->customers->add( $args ); |
|
| 358 | + $customer_id = Give()->customers->add($args); |
|
| 359 | 359 | |
| 360 | - if ( $customer_id ) { |
|
| 361 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor %d created successfully', 'give' ), $customer_id ) ) ); |
|
| 360 | + if ($customer_id) { |
|
| 361 | + WP_CLI::line($this->color_message(sprintf(__('Donor %d created successfully', 'give'), $customer_id))); |
|
| 362 | 362 | } else { |
| 363 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
| 363 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // Reset email to false so it is generated on the next loop (if creating donors). |
| 367 | 367 | $email = false; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
| 370 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
| 371 | 371 | |
| 372 | 372 | } else { |
| 373 | 373 | // Counter. |
| 374 | 374 | self::$counter = 1; |
| 375 | 375 | |
| 376 | 376 | // Search for customers. |
| 377 | - $search = $donor_id ? $donor_id : $email; |
|
| 377 | + $search = $donor_id ? $donor_id : $email; |
|
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | 380 | * Get donors. |
| 381 | 381 | */ |
| 382 | 382 | // Cache previous number query var. |
| 383 | 383 | $is_set_number = $cache_per_page = false; |
| 384 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
| 384 | + if (isset($wp_query->query_vars['number'])) { |
|
| 385 | 385 | $cache_per_page = $wp_query->query_vars['number']; |
| 386 | 386 | $is_set_number = true; |
| 387 | 387 | } |
@@ -390,43 +390,43 @@ discard block |
||
| 390 | 390 | $wp_query->query_vars['number'] = $number; |
| 391 | 391 | |
| 392 | 392 | // Get donors. |
| 393 | - $donors = $this->api->get_customers( $search ); |
|
| 393 | + $donors = $this->api->get_customers($search); |
|
| 394 | 394 | |
| 395 | 395 | // Reset number query var. |
| 396 | - if ( $is_set_number ) { |
|
| 396 | + if ($is_set_number) { |
|
| 397 | 397 | $wp_query->query_vars['number'] = $cache_per_page; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - if ( isset( $donors['error'] ) ) { |
|
| 401 | - WP_CLI::error( $donors['error'] ); |
|
| 400 | + if (isset($donors['error'])) { |
|
| 401 | + WP_CLI::error($donors['error']); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - if ( empty( $donors ) ) { |
|
| 405 | - WP_CLI::error( __( 'No donors found', 'give' ) ); |
|
| 404 | + if (empty($donors)) { |
|
| 405 | + WP_CLI::error(__('No donors found', 'give')); |
|
| 406 | 406 | return; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | $table_data = array(); |
| 410 | 410 | $is_table_first_row_set = false; |
| 411 | 411 | |
| 412 | - foreach ( $donors['donors'] as $donor_data ) { |
|
| 412 | + foreach ($donors['donors'] as $donor_data) { |
|
| 413 | 413 | // Set default table row data. |
| 414 | - $table_first_row = array( __( 'S. No.', 'give' ) ); |
|
| 415 | - $table_row = array( self::$counter ); |
|
| 414 | + $table_first_row = array(__('S. No.', 'give')); |
|
| 415 | + $table_row = array(self::$counter); |
|
| 416 | 416 | |
| 417 | - foreach ( $donor_data as $key => $donor ) { |
|
| 418 | - switch ( $key ) { |
|
| 417 | + foreach ($donor_data as $key => $donor) { |
|
| 418 | + switch ($key) { |
|
| 419 | 419 | case 'stats': |
| 420 | - foreach ( $donor as $heading => $data ) { |
|
| 420 | + foreach ($donor as $heading => $data) { |
|
| 421 | 421 | |
| 422 | 422 | // Get first row. |
| 423 | - if ( ! $is_table_first_row_set ) { |
|
| 423 | + if ( ! $is_table_first_row_set) { |
|
| 424 | 424 | $table_first_row[] = $heading; |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - switch ( $heading ) { |
|
| 427 | + switch ($heading) { |
|
| 428 | 428 | case 'total_spent': |
| 429 | - $table_row[] = give_currency_filter( $data ); |
|
| 429 | + $table_row[] = give_currency_filter($data); |
|
| 430 | 430 | break; |
| 431 | 431 | |
| 432 | 432 | default: |
@@ -437,10 +437,10 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | case 'info': |
| 439 | 439 | default: |
| 440 | - foreach ( $donor as $heading => $data ) { |
|
| 440 | + foreach ($donor as $heading => $data) { |
|
| 441 | 441 | |
| 442 | 442 | // Get first row. |
| 443 | - if ( ! $is_table_first_row_set ) { |
|
| 443 | + if ( ! $is_table_first_row_set) { |
|
| 444 | 444 | $table_first_row[] = $heading; |
| 445 | 445 | } |
| 446 | 446 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // Add first row data to table data. |
| 453 | - if ( ! $is_table_first_row_set ) { |
|
| 453 | + if ( ! $is_table_first_row_set) { |
|
| 454 | 454 | $table_data[] = $table_first_row; |
| 455 | 455 | $is_table_first_row_set = true; |
| 456 | 456 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | self::$counter++; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - $this->display_table( $table_data ); |
|
| 465 | + $this->display_table($table_data); |
|
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | |
@@ -491,13 +491,13 @@ discard block |
||
| 491 | 491 | * |
| 492 | 492 | * @subcommand donations |
| 493 | 493 | */ |
| 494 | - public function donations( $args, $assoc_args ) { |
|
| 494 | + public function donations($args, $assoc_args) { |
|
| 495 | 495 | global $wp_query; |
| 496 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
| 496 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
| 497 | 497 | |
| 498 | 498 | // Cache previous number query var. |
| 499 | 499 | $is_set_number = $cache_per_page = false; |
| 500 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
| 500 | + if (isset($wp_query->query_vars['number'])) { |
|
| 501 | 501 | $cache_per_page = $wp_query->query_vars['number']; |
| 502 | 502 | $is_set_number = true; |
| 503 | 503 | } |
@@ -509,45 +509,45 @@ discard block |
||
| 509 | 509 | $donations = $this->api->get_recent_donations(); |
| 510 | 510 | |
| 511 | 511 | // Reset number query var. |
| 512 | - if ( $is_set_number ) { |
|
| 512 | + if ($is_set_number) { |
|
| 513 | 513 | $wp_query->query_vars['number'] = $cache_per_page; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if ( empty( $donations ) ) { |
|
| 517 | - WP_CLI::error( __( 'No sales found', 'give' ) ); |
|
| 516 | + if (empty($donations)) { |
|
| 517 | + WP_CLI::error(__('No sales found', 'give')); |
|
| 518 | 518 | return; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | self::$counter = 1; |
| 522 | 522 | |
| 523 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
| 524 | - $this->color_main_heading( sprintf( __( '%1$s. Payment #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
| 523 | + foreach ($donations['donations'] as $key => $donation) { |
|
| 524 | + $this->color_main_heading(sprintf(__('%1$s. Payment #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
| 525 | 525 | self::$counter++; |
| 526 | 526 | |
| 527 | - foreach ( $donation as $column => $data ) { |
|
| 527 | + foreach ($donation as $column => $data) { |
|
| 528 | 528 | |
| 529 | - if ( is_array( $data ) ) { |
|
| 530 | - $this->color_sub_heading( $column ); |
|
| 531 | - foreach ( $data as $subcolumn => $subdata ) { |
|
| 529 | + if (is_array($data)) { |
|
| 530 | + $this->color_sub_heading($column); |
|
| 531 | + foreach ($data as $subcolumn => $subdata) { |
|
| 532 | 532 | |
| 533 | 533 | // Decode html codes. |
| 534 | - switch ( $subcolumn ) { |
|
| 534 | + switch ($subcolumn) { |
|
| 535 | 535 | case 'name': |
| 536 | - $subdata = html_entity_decode( $subdata ); |
|
| 536 | + $subdata = html_entity_decode($subdata); |
|
| 537 | 537 | break; |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
| 541 | - if ( is_array( $subdata ) ) { |
|
| 541 | + if (is_array($subdata)) { |
|
| 542 | 542 | continue; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
| 545 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
| 546 | 546 | } |
| 547 | 547 | continue; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
| 550 | + WP_CLI::log($this->color_message($column, $data)); |
|
| 551 | 551 | } |
| 552 | 552 | } |
| 553 | 553 | } |
@@ -586,27 +586,27 @@ discard block |
||
| 586 | 586 | * |
| 587 | 587 | * @return void |
| 588 | 588 | */ |
| 589 | - public function report( $args, $assoc_args ) { |
|
| 589 | + public function report($args, $assoc_args) { |
|
| 590 | 590 | $stats = new Give_Payment_Stats(); |
| 591 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
| 592 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
| 593 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
| 594 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
| 591 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
| 592 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
| 593 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
| 594 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
| 595 | 595 | |
| 596 | - if ( ! empty( $date ) ) { |
|
| 596 | + if ( ! empty($date)) { |
|
| 597 | 597 | $start_date = $date; |
| 598 | 598 | $end_date = false; |
| 599 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
| 599 | + } elseif (empty($date) && empty($start_date)) { |
|
| 600 | 600 | $start_date = 'this_month'; |
| 601 | 601 | $end_date = false; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | // Get stats. |
| 605 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
| 606 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
| 605 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
| 606 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
| 607 | 607 | |
| 608 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
| 609 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
| 608 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
| 609 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | |
@@ -633,26 +633,26 @@ discard block |
||
| 633 | 633 | * |
| 634 | 634 | * @subcommand cache |
| 635 | 635 | */ |
| 636 | - public function cache( $args, $assoc_args ) { |
|
| 637 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
| 636 | + public function cache($args, $assoc_args) { |
|
| 637 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
| 638 | 638 | |
| 639 | 639 | // Bailout. |
| 640 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
| 641 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
| 640 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
| 641 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
| 642 | 642 | return; |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - switch ( $action ) { |
|
| 645 | + switch ($action) { |
|
| 646 | 646 | case 'delete' : |
| 647 | 647 | // Reset counter. |
| 648 | 648 | self::$counter = 1; |
| 649 | 649 | |
| 650 | - if ( $this->delete_stats_transients() ) { |
|
| 650 | + if ($this->delete_stats_transients()) { |
|
| 651 | 651 | // Report .eading. |
| 652 | - WP_CLI::success( 'All form stat transient cache deleted.' ); |
|
| 652 | + WP_CLI::success('All form stat transient cache deleted.'); |
|
| 653 | 653 | } else { |
| 654 | 654 | // Report .eading. |
| 655 | - WP_CLI::warning( 'We did not find any transient to delete :)' ); |
|
| 655 | + WP_CLI::warning('We did not find any transient to delete :)'); |
|
| 656 | 656 | } |
| 657 | 657 | break; |
| 658 | 658 | } |
@@ -678,23 +678,23 @@ discard block |
||
| 678 | 678 | ARRAY_A |
| 679 | 679 | ); |
| 680 | 680 | |
| 681 | - if ( ! empty( $stat_option_names ) ) { |
|
| 681 | + if ( ! empty($stat_option_names)) { |
|
| 682 | 682 | |
| 683 | 683 | // Convert transient option name to transient name. |
| 684 | 684 | $stat_option_names = array_map( |
| 685 | - function( $option ) { |
|
| 686 | - return str_replace( '_transient_', '', $option['option_name'] ); |
|
| 685 | + function($option) { |
|
| 686 | + return str_replace('_transient_', '', $option['option_name']); |
|
| 687 | 687 | }, |
| 688 | 688 | $stat_option_names |
| 689 | 689 | ); |
| 690 | 690 | |
| 691 | - foreach ( $stat_option_names as $option_name ) { |
|
| 692 | - if ( delete_transient( $option_name ) ) { |
|
| 691 | + foreach ($stat_option_names as $option_name) { |
|
| 692 | + if (delete_transient($option_name)) { |
|
| 693 | 693 | |
| 694 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
| 694 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
| 695 | 695 | self::$counter++; |
| 696 | 696 | } else { |
| 697 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
| 697 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
@@ -715,12 +715,12 @@ discard block |
||
| 715 | 715 | * |
| 716 | 716 | * @return mixed |
| 717 | 717 | */ |
| 718 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
| 718 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
| 719 | 719 | // Add colon. |
| 720 | - if ( $colon ) { |
|
| 721 | - $heading = $heading . ': '; |
|
| 720 | + if ($colon) { |
|
| 721 | + $heading = $heading.': '; |
|
| 722 | 722 | } |
| 723 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
| 723 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | |
@@ -735,8 +735,8 @@ discard block |
||
| 735 | 735 | * |
| 736 | 736 | * @return void |
| 737 | 737 | */ |
| 738 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
| 739 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
| 738 | + private function color_main_heading($heading, $color = 'g') { |
|
| 739 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /** |
@@ -749,8 +749,8 @@ discard block |
||
| 749 | 749 | * |
| 750 | 750 | * @return void |
| 751 | 751 | */ |
| 752 | - private function color_sub_heading( $subheading ) { |
|
| 753 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
| 752 | + private function color_sub_heading($subheading) { |
|
| 753 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | |
@@ -764,17 +764,17 @@ discard block |
||
| 764 | 764 | * |
| 765 | 765 | * @return void |
| 766 | 766 | */ |
| 767 | - private function display_table( $data ) { |
|
| 767 | + private function display_table($data) { |
|
| 768 | 768 | $table = new \cli\Table(); |
| 769 | 769 | |
| 770 | 770 | // Set table header. |
| 771 | - $table->setHeaders( $data[0] ); |
|
| 771 | + $table->setHeaders($data[0]); |
|
| 772 | 772 | |
| 773 | 773 | // Remove table header. |
| 774 | - unset( $data[0] ); |
|
| 774 | + unset($data[0]); |
|
| 775 | 775 | |
| 776 | 776 | // Set table data. |
| 777 | - $table->setRows( $data ); |
|
| 777 | + $table->setRows($data); |
|
| 778 | 778 | |
| 779 | 779 | // Display table. |
| 780 | 780 | $table->display(); |
@@ -358,9 +358,9 @@ |
||
| 358 | 358 | require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
| 359 | 359 | require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
| 360 | 360 | |
| 361 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 363 | - } |
|
| 361 | + if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | + require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 363 | + } |
|
| 364 | 364 | |
| 365 | 365 | if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
| 366 | 366 | |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | 42 | // Exit if accessed directly. |
| 43 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 43 | +if ( ! defined('ABSPATH')) {
|
|
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Give' ) ) : |
|
| 47 | +if ( ! class_exists('Give')) :
|
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | * @return Give |
| 196 | 196 | */ |
| 197 | 197 | public static function instance() {
|
| 198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
|
|
| 198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
|
|
| 199 | 199 | self::$instance = new Give; |
| 200 | 200 | self::$instance->setup_constants(); |
| 201 | 201 | |
| 202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
|
|
| 203 | 203 | |
| 204 | 204 | self::$instance->includes(); |
| 205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function __clone() {
|
| 234 | 234 | // Cloning instances of the class is forbidden |
| 235 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'give' ), '1.0' ); |
|
| 235 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ uh?', 'give'), '1.0');
|
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function __wakeup() {
|
| 247 | 247 | // Unserializing instances of the class is forbidden. |
| 248 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'give' ), '1.0' ); |
|
| 248 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ uh?', 'give'), '1.0');
|
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
| 259 | 259 | private function setup_constants() {
|
| 260 | 260 | |
| 261 | 261 | // Plugin version |
| 262 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 263 | - define( 'GIVE_VERSION', '1.6' ); |
|
| 262 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 263 | + define('GIVE_VERSION', '1.6');
|
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Plugin Folder Path |
| 267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 267 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Plugin Folder URL |
| 272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 272 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Plugin Basename aka: "give/give.php" |
| 277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Plugin Root File |
| 282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 282 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 283 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Make sure CAL_GREGORIAN is defined |
| 287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 288 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 287 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 288 | + define('CAL_GREGORIAN', 1);
|
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -300,113 +300,113 @@ discard block |
||
| 300 | 300 | private function includes() {
|
| 301 | 301 | global $give_options; |
| 302 | 302 | |
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
| 304 | 304 | $give_options = give_get_settings(); |
| 305 | 305 | |
| 306 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 307 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 308 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 311 | - |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 313 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 314 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 326 | - |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 329 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
| 342 | - |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 344 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
| 348 | - |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 350 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 354 | - |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 356 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 360 | - |
|
| 361 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 306 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 307 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 308 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 311 | + |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 313 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 314 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 326 | + |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 329 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
| 342 | + |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 344 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
| 348 | + |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 350 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 354 | + |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 356 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 360 | + |
|
| 361 | + if (defined('WP_CLI') && WP_CLI) {
|
|
| 362 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 366 | - |
|
| 367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 368 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 376 | - |
|
| 377 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 379 | - |
|
| 380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 385 | - |
|
| 386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
| 387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
| 389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
| 390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 393 | - |
|
| 394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 403 | - |
|
| 404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 365 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 366 | + |
|
| 367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 368 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 376 | + |
|
| 377 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 379 | + |
|
| 380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 385 | + |
|
| 386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
| 387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
| 389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
| 390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 393 | + |
|
| 394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 403 | + |
|
| 404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 406 | 406 | |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 409 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 410 | 410 | |
| 411 | 411 | } |
| 412 | 412 | |
@@ -420,26 +420,26 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | public function load_textdomain() {
|
| 422 | 422 | // Set filter for Give's languages directory |
| 423 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 424 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 423 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 424 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 425 | 425 | |
| 426 | 426 | // Traditional WordPress plugin locale filter |
| 427 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 428 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 427 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 428 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 429 | 429 | |
| 430 | 430 | // Setup paths to current locale file |
| 431 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 432 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 431 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 432 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 433 | 433 | |
| 434 | - if ( file_exists( $mofile_global ) ) {
|
|
| 434 | + if (file_exists($mofile_global)) {
|
|
| 435 | 435 | // Look in global /wp-content/languages/give folder |
| 436 | - load_textdomain( 'give', $mofile_global ); |
|
| 437 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 436 | + load_textdomain('give', $mofile_global);
|
|
| 437 | + } elseif (file_exists($mofile_local)) {
|
|
| 438 | 438 | // Look in local location from filter `give_languages_directory` |
| 439 | - load_textdomain( 'give', $mofile_local ); |
|
| 439 | + load_textdomain('give', $mofile_local);
|
|
| 440 | 440 | } else {
|
| 441 | 441 | // Load the default language files packaged up w/ Give |
| 442 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 442 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
@@ -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 | |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | function give_add_ons_page() { |
| 26 | 26 | ob_start(); ?> |
| 27 | 27 | <div class="wrap" id="give-add-ons"> |
| 28 | - <h1><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
| 29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
| 28 | + <h1><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
| 29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
| 30 | 30 | <span class="dashicons dashicons-external"></span></a> |
| 31 | 31 | </h1> |
| 32 | 32 | |
| 33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
| 33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
| 34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
| 35 | 35 | </div> |
| 36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | function give_add_ons_get_feed() { |
| 49 | 49 | |
| 50 | 50 | $addons_debug = false; //set to true to debug |
| 51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
| 51 | + $cache = get_transient('give_add_ons_feed'); |
|
| 52 | 52 | |
| 53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
| 54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
| 53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
| 54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
| 55 | 55 | |
| 56 | - if ( ! is_wp_error( $feed ) ) { |
|
| 57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
| 58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
| 59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
| 56 | + if ( ! is_wp_error($feed)) { |
|
| 57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
| 58 | + $cache = wp_remote_retrieve_body($feed); |
|
| 59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
| 60 | 60 | } |
| 61 | 61 | } else { |
| 62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
| 62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @since 1.3.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) or exit; |
|
| 11 | +defined('ABSPATH') or exit; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class Give_Shortcode_Donation_Form_Goal |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | |
| 23 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
| 24 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
| 23 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
| 24 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
| 25 | 25 | |
| 26 | - parent::__construct( 'give_goal' ); |
|
| 26 | + parent::__construct('give_goal'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $create_form_link = sprintf( |
| 37 | 37 | /* translators: %s: create new form URL */ |
| 38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
| 39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
| 38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
| 39 | + admin_url('post-new.php?post_type=give_forms') |
|
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | 42 | return array( |
@@ -46,35 +46,35 @@ discard block |
||
| 46 | 46 | 'post_type' => 'give_forms', |
| 47 | 47 | ), |
| 48 | 48 | 'name' => 'id', |
| 49 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
| 50 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
| 49 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
| 50 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
| 51 | 51 | 'required' => array( |
| 52 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
| 53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ), |
|
| 52 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
| 53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms found.', 'give'), $create_form_link), |
|
| 54 | 54 | ), |
| 55 | 55 | ), |
| 56 | 56 | array( |
| 57 | 57 | 'type' => 'container', |
| 58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
| 58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
| 59 | 59 | ), |
| 60 | 60 | array( |
| 61 | 61 | 'type' => 'listbox', |
| 62 | 62 | 'name' => 'show_text', |
| 63 | - 'label' => esc_attr__( 'Show Text:', 'give' ), |
|
| 64 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
| 63 | + 'label' => esc_attr__('Show Text:', 'give'), |
|
| 64 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
| 65 | 65 | 'options' => array( |
| 66 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 67 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 66 | + 'true' => esc_html__('Show', 'give'), |
|
| 67 | + 'false' => esc_html__('Hide', 'give'), |
|
| 68 | 68 | ), |
| 69 | 69 | ), |
| 70 | 70 | array( |
| 71 | 71 | 'type' => 'listbox', |
| 72 | 72 | 'name' => 'show_bar', |
| 73 | - 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
|
| 74 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
| 73 | + 'label' => esc_attr__('Show Progress Bar:', 'give'), |
|
| 74 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
| 75 | 75 | 'options' => array( |
| 76 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 77 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 76 | + 'true' => esc_html__('Show', 'give'), |
|
| 77 | + 'false' => esc_html__('Hide', 'give'), |
|
| 78 | 78 | ), |
| 79 | 79 | ), |
| 80 | 80 | ); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -46,16 +46,16 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param array $request The Form Data passed into the batch processing |
| 48 | 48 | */ |
| 49 | - public function set_properties( $request ) { |
|
| 49 | + public function set_properties($request) { |
|
| 50 | 50 | |
| 51 | 51 | //Set data from form submission |
| 52 | - if ( isset( $_POST['form'] ) ) { |
|
| 53 | - parse_str( $_POST['form'], $this->data ); |
|
| 52 | + if (isset($_POST['form'])) { |
|
| 53 | + parse_str($_POST['form'], $this->data); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $this->form = $this->data['forms']; |
| 57 | 57 | |
| 58 | - $this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
| 58 | + $this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -70,36 +70,36 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $cols = array(); |
| 72 | 72 | |
| 73 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
| 73 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
| 74 | 74 | |
| 75 | - if ( empty( $columns ) ) { |
|
| 75 | + if (empty($columns)) { |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | - if ( ! empty( $columns['full_name'] ) ) { |
|
| 79 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
| 78 | + if ( ! empty($columns['full_name'])) { |
|
| 79 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
| 80 | 80 | } |
| 81 | - if ( ! empty( $columns['email'] ) ) { |
|
| 82 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
| 81 | + if ( ! empty($columns['email'])) { |
|
| 82 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
| 83 | 83 | } |
| 84 | - if ( ! empty( $columns['address'] ) ) { |
|
| 85 | - $cols['address_line1'] = esc_html__( 'Address 1', 'give' ); |
|
| 86 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
| 87 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
| 88 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
| 89 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
| 90 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
| 84 | + if ( ! empty($columns['address'])) { |
|
| 85 | + $cols['address_line1'] = esc_html__('Address 1', 'give'); |
|
| 86 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
| 87 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
| 88 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
| 89 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
| 90 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
| 91 | 91 | } |
| 92 | - if ( ! empty( $columns['userid'] ) ) { |
|
| 93 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
| 92 | + if ( ! empty($columns['userid'])) { |
|
| 93 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
| 94 | 94 | } |
| 95 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
| 96 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
| 95 | + if ( ! empty($columns['date_first_donated'])) { |
|
| 96 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
| 97 | 97 | } |
| 98 | - if ( ! empty( $columns['donations'] ) ) { |
|
| 99 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
| 98 | + if ( ! empty($columns['donations'])) { |
|
| 99 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
| 100 | 100 | } |
| 101 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
| 102 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
| 101 | + if ( ! empty($columns['donation_sum'])) { |
|
| 102 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return $cols; |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $i = 0; |
| 121 | 121 | |
| 122 | - if ( ! empty( $this->form ) ) { |
|
| 122 | + if ( ! empty($this->form)) { |
|
| 123 | 123 | |
| 124 | 124 | // Export donors of a specific product |
| 125 | 125 | global $give_logs; |
| 126 | 126 | |
| 127 | 127 | $args = array( |
| 128 | - 'post_parent' => absint( $this->form ), |
|
| 128 | + 'post_parent' => absint($this->form), |
|
| 129 | 129 | 'log_type' => 'sale', |
| 130 | 130 | 'posts_per_page' => 30, |
| 131 | 131 | 'paged' => $this->step |
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | 134 | //Check for price option |
| 135 | - if ( null !== $this->price_id ) { |
|
| 135 | + if (null !== $this->price_id) { |
|
| 136 | 136 | $args['meta_query'] = array( |
| 137 | 137 | array( |
| 138 | 138 | 'key' => '_give_log_price_id', |
@@ -141,33 +141,33 @@ discard block |
||
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $logs = $give_logs->get_connected_logs( $args ); |
|
| 144 | + $logs = $give_logs->get_connected_logs($args); |
|
| 145 | 145 | |
| 146 | - if ( $logs ) { |
|
| 147 | - foreach ( $logs as $log ) { |
|
| 148 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
| 149 | - $payment = new Give_Payment( $payment_id ); |
|
| 150 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
| 151 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 152 | - $i ++; |
|
| 146 | + if ($logs) { |
|
| 147 | + foreach ($logs as $log) { |
|
| 148 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
| 149 | + $payment = new Give_Payment($payment_id); |
|
| 150 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
| 151 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 152 | + $i++; |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | } else { |
| 157 | 157 | |
| 158 | 158 | // Export all customers |
| 159 | - $offset = 30 * ( $this->step - 1 ); |
|
| 160 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
| 159 | + $offset = 30 * ($this->step - 1); |
|
| 160 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
| 161 | 161 | |
| 162 | - foreach ( $donors as $donor ) { |
|
| 162 | + foreach ($donors as $donor) { |
|
| 163 | 163 | |
| 164 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 165 | - $i ++; |
|
| 164 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 165 | + $i++; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 170 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
| 169 | + $data = apply_filters('give_export_get_data', $data); |
|
| 170 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
| 171 | 171 | |
| 172 | 172 | return $data; |
| 173 | 173 | } |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | $percentage = 0; |
| 184 | 184 | |
| 185 | 185 | // We can't count the number when getting them for a specific form |
| 186 | - if ( empty( $this->form ) ) { |
|
| 186 | + if (empty($this->form)) { |
|
| 187 | 187 | |
| 188 | 188 | $total = Give()->customers->count(); |
| 189 | 189 | |
| 190 | - if ( $total > 0 ) { |
|
| 190 | + if ($total > 0) { |
|
| 191 | 191 | |
| 192 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 192 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( $percentage > 100 ) { |
|
| 198 | + if ($percentage > 100) { |
|
| 199 | 199 | $percentage = 100; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -207,46 +207,46 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param $donor |
| 209 | 209 | */ |
| 210 | - private function set_donor_data( $i, $data, $donor ) { |
|
| 210 | + private function set_donor_data($i, $data, $donor) { |
|
| 211 | 211 | |
| 212 | 212 | $columns = $this->csv_cols(); |
| 213 | 213 | |
| 214 | 214 | //Set address variable |
| 215 | 215 | $address = ''; |
| 216 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
| 217 | - $address = give_get_donor_address( $donor->user_id ); |
|
| 216 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
| 217 | + $address = give_get_donor_address($donor->user_id); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | //Set columns |
| 221 | - if ( ! empty( $columns['full_name'] ) ) { |
|
| 222 | - $data[ $i ]['full_name'] = $donor->name; |
|
| 221 | + if ( ! empty($columns['full_name'])) { |
|
| 222 | + $data[$i]['full_name'] = $donor->name; |
|
| 223 | 223 | } |
| 224 | - if ( ! empty( $columns['email'] ) ) { |
|
| 225 | - $data[ $i ]['email'] = $donor->email; |
|
| 224 | + if ( ! empty($columns['email'])) { |
|
| 225 | + $data[$i]['email'] = $donor->email; |
|
| 226 | 226 | } |
| 227 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
| 227 | + if ( ! empty($columns['address_line1'])) { |
|
| 228 | 228 | |
| 229 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
| 230 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
| 231 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
| 232 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
| 233 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
| 234 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
| 229 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
| 230 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
| 231 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
| 232 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
| 233 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
| 234 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
| 235 | 235 | } |
| 236 | - if ( ! empty( $columns['userid'] ) ) { |
|
| 237 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
| 236 | + if ( ! empty($columns['userid'])) { |
|
| 237 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
| 238 | 238 | } |
| 239 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
| 240 | - $data[ $i ]['date_first_donated'] = date_i18n( get_option( 'date_format' ), strtotime( $donor->date_created ) ); |
|
| 239 | + if ( ! empty($columns['date_first_donated'])) { |
|
| 240 | + $data[$i]['date_first_donated'] = date_i18n(get_option('date_format'), strtotime($donor->date_created)); |
|
| 241 | 241 | } |
| 242 | - if ( ! empty( $columns['donations'] ) ) { |
|
| 243 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
| 242 | + if ( ! empty($columns['donations'])) { |
|
| 243 | + $data[$i]['donations'] = $donor->purchase_count; |
|
| 244 | 244 | } |
| 245 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
| 246 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
| 245 | + if ( ! empty($columns['donation_sum'])) { |
|
| 246 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return $data[ $i ]; |
|
| 249 | + return $data[$i]; |
|
| 250 | 250 | |
| 251 | 251 | } |
| 252 | 252 | |
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function search_box( $text, $input_id ) { |
|
| 67 | - $input_id = $input_id . '-search-input'; |
|
| 66 | + public function search_box($text, $input_id) { |
|
| 67 | + $input_id = $input_id.'-search-input'; |
|
| 68 | 68 | |
| 69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 71 | 71 | } |
| 72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 72 | + if ( ! empty($_REQUEST['order'])) { |
|
| 73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 74 | 74 | } |
| 75 | 75 | ?> |
| 76 | 76 | <p class="search-box"> |
| 77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 80 | 80 | </p> |
| 81 | 81 | <?php |
| 82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function get_columns() { |
| 92 | 92 | $columns = array( |
| 93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
| 94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
| 95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
| 96 | - 'date' => esc_html__( 'Date', 'give' ) |
|
| 93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
| 94 | + 'details' => esc_html__('Request Details', 'give'), |
|
| 95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
| 96 | + 'date' => esc_html__('Date', 'give') |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return string Column Name |
| 112 | 112 | */ |
| 113 | - public function column_default( $item, $column_name ) { |
|
| 114 | - switch ( $column_name ) { |
|
| 113 | + public function column_default($item, $column_name) { |
|
| 114 | + switch ($column_name) { |
|
| 115 | 115 | default: |
| 116 | - return $item[ $column_name ]; |
|
| 116 | + return $item[$column_name]; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | - public function column_details( $item ) { |
|
| 130 | + public function column_details($item) { |
|
| 131 | 131 | ?> |
| 132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
| 132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a> |
|
| 133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
| 134 | 134 | <?php |
| 135 | 135 | |
| 136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
| 137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
| 138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
| 139 | - echo '<div>' . $request . '</div>'; |
|
| 140 | - if ( ! empty( $error ) ) { |
|
| 141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
| 142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
| 136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
| 137 | + $error = get_post_field('post_content', $item['ID']); |
|
| 138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
| 139 | + echo '<div>'.$request.'</div>'; |
|
| 140 | + if ( ! empty($error)) { |
|
| 141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
| 142 | + echo '<div>'.esc_html($error).'</div>'; |
|
| 143 | 143 | } |
| 144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
| 145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
| 146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
| 147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
| 148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
| 149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
| 144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
| 145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
| 146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
| 147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
| 148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
| 149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
| 150 | 150 | ?> |
| 151 | 151 | </div> |
| 152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return mixed String if search is present, false otherwise |
| 161 | 161 | */ |
| 162 | 162 | public function get_search() { |
| 163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | * @param string $which |
| 178 | 178 | */ |
| 179 | - protected function display_tablenav( $which ) { |
|
| 180 | - if ( 'top' === $which ) { |
|
| 181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 179 | + protected function display_tablenav($which) { |
|
| 180 | + if ('top' === $which) { |
|
| 181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 182 | 182 | } |
| 183 | 183 | ?> |
| 184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
| 184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
| 185 | 185 | |
| 186 | 186 | <div class="alignleft actions bulkactions"> |
| 187 | - <?php $this->bulk_actions( $which ); ?> |
|
| 187 | + <?php $this->bulk_actions($which); ?> |
|
| 188 | 188 | </div> |
| 189 | 189 | <?php |
| 190 | - $this->extra_tablenav( $which ); |
|
| 191 | - $this->pagination( $which ); |
|
| 190 | + $this->extra_tablenav($which); |
|
| 191 | + $this->pagination($which); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | $search = $this->get_search(); |
| 212 | 212 | |
| 213 | - if ( $search ) { |
|
| 214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
| 213 | + if ($search) { |
|
| 214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
| 215 | 215 | // This is an IP address search |
| 216 | 216 | $key = '_give_log_request_ip'; |
| 217 | - } else if ( is_email( $search ) ) { |
|
| 217 | + } else if (is_email($search)) { |
|
| 218 | 218 | // This is an email search |
| 219 | - $userdata = get_user_by( 'email', $search ); |
|
| 219 | + $userdata = get_user_by('email', $search); |
|
| 220 | 220 | |
| 221 | - if ( $userdata ) { |
|
| 221 | + if ($userdata) { |
|
| 222 | 222 | $search = $userdata->ID; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $key = '_give_log_user'; |
| 226 | - } elseif ( strlen( $search ) == 32 ) { |
|
| 226 | + } elseif (strlen($search) == 32) { |
|
| 227 | 227 | // Look for an API key |
| 228 | 228 | $key = '_give_log_key'; |
| 229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
| 229 | + } elseif (stristr($search, 'token:')) { |
|
| 230 | 230 | // Look for an API token |
| 231 | - $search = str_ireplace( 'token:', '', $search ); |
|
| 231 | + $search = str_ireplace('token:', '', $search); |
|
| 232 | 232 | $key = '_give_log_token'; |
| 233 | 233 | } else { |
| 234 | 234 | // This is (probably) a user ID search |
| 235 | - $userdata = get_userdata( $search ); |
|
| 235 | + $userdata = get_userdata($search); |
|
| 236 | 236 | |
| 237 | - if ( $userdata ) { |
|
| 237 | + if ($userdata) { |
|
| 238 | 238 | $search = $userdata->ID; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @return int Current page number |
| 261 | 261 | */ |
| 262 | 262 | public function get_paged() { |
| 263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @since 1.0 |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - function bulk_actions( $which = '' ) { |
|
| 273 | + function bulk_actions($which = '') { |
|
| 274 | 274 | give_log_views(); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | 'meta_query' => $this->get_meta_query() |
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
| 296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
| 297 | 297 | |
| 298 | - if ( $logs ) { |
|
| 299 | - foreach ( $logs as $log ) { |
|
| 298 | + if ($logs) { |
|
| 299 | + foreach ($logs as $log) { |
|
| 300 | 300 | |
| 301 | 301 | $logs_data[] = array( |
| 302 | 302 | 'ID' => $log->ID, |
| 303 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
| 303 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
| 304 | 304 | 'date' => $log->post_date |
| 305 | 305 | ); |
| 306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | $columns = $this->get_columns(); |
| 329 | 329 | $hidden = array(); // No hidden columns |
| 330 | 330 | $sortable = $this->get_sortable_columns(); |
| 331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 332 | 332 | $this->items = $this->get_logs(); |
| 333 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
| 333 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
| 334 | 334 | |
| 335 | - $this->set_pagination_args( array( |
|
| 335 | + $this->set_pagination_args(array( |
|
| 336 | 336 | 'total_items' => $total_items, |
| 337 | 337 | 'per_page' => $this->per_page, |
| 338 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 338 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 339 | 339 | ) |
| 340 | 340 | ); |
| 341 | 341 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -55,16 +55,16 @@ discard block |
||
| 55 | 55 | public function get_data() { |
| 56 | 56 | global $wpdb; |
| 57 | 57 | |
| 58 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
| 58 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
| 59 | 59 | |
| 60 | - if ( ! is_array( $items ) ) { |
|
| 60 | + if ( ! is_array($items)) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
| 65 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
| 64 | + $offset = ($this->step - 1) * $this->per_step; |
|
| 65 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
| 66 | 66 | |
| 67 | - if ( $step_items ) { |
|
| 67 | + if ($step_items) { |
|
| 68 | 68 | |
| 69 | 69 | $step_ids = array( |
| 70 | 70 | 'customers' => array(), |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | 'other' => array(), |
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | - foreach ( $step_items as $item ) { |
|
| 75 | + foreach ($step_items as $item) { |
|
| 76 | 76 | |
| 77 | - switch ( $item['type'] ) { |
|
| 77 | + switch ($item['type']) { |
|
| 78 | 78 | case 'customer': |
| 79 | 79 | $step_ids['customers'][] = $item['id']; |
| 80 | 80 | break; |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | $step_ids['give_forms'][] = $item['id']; |
| 83 | 83 | break; |
| 84 | 84 | default: |
| 85 | - $item_type = apply_filters( 'give_reset_item_type', 'other', $item ); |
|
| 86 | - $step_ids[ $item_type ][] = $item['id']; |
|
| 85 | + $item_type = apply_filters('give_reset_item_type', 'other', $item); |
|
| 86 | + $step_ids[$item_type][] = $item['id']; |
|
| 87 | 87 | break; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $sql = array(); |
| 93 | 93 | |
| 94 | - foreach ( $step_ids as $type => $ids ) { |
|
| 94 | + foreach ($step_ids as $type => $ids) { |
|
| 95 | 95 | |
| 96 | - if ( empty( $ids ) ) { |
|
| 96 | + if (empty($ids)) { |
|
| 97 | 97 | continue; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $ids = implode( ',', $ids ); |
|
| 100 | + $ids = implode(',', $ids); |
|
| 101 | 101 | |
| 102 | - switch ( $type ) { |
|
| 102 | + switch ($type) { |
|
| 103 | 103 | case 'customers': |
| 104 | - $table_name = $wpdb->prefix . 'give_customers'; |
|
| 104 | + $table_name = $wpdb->prefix.'give_customers'; |
|
| 105 | 105 | $sql[] = "DELETE FROM $table_name WHERE id IN ($ids)"; |
| 106 | 106 | break; |
| 107 | 107 | case 'forms': |
@@ -116,18 +116,18 @@ discard block |
||
| 116 | 116 | break; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) { |
|
| 119 | + if ( ! in_array($type, array('customers', 'forms', 'other'))) { |
|
| 120 | 120 | // Allows other types of custom post types to filter on their own post_type |
| 121 | 121 | // and add items to the query list, for the IDs found in their post type. |
| 122 | - $sql = apply_filters( 'give_reset_add_queries_' . $type, $sql, $ids ); |
|
| 122 | + $sql = apply_filters('give_reset_add_queries_'.$type, $sql, $ids); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if ( ! empty( $sql ) ) { |
|
| 129 | - foreach ( $sql as $query ) { |
|
| 130 | - $wpdb->query( $query ); |
|
| 128 | + if ( ! empty($sql)) { |
|
| 129 | + foreach ($sql as $query) { |
|
| 130 | + $wpdb->query($query); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function get_percentage_complete() { |
| 149 | 149 | |
| 150 | - $items = $this->get_stored_data( 'give_temp_reset_ids', false ); |
|
| 151 | - $total = count( $items ); |
|
| 150 | + $items = $this->get_stored_data('give_temp_reset_ids', false); |
|
| 151 | + $total = count($items); |
|
| 152 | 152 | |
| 153 | 153 | $percentage = 100; |
| 154 | 154 | |
| 155 | - if ( $total > 0 ) { |
|
| 156 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 155 | + if ($total > 0) { |
|
| 156 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( $percentage > 100 ) { |
|
| 159 | + if ($percentage > 100) { |
|
| 160 | 160 | $percentage = 100; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @param array $request The Form Data passed into the batch processing |
| 172 | 172 | */ |
| 173 | - public function set_properties( $request ) { |
|
| 173 | + public function set_properties($request) { |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -181,30 +181,30 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function process_step() { |
| 183 | 183 | |
| 184 | - if ( ! $this->can_export() ) { |
|
| 185 | - wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 184 | + if ( ! $this->can_export()) { |
|
| 185 | + wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $had_data = $this->get_data(); |
| 189 | 189 | |
| 190 | - if ( $had_data ) { |
|
| 190 | + if ($had_data) { |
|
| 191 | 191 | $this->done = false; |
| 192 | 192 | |
| 193 | 193 | return true; |
| 194 | 194 | } else { |
| 195 | - update_option( 'give_earnings_total', 0 ); |
|
| 196 | - delete_transient( 'give_earnings_total' ); |
|
| 197 | - delete_transient( 'give_estimated_monthly_stats' . true ); |
|
| 198 | - delete_transient( 'give_estimated_monthly_stats' . false ); |
|
| 199 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
| 195 | + update_option('give_earnings_total', 0); |
|
| 196 | + delete_transient('give_earnings_total'); |
|
| 197 | + delete_transient('give_estimated_monthly_stats'.true); |
|
| 198 | + delete_transient('give_estimated_monthly_stats'.false); |
|
| 199 | + $this->delete_data('give_temp_reset_ids'); |
|
| 200 | 200 | |
| 201 | 201 | // Reset the sequential order numbers |
| 202 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 203 | - delete_option( 'give_last_payment_number' ); |
|
| 202 | + if (give_get_option('enable_sequential')) { |
|
| 203 | + delete_option('give_last_payment_number'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $this->done = true; |
| 207 | - $this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' ); |
|
| 207 | + $this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give'); |
|
| 208 | 208 | |
| 209 | 209 | return false; |
| 210 | 210 | } |
@@ -214,10 +214,10 @@ discard block |
||
| 214 | 214 | * Headers |
| 215 | 215 | */ |
| 216 | 216 | public function headers() { |
| 217 | - ignore_user_abort( true ); |
|
| 217 | + ignore_user_abort(true); |
|
| 218 | 218 | |
| 219 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 220 | - set_time_limit( 0 ); |
|
| 219 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 220 | + set_time_limit(0); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
@@ -241,35 +241,35 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function pre_fetch() { |
| 243 | 243 | |
| 244 | - if ( $this->step == 1 ) { |
|
| 245 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
| 244 | + if ($this->step == 1) { |
|
| 245 | + $this->delete_data('give_temp_reset_ids'); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
| 248 | + $items = get_option('give_temp_reset_ids', false); |
|
| 249 | 249 | |
| 250 | - if ( false === $items ) { |
|
| 250 | + if (false === $items) { |
|
| 251 | 251 | $items = array(); |
| 252 | 252 | |
| 253 | - $give_types_for_reset = array( 'give_forms', 'give_log', 'give_payment' ); |
|
| 254 | - $give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset ); |
|
| 253 | + $give_types_for_reset = array('give_forms', 'give_log', 'give_payment'); |
|
| 254 | + $give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset); |
|
| 255 | 255 | |
| 256 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
| 256 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
| 257 | 257 | 'post_type' => $give_types_for_reset, |
| 258 | 258 | 'post_status' => 'any', |
| 259 | - 'posts_per_page' => - 1, |
|
| 260 | - ) ); |
|
| 259 | + 'posts_per_page' => -1, |
|
| 260 | + )); |
|
| 261 | 261 | |
| 262 | - $posts = get_posts( $args ); |
|
| 263 | - foreach ( $posts as $post ) { |
|
| 262 | + $posts = get_posts($args); |
|
| 263 | + foreach ($posts as $post) { |
|
| 264 | 264 | $items[] = array( |
| 265 | 265 | 'id' => (int) $post->ID, |
| 266 | 266 | 'type' => $post->post_type, |
| 267 | 267 | ); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $customer_args = array( 'number' => - 1 ); |
|
| 271 | - $customers = Give()->customers->get_customers( $customer_args ); |
|
| 272 | - foreach ( $customers as $customer ) { |
|
| 270 | + $customer_args = array('number' => -1); |
|
| 271 | + $customers = Give()->customers->get_customers($customer_args); |
|
| 272 | + foreach ($customers as $customer) { |
|
| 273 | 273 | $items[] = array( |
| 274 | 274 | 'id' => (int) $customer->id, |
| 275 | 275 | 'type' => 'customer', |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | // Allow filtering of items to remove with an unassociative array for each item |
| 280 | 280 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
| 281 | - $items = apply_filters( 'give_reset_store_items', $items ); |
|
| 281 | + $items = apply_filters('give_reset_store_items', $items); |
|
| 282 | 282 | |
| 283 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
| 283 | + $this->store_data('give_temp_reset_ids', $items); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | } |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @return mixed Returns the data from the database |
| 296 | 296 | */ |
| 297 | - private function get_stored_data( $key ) { |
|
| 297 | + private function get_stored_data($key) { |
|
| 298 | 298 | global $wpdb; |
| 299 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 299 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 300 | 300 | |
| 301 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 301 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @return void |
| 313 | 313 | */ |
| 314 | - private function store_data( $key, $value ) { |
|
| 314 | + private function store_data($key, $value) { |
|
| 315 | 315 | global $wpdb; |
| 316 | 316 | |
| 317 | - $value = maybe_serialize( $value ); |
|
| 317 | + $value = maybe_serialize($value); |
|
| 318 | 318 | |
| 319 | 319 | $data = array( |
| 320 | 320 | 'option_name' => $key, |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | '%s', |
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 331 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -340,9 +340,9 @@ discard block |
||
| 340 | 340 | * |
| 341 | 341 | * @return void |
| 342 | 342 | */ |
| 343 | - private function delete_data( $key ) { |
|
| 343 | + private function delete_data($key) { |
|
| 344 | 344 | global $wpdb; |
| 345 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 345 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -54,50 +54,50 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function get_data() { |
| 56 | 56 | |
| 57 | - if ( $this->step == 1 ) { |
|
| 58 | - $this->delete_data( 'give_temp_recount_income' ); |
|
| 57 | + if ($this->step == 1) { |
|
| 58 | + $this->delete_data('give_temp_recount_income'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $total = get_option( 'give_temp_recount_income', false ); |
|
| 61 | + $total = get_option('give_temp_recount_income', false); |
|
| 62 | 62 | |
| 63 | - if ( false === $total ) { |
|
| 63 | + if (false === $total) { |
|
| 64 | 64 | $total = (float) 0; |
| 65 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
| 65 | + $this->store_data('give_temp_recount_income', $total); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
| 68 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
| 69 | 69 | |
| 70 | - $args = apply_filters( 'give_recount_income_args', array( |
|
| 70 | + $args = apply_filters('give_recount_income_args', array( |
|
| 71 | 71 | 'number' => $this->per_step, |
| 72 | 72 | 'page' => $this->step, |
| 73 | 73 | 'status' => $accepted_statuses, |
| 74 | 74 | 'fields' => 'ids' |
| 75 | - ) ); |
|
| 75 | + )); |
|
| 76 | 76 | |
| 77 | - $payments = give_get_payments( $args ); |
|
| 77 | + $payments = give_get_payments($args); |
|
| 78 | 78 | |
| 79 | - if ( ! empty( $payments ) ) { |
|
| 79 | + if ( ! empty($payments)) { |
|
| 80 | 80 | |
| 81 | - foreach ( $payments as $payment ) { |
|
| 81 | + foreach ($payments as $payment) { |
|
| 82 | 82 | |
| 83 | - $total += give_get_payment_amount( $payment ); |
|
| 83 | + $total += give_get_payment_amount($payment); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( $total < 0 ) { |
|
| 87 | + if ($total < 0) { |
|
| 88 | 88 | $totals = 0; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $total = round( $total, give_currency_decimal_filter() ); |
|
| 91 | + $total = round($total, give_currency_decimal_filter()); |
|
| 92 | 92 | |
| 93 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
| 93 | + $this->store_data('give_temp_recount_income', $total); |
|
| 94 | 94 | |
| 95 | 95 | return true; |
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - update_option( 'give_income_total', $total ); |
|
| 100 | - set_transient( 'give_income_total', $total, 86400 ); |
|
| 99 | + update_option('give_income_total', $total); |
|
| 100 | + set_transient('give_income_total', $total, 86400); |
|
| 101 | 101 | |
| 102 | 102 | return false; |
| 103 | 103 | |
@@ -111,25 +111,25 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function get_percentage_complete() { |
| 113 | 113 | |
| 114 | - $total = $this->get_stored_data( 'give_recount_income_total' ); |
|
| 114 | + $total = $this->get_stored_data('give_recount_income_total'); |
|
| 115 | 115 | |
| 116 | - if ( false === $total ) { |
|
| 117 | - $args = apply_filters( 'give_recount_income_total_args', array() ); |
|
| 116 | + if (false === $total) { |
|
| 117 | + $args = apply_filters('give_recount_income_total_args', array()); |
|
| 118 | 118 | |
| 119 | - $counts = give_count_payments( $args ); |
|
| 120 | - $total = absint( $counts->publish ); |
|
| 121 | - $total = apply_filters( 'give_recount_store_income_total', $total ); |
|
| 119 | + $counts = give_count_payments($args); |
|
| 120 | + $total = absint($counts->publish); |
|
| 121 | + $total = apply_filters('give_recount_store_income_total', $total); |
|
| 122 | 122 | |
| 123 | - $this->store_data( 'give_recount_income_total', $total ); |
|
| 123 | + $this->store_data('give_recount_income_total', $total); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $percentage = 100; |
| 127 | 127 | |
| 128 | - if ( $total > 0 ) { |
|
| 129 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
| 128 | + if ($total > 0) { |
|
| 129 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if ( $percentage > 100 ) { |
|
| 132 | + if ($percentage > 100) { |
|
| 133 | 133 | $percentage = 100; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @param array $request The Form Data passed into the batch processing |
| 145 | 145 | */ |
| 146 | - public function set_properties( $request ) { |
|
| 146 | + public function set_properties($request) { |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -154,31 +154,31 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function process_step() { |
| 156 | 156 | |
| 157 | - if ( ! $this->can_export() ) { |
|
| 158 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 157 | + if ( ! $this->can_export()) { |
|
| 158 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $had_data = $this->get_data(); |
| 162 | 162 | |
| 163 | - if ( $had_data ) { |
|
| 163 | + if ($had_data) { |
|
| 164 | 164 | $this->done = false; |
| 165 | 165 | |
| 166 | 166 | return true; |
| 167 | 167 | } else { |
| 168 | - $this->delete_data( 'give_recount_income_total' ); |
|
| 169 | - $this->delete_data( 'give_temp_recount_income' ); |
|
| 168 | + $this->delete_data('give_recount_income_total'); |
|
| 169 | + $this->delete_data('give_temp_recount_income'); |
|
| 170 | 170 | $this->done = true; |
| 171 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
| 171 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
| 172 | 172 | |
| 173 | 173 | return false; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function headers() { |
| 178 | - ignore_user_abort( true ); |
|
| 178 | + ignore_user_abort(true); |
|
| 179 | 179 | |
| 180 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 181 | - set_time_limit( 0 ); |
|
| 180 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 181 | + set_time_limit(0); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return mixed Returns the data from the database |
| 208 | 208 | */ |
| 209 | - private function get_stored_data( $key ) { |
|
| 209 | + private function get_stored_data($key) { |
|
| 210 | 210 | global $wpdb; |
| 211 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
| 211 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
| 212 | 212 | |
| 213 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
| 213 | + return empty($value) ? false : maybe_unserialize($value); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | - private function store_data( $key, $value ) { |
|
| 226 | + private function store_data($key, $value) { |
|
| 227 | 227 | global $wpdb; |
| 228 | 228 | |
| 229 | - $value = maybe_serialize( $value ); |
|
| 229 | + $value = maybe_serialize($value); |
|
| 230 | 230 | |
| 231 | 231 | $data = array( |
| 232 | 232 | 'option_name' => $key, |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | '%s', |
| 241 | 241 | ); |
| 242 | 242 | |
| 243 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
| 243 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return void |
| 254 | 254 | */ |
| 255 | - private function delete_data( $key ) { |
|
| 255 | + private function delete_data($key) { |
|
| 256 | 256 | global $wpdb; |
| 257 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
| 257 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | } |