@@ -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' ); ?> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,47 +23,47 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string $purchase_form |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
| 58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
| 58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
| 59 | 59 | return false; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //Get the form wrap CSS classes. |
| 63 | - $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 64 | 64 | |
| 65 | 65 | //Get the <form> tag wrap CSS classes. |
| 66 | - $form_classes = $form->get_form_classes($args); |
|
| 66 | + $form_classes = $form->get_form_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | ob_start(); |
| 69 | 69 | |
@@ -75,35 +75,35 @@ discard block |
||
| 75 | 75 | * @param int $form ->ID The current form ID |
| 76 | 76 | * @param array $args An array of form args |
| 77 | 77 | */ |
| 78 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
| 78 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
| 79 | 79 | |
| 80 | 80 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 81 | 81 | |
| 82 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 82 | + <?php if ($form->is_close_donation_form()) { |
|
| 83 | 83 | |
| 84 | 84 | //Get Goal thank you message. |
| 85 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 86 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
| 85 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 86 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
| 87 | 87 | |
| 88 | 88 | //Print thank you message. |
| 89 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
| 89 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
| 90 | 90 | |
| 91 | 91 | } else { |
| 92 | 92 | |
| 93 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
| 93 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
| 94 | 94 | |
| 95 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 95 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
| 99 | + do_action('give_pre_form', $form->ID, $args); ?> |
|
| 100 | 100 | |
| 101 | 101 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
| 102 | 102 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 103 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 104 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 105 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 106 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 103 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 104 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 105 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 106 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 107 | 107 | |
| 108 | 108 | <!-- The following field is for robots only, invisible to humans: --> |
| 109 | 109 | <span class="give-hidden" style="display: none !important;"> |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | <?php |
| 115 | 115 | |
| 116 | 116 | //Price ID hidden field for variable (mult-level) donation forms |
| 117 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 117 | + if (give_has_variable_prices($form_id)) { |
|
| 118 | 118 | //get default selected price ID |
| 119 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 119 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 120 | 120 | $price_id = 0; |
| 121 | 121 | //loop through prices |
| 122 | - foreach ( $prices as $price ) { |
|
| 123 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 122 | + foreach ($prices as $price) { |
|
| 123 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 124 | 124 | $price_id = $price['_give_id']['level_id']; |
| 125 | 125 | }; |
| 126 | 126 | } |
@@ -128,20 +128,20 @@ discard block |
||
| 128 | 128 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
| 129 | 129 | <?php } |
| 130 | 130 | |
| 131 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 131 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 132 | 132 | |
| 133 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 133 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 134 | 134 | |
| 135 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 135 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 136 | 136 | |
| 137 | 137 | ?> |
| 138 | 138 | </form> |
| 139 | 139 | |
| 140 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
| 140 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
| 141 | 141 | |
| 142 | 142 | <?php } ?> |
| 143 | 143 | |
| 144 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
| 144 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
| 145 | 145 | <?php |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | * @param int $form ->ID The current form ID |
| 153 | 153 | * @param array $args An array of form args |
| 154 | 154 | */ |
| 155 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 155 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 156 | 156 | |
| 157 | 157 | $final_output = ob_get_clean(); |
| 158 | 158 | |
| 159 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 159 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -175,43 +175,43 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return string |
| 177 | 177 | */ |
| 178 | -function give_show_purchase_form( $form_id ) { |
|
| 178 | +function give_show_purchase_form($form_id) { |
|
| 179 | 179 | |
| 180 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 180 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 181 | 181 | |
| 182 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 182 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 183 | 183 | $form_id = $_POST['give_form_id']; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - do_action( 'give_purchase_form_top', $form_id ); |
|
| 186 | + do_action('give_purchase_form_top', $form_id); |
|
| 187 | 187 | |
| 188 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 188 | + if (give_can_checkout() && isset($form_id)) { |
|
| 189 | 189 | |
| 190 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
| 190 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
| 191 | 191 | |
| 192 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
| 192 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
| 193 | 193 | |
| 194 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
| 194 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
| 195 | 195 | |
| 196 | 196 | // Load the credit card form and allow gateways to load their own if they wish |
| 197 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 198 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
| 197 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 198 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
| 199 | 199 | } else { |
| 200 | - do_action( 'give_cc_form', $form_id ); |
|
| 200 | + do_action('give_cc_form', $form_id); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
| 203 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
| 204 | 204 | |
| 205 | 205 | } else { |
| 206 | 206 | // Can't checkout |
| 207 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
| 207 | + do_action('give_purchase_form_no_access', $form_id); |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
| 211 | + do_action('give_purchase_form_bottom', $form_id); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
| 214 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | 217 | * |
@@ -223,26 +223,26 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | -function give_show_register_login_fields( $form_id ) { |
|
| 226 | +function give_show_register_login_fields($form_id) { |
|
| 227 | 227 | |
| 228 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 228 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 229 | 229 | |
| 230 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
| 230 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
| 231 | 231 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 232 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
| 232 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
| 233 | 233 | </div> |
| 234 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
| 234 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
| 235 | 235 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 236 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
| 236 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
| 237 | 237 | </div> |
| 238 | 238 | <?php endif; ?> |
| 239 | 239 | |
| 240 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 241 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
| 240 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 241 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 245 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * Donation Amount Field |
@@ -256,33 +256,33 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @return void |
| 258 | 258 | */ |
| 259 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 259 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 260 | 260 | |
| 261 | 261 | global $give_options; |
| 262 | 262 | |
| 263 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 264 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 265 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 266 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 267 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 268 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 269 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 263 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 264 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 265 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 266 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 267 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 268 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 269 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 270 | 270 | |
| 271 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 271 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 272 | 272 | |
| 273 | 273 | //Set Price, No Custom Amount Allowed means hidden price field |
| 274 | - if ( $allow_custom_amount == 'no' ) { |
|
| 274 | + if ($allow_custom_amount == 'no') { |
|
| 275 | 275 | ?> |
| 276 | 276 | |
| 277 | - <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
| 277 | + <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
| 278 | 278 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 279 | 279 | value="<?php echo $default_amount; ?>" required> |
| 280 | 280 | <div class="set-price give-donation-amount form-row-wide"> |
| 281 | - <?php if ( $currency_position == 'before' ) { |
|
| 281 | + <?php if ($currency_position == 'before') { |
|
| 282 | 282 | echo $currency_output; |
| 283 | 283 | } ?> |
| 284 | 284 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 285 | - <?php if ( $currency_position == 'after' ) { |
|
| 285 | + <?php if ($currency_position == 'after') { |
|
| 286 | 286 | echo $currency_output; |
| 287 | 287 | } ?> |
| 288 | 288 | </div> |
@@ -292,34 +292,34 @@ discard block |
||
| 292 | 292 | ?> |
| 293 | 293 | <div class="give-total-wrap"> |
| 294 | 294 | <div class="give-donation-amount form-row-wide"> |
| 295 | - <?php if ( $currency_position == 'before' ) { |
|
| 295 | + <?php if ($currency_position == 'before') { |
|
| 296 | 296 | echo $currency_output; |
| 297 | 297 | } ?> |
| 298 | - <label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
| 298 | + <label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
| 299 | 299 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 300 | - <?php if ( $currency_position == 'after' ) { |
|
| 300 | + <?php if ($currency_position == 'after') { |
|
| 301 | 301 | echo $currency_output; |
| 302 | 302 | } ?> |
| 303 | 303 | </div> |
| 304 | 304 | </div> |
| 305 | 305 | <?php } |
| 306 | 306 | |
| 307 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 307 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 308 | 308 | |
| 309 | 309 | //Custom Amount Text |
| 310 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
| 310 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
| 311 | 311 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 312 | 312 | <?php } |
| 313 | 313 | |
| 314 | 314 | //Output Variable Pricing Levels |
| 315 | - if ( $variable_pricing ) { |
|
| 316 | - give_output_levels( $form_id ); |
|
| 315 | + if ($variable_pricing) { |
|
| 316 | + give_output_levels($form_id); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 319 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 322 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -331,32 +331,32 @@ discard block |
||
| 331 | 331 | * |
| 332 | 332 | * @return string |
| 333 | 333 | */ |
| 334 | -function give_output_levels( $form_id ) { |
|
| 334 | +function give_output_levels($form_id) { |
|
| 335 | 335 | |
| 336 | 336 | //Get variable pricing |
| 337 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 338 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 339 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 340 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 341 | - if ( empty( $custom_amount_text ) ) { |
|
| 342 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 337 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 338 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 339 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 340 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 341 | + if (empty($custom_amount_text)) { |
|
| 342 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | $output = ''; |
| 346 | 346 | $counter = 0; |
| 347 | 347 | |
| 348 | - switch ( $display_style ) { |
|
| 348 | + switch ($display_style) { |
|
| 349 | 349 | case 'buttons': |
| 350 | 350 | |
| 351 | 351 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 352 | 352 | |
| 353 | - foreach ( $prices as $price ) { |
|
| 354 | - $counter ++; |
|
| 355 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 356 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 353 | + foreach ($prices as $price) { |
|
| 354 | + $counter++; |
|
| 355 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 356 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 357 | 357 | |
| 358 | 358 | $output .= '<li>'; |
| 359 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 359 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 360 | 360 | $output .= $level_text; |
| 361 | 361 | $output .= '</button>'; |
| 362 | 362 | $output .= '</li>'; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | //Custom Amount |
| 367 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 367 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 368 | 368 | $output .= '<li>'; |
| 369 | 369 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 370 | 370 | $output .= $custom_amount_text; |
@@ -380,23 +380,23 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 382 | 382 | |
| 383 | - foreach ( $prices as $price ) { |
|
| 384 | - $counter ++; |
|
| 385 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 386 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 383 | + foreach ($prices as $price) { |
|
| 384 | + $counter++; |
|
| 385 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 386 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 387 | 387 | |
| 388 | 388 | $output .= '<li>'; |
| 389 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 390 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 389 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 390 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 391 | 391 | $output .= '</li>'; |
| 392 | 392 | |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | //Custom Amount |
| 396 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 396 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 397 | 397 | $output .= '<li>'; |
| 398 | 398 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 399 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 399 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 400 | 400 | $output .= '</li>'; |
| 401 | 401 | } |
| 402 | 402 | |
@@ -406,23 +406,23 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | case 'dropdown': |
| 408 | 408 | |
| 409 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 410 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 409 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 410 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 411 | 411 | |
| 412 | 412 | //first loop through prices |
| 413 | - foreach ( $prices as $price ) { |
|
| 414 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 415 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 413 | + foreach ($prices as $price) { |
|
| 414 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 415 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 416 | 416 | |
| 417 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 417 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 418 | 418 | $output .= $level_text; |
| 419 | 419 | $output .= '</option>'; |
| 420 | 420 | |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | //Custom Amount |
| 424 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 425 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 424 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 425 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $output .= '</select>'; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | break; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 433 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
@@ -442,26 +442,26 @@ discard block |
||
| 442 | 442 | * @param array $args |
| 443 | 443 | * |
| 444 | 444 | */ |
| 445 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 445 | +function give_display_checkout_button($form_id, $args) { |
|
| 446 | 446 | |
| 447 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 447 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 448 | 448 | ? $args['display_style'] |
| 449 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 449 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 450 | 450 | |
| 451 | 451 | //no btn for onpage |
| 452 | - if ( $display_option === 'onpage' ) { |
|
| 452 | + if ($display_option === 'onpage') { |
|
| 453 | 453 | return; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 457 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 456 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 457 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 458 | 458 | |
| 459 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 459 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 460 | 460 | |
| 461 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 461 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 464 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 465 | 465 | |
| 466 | 466 | /** |
| 467 | 467 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -472,71 +472,71 @@ discard block |
||
| 472 | 472 | * |
| 473 | 473 | * @return void |
| 474 | 474 | */ |
| 475 | -function give_user_info_fields( $form_id ) { |
|
| 475 | +function give_user_info_fields($form_id) { |
|
| 476 | 476 | |
| 477 | - if ( is_user_logged_in() ) : |
|
| 478 | - $user_data = get_userdata( get_current_user_id() ); |
|
| 477 | + if (is_user_logged_in()) : |
|
| 478 | + $user_data = get_userdata(get_current_user_id()); |
|
| 479 | 479 | endif; |
| 480 | 480 | |
| 481 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
| 481 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
| 482 | 482 | ?> |
| 483 | 483 | <fieldset id="give_checkout_user_info"> |
| 484 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 484 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 485 | 485 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
| 486 | 486 | <label class="give-label" for="give-first"> |
| 487 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 488 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
| 487 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 488 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
| 489 | 489 | <span class="give-required-indicator">*</span> |
| 490 | 490 | <?php } ?> |
| 491 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 491 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 492 | 492 | </label> |
| 493 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_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 ) ) { |
|
| 493 | + <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)) { |
|
| 494 | 494 | echo ' required '; |
| 495 | 495 | } ?>/> |
| 496 | 496 | </p> |
| 497 | 497 | |
| 498 | 498 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
| 499 | 499 | <label class="give-label" for="give-last"> |
| 500 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 501 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
| 500 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 501 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
| 502 | 502 | <span class="give-required-indicator">*</span> |
| 503 | 503 | <?php } ?> |
| 504 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 504 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 505 | 505 | </label> |
| 506 | 506 | |
| 507 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 507 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 508 | 508 | echo ' required'; |
| 509 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_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 ) ) { |
|
| 509 | + } ?>" 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)) { |
|
| 510 | 510 | echo ' required '; |
| 511 | 511 | } ?> /> |
| 512 | 512 | </p> |
| 513 | 513 | |
| 514 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
| 514 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
| 515 | 515 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 516 | 516 | <label class="give-label" for="give-email"> |
| 517 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 518 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 517 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 518 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 519 | 519 | <span class="give-required-indicator">*</span> |
| 520 | 520 | <?php } ?> |
| 521 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
| 521 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
| 522 | 522 | </label> |
| 523 | 523 | |
| 524 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_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 ) ) { |
|
| 524 | + <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)) { |
|
| 525 | 525 | echo ' required '; |
| 526 | 526 | } ?>/> |
| 527 | 527 | |
| 528 | 528 | </p> |
| 529 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
| 529 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
| 530 | 530 | |
| 531 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
| 531 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
| 532 | 532 | </fieldset> |
| 533 | 533 | <?php |
| 534 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
| 534 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
| 535 | 535 | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
| 539 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 538 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
| 539 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 540 | 540 | |
| 541 | 541 | /** |
| 542 | 542 | * Renders the credit card info form. |
@@ -547,73 +547,73 @@ discard block |
||
| 547 | 547 | * |
| 548 | 548 | * @return void |
| 549 | 549 | */ |
| 550 | -function give_get_cc_form( $form_id ) { |
|
| 550 | +function give_get_cc_form($form_id) { |
|
| 551 | 551 | |
| 552 | 552 | ob_start(); |
| 553 | 553 | |
| 554 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
| 554 | + do_action('give_before_cc_fields', $form_id); ?> |
|
| 555 | 555 | |
| 556 | 556 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 557 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 558 | - <?php if ( is_ssl() ) : ?> |
|
| 557 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 558 | + <?php if (is_ssl()) : ?> |
|
| 559 | 559 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 560 | 560 | <span class="give-icon padlock"></span> |
| 561 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 561 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 562 | 562 | </div> |
| 563 | 563 | <?php endif; ?> |
| 564 | 564 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 565 | 565 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 566 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 566 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 567 | 567 | <span class="give-required-indicator">*</span> |
| 568 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 568 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 569 | 569 | <span class="card-type"></span> |
| 570 | 570 | </label> |
| 571 | 571 | |
| 572 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/> |
|
| 572 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/> |
|
| 573 | 573 | </p> |
| 574 | 574 | |
| 575 | 575 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
| 576 | 576 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 577 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 577 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 578 | 578 | <span class="give-required-indicator">*</span> |
| 579 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 579 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 580 | 580 | </label> |
| 581 | 581 | |
| 582 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" required/> |
|
| 582 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" required/> |
|
| 583 | 583 | </p> |
| 584 | 584 | |
| 585 | 585 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 586 | 586 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 587 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 587 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 588 | 588 | <span class="give-required-indicator">*</span> |
| 589 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 589 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 590 | 590 | </label> |
| 591 | 591 | |
| 592 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/> |
|
| 592 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/> |
|
| 593 | 593 | </p> |
| 594 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
| 594 | + <?php do_action('give_before_cc_expiration'); ?> |
|
| 595 | 595 | <p class="card-expiration form-row form-row-one-third"> |
| 596 | 596 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 597 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 597 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 598 | 598 | <span class="give-required-indicator">*</span> |
| 599 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 599 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 600 | 600 | </label> |
| 601 | 601 | |
| 602 | 602 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
| 603 | 603 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
| 604 | 604 | |
| 605 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/> |
|
| 605 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/> |
|
| 606 | 606 | </p> |
| 607 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
| 607 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
| 608 | 608 | |
| 609 | 609 | </fieldset> |
| 610 | 610 | <?php |
| 611 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 611 | + do_action('give_after_cc_fields', $form_id); |
|
| 612 | 612 | |
| 613 | 613 | echo ob_get_clean(); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 616 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 617 | 617 | |
| 618 | 618 | /** |
| 619 | 619 | * Outputs the default credit card address fields |
@@ -624,110 +624,110 @@ discard block |
||
| 624 | 624 | * |
| 625 | 625 | * @return void |
| 626 | 626 | */ |
| 627 | -function give_default_cc_address_fields( $form_id ) { |
|
| 627 | +function give_default_cc_address_fields($form_id) { |
|
| 628 | 628 | |
| 629 | 629 | $logged_in = is_user_logged_in(); |
| 630 | 630 | |
| 631 | - if ( $logged_in ) { |
|
| 632 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 631 | + if ($logged_in) { |
|
| 632 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 633 | 633 | } |
| 634 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 635 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 636 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 637 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 634 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 635 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 636 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 637 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 638 | 638 | ob_start(); ?> |
| 639 | 639 | <fieldset id="give_cc_address" class="cc-address"> |
| 640 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 641 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
| 640 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 641 | + <?php do_action('give_cc_billing_top'); ?> |
|
| 642 | 642 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
| 643 | 643 | <label for="card_address" class="give-label"> |
| 644 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 644 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 645 | 645 | <?php |
| 646 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
| 646 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
| 647 | 647 | <span class="give-required-indicator">*</span> |
| 648 | 648 | <?php } ?> |
| 649 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 649 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 650 | 650 | </label> |
| 651 | 651 | |
| 652 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 652 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 653 | 653 | echo ' required'; |
| 654 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 654 | + } ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 655 | 655 | echo ' required '; |
| 656 | 656 | } ?>/> |
| 657 | 657 | </p> |
| 658 | 658 | |
| 659 | 659 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
| 660 | 660 | <label for="card_address_2" class="give-label"> |
| 661 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 662 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
| 661 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 662 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
| 663 | 663 | <span class="give-required-indicator">*</span> |
| 664 | 664 | <?php } ?> |
| 665 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 665 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 666 | 666 | </label> |
| 667 | 667 | |
| 668 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 668 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 669 | 669 | echo ' required'; |
| 670 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 670 | + } ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 671 | 671 | echo ' required '; |
| 672 | 672 | } ?>/> |
| 673 | 673 | </p> |
| 674 | 674 | |
| 675 | 675 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
| 676 | 676 | <label for="card_city" class="give-label"> |
| 677 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 678 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
| 677 | + <?php esc_html_e('City', 'give'); ?> |
|
| 678 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
| 679 | 679 | <span class="give-required-indicator">*</span> |
| 680 | 680 | <?php } ?> |
| 681 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 681 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 682 | 682 | </label> |
| 683 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 683 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 684 | 684 | echo ' required'; |
| 685 | - } ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 685 | + } ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 686 | 686 | echo ' required '; |
| 687 | 687 | } ?>/> |
| 688 | 688 | </p> |
| 689 | 689 | |
| 690 | 690 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
| 691 | 691 | <label for="card_zip" class="give-label"> |
| 692 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 693 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
| 692 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 693 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
| 694 | 694 | <span class="give-required-indicator">*</span> |
| 695 | 695 | <?php } ?> |
| 696 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 696 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 697 | 697 | </label> |
| 698 | 698 | |
| 699 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 699 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 700 | 700 | echo ' required'; |
| 701 | - } ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 701 | + } ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 702 | 702 | echo ' required '; |
| 703 | 703 | } ?>/> |
| 704 | 704 | </p> |
| 705 | 705 | |
| 706 | 706 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
| 707 | 707 | <label for="billing_country" class="give-label"> |
| 708 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 709 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
| 708 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 709 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
| 710 | 710 | <span class="give-required-indicator">*</span> |
| 711 | 711 | <?php } ?> |
| 712 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 712 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 713 | 713 | </label> |
| 714 | 714 | |
| 715 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 715 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 716 | 716 | echo ' required'; |
| 717 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 717 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 718 | 718 | echo ' required '; |
| 719 | 719 | } ?>> |
| 720 | 720 | <?php |
| 721 | 721 | |
| 722 | 722 | $selected_country = give_get_country(); |
| 723 | 723 | |
| 724 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
| 724 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
| 725 | 725 | $selected_country = $user_address['country']; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | $countries = give_get_country_list(); |
| 729 | - foreach ( $countries as $country_code => $country ) { |
|
| 730 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 729 | + foreach ($countries as $country_code => $country) { |
|
| 730 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 731 | 731 | } |
| 732 | 732 | ?> |
| 733 | 733 | </select> |
@@ -735,44 +735,44 @@ discard block |
||
| 735 | 735 | |
| 736 | 736 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
| 737 | 737 | <label for="card_state" class="give-label"> |
| 738 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 739 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
| 738 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 739 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
| 740 | 740 | <span class="give-required-indicator">*</span> |
| 741 | 741 | <?php } ?> |
| 742 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 742 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 743 | 743 | </label> |
| 744 | 744 | |
| 745 | 745 | <?php |
| 746 | 746 | $selected_state = give_get_state(); |
| 747 | - $states = give_get_states( $selected_country ); |
|
| 747 | + $states = give_get_states($selected_country); |
|
| 748 | 748 | |
| 749 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
| 749 | + if ($logged_in && ! empty($user_address['state'])) { |
|
| 750 | 750 | $selected_state = $user_address['state']; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - if ( ! empty( $states ) ) : ?> |
|
| 754 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 753 | + if ( ! empty($states)) : ?> |
|
| 754 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 755 | 755 | echo ' required'; |
| 756 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 756 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 757 | 757 | echo ' required '; |
| 758 | 758 | } ?>> |
| 759 | 759 | <?php |
| 760 | - foreach ( $states as $state_code => $state ) { |
|
| 761 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 760 | + foreach ($states as $state_code => $state) { |
|
| 761 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 762 | 762 | } |
| 763 | 763 | ?> |
| 764 | 764 | </select> |
| 765 | 765 | <?php else : ?> |
| 766 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 766 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 767 | 767 | <?php endif; ?> |
| 768 | 768 | </p> |
| 769 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
| 769 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
| 770 | 770 | </fieldset> |
| 771 | 771 | <?php |
| 772 | 772 | echo ob_get_clean(); |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 775 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 776 | 776 | |
| 777 | 777 | |
| 778 | 778 | /** |
@@ -784,93 +784,93 @@ discard block |
||
| 784 | 784 | * |
| 785 | 785 | * @return string |
| 786 | 786 | */ |
| 787 | -function give_get_register_fields( $form_id ) { |
|
| 787 | +function give_get_register_fields($form_id) { |
|
| 788 | 788 | |
| 789 | 789 | global $user_ID; |
| 790 | 790 | |
| 791 | - if ( is_user_logged_in() ) { |
|
| 792 | - $user_data = get_userdata( $user_ID ); |
|
| 791 | + if (is_user_logged_in()) { |
|
| 792 | + $user_data = get_userdata($user_ID); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 795 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 796 | 796 | |
| 797 | 797 | ob_start(); ?> |
| 798 | 798 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 799 | 799 | |
| 800 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 800 | + <?php if ($show_register_form == 'both') { ?> |
|
| 801 | 801 | <div class="give-login-account-wrap"> |
| 802 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 803 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 802 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 803 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 804 | 804 | </p> |
| 805 | 805 | <p class="give-loading-text"> |
| 806 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
| 806 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
| 807 | 807 | </div> |
| 808 | 808 | <?php } ?> |
| 809 | 809 | |
| 810 | - <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
| 810 | + <?php do_action('give_register_fields_before', $form_id); ?> |
|
| 811 | 811 | |
| 812 | 812 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 813 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 814 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 815 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 813 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 814 | + if ( ! give_logged_in_only($form_id)) { |
|
| 815 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 816 | 816 | } ?></legend> |
| 817 | - <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
| 817 | + <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
| 818 | 818 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
| 819 | 819 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 820 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 821 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 820 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 821 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 822 | 822 | <span class="give-required-indicator">*</span> |
| 823 | 823 | <?php } ?> |
| 824 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 824 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 825 | 825 | </label> |
| 826 | 826 | |
| 827 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 827 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
| 828 | 828 | echo 'required '; |
| 829 | - } ?>give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"/> |
|
| 829 | + } ?>give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>"/> |
|
| 830 | 830 | </div> |
| 831 | 831 | |
| 832 | 832 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
| 833 | 833 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 834 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 835 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 834 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 835 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 836 | 836 | <span class="give-required-indicator">*</span> |
| 837 | 837 | <?php } ?> |
| 838 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 838 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 839 | 839 | </label> |
| 840 | 840 | |
| 841 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 841 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
| 842 | 842 | echo 'required '; |
| 843 | - } ?>give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"/> |
|
| 843 | + } ?>give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"/> |
|
| 844 | 844 | </div> |
| 845 | 845 | |
| 846 | 846 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
| 847 | 847 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 848 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 849 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 848 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 849 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 850 | 850 | <span class="give-required-indicator">*</span> |
| 851 | 851 | <?php } ?> |
| 852 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 852 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 853 | 853 | </label> |
| 854 | 854 | |
| 855 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 855 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
| 856 | 856 | echo 'required '; |
| 857 | - } ?>give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
| 857 | + } ?>give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"/> |
|
| 858 | 858 | </div> |
| 859 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
| 859 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
| 860 | 860 | </fieldset> |
| 861 | 861 | |
| 862 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
| 862 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
| 863 | 863 | |
| 864 | 864 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
| 865 | 865 | |
| 866 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
| 866 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
| 867 | 867 | |
| 868 | 868 | </fieldset> |
| 869 | 869 | <?php |
| 870 | 870 | echo ob_get_clean(); |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
| 873 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | 876 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -883,79 +883,79 @@ discard block |
||
| 883 | 883 | * |
| 884 | 884 | * @return string |
| 885 | 885 | */ |
| 886 | -function give_get_login_fields( $form_id ) { |
|
| 886 | +function give_get_login_fields($form_id) { |
|
| 887 | 887 | |
| 888 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 889 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 888 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 889 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 890 | 890 | |
| 891 | 891 | ob_start(); |
| 892 | 892 | ?> |
| 893 | 893 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 894 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 895 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 896 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 894 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 895 | + if ( ! give_logged_in_only($form_id)) { |
|
| 896 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 897 | 897 | } ?> |
| 898 | 898 | </legend> |
| 899 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 899 | + <?php if ($show_register_form == 'both') { ?> |
|
| 900 | 900 | <p class="give-new-account-link"> |
| 901 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 902 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
| 903 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 904 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 905 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 901 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 902 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
| 903 | + <?php esc_html_e('Register', 'give'); |
|
| 904 | + if ( ! give_logged_in_only($form_id)) { |
|
| 905 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 906 | 906 | } ?> |
| 907 | 907 | </a> |
| 908 | 908 | </p> |
| 909 | 909 | <p class="give-loading-text"> |
| 910 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
| 910 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
| 911 | 911 | <?php } ?> |
| 912 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
| 912 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
| 913 | 913 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
| 914 | 914 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 915 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 916 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 915 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 916 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 917 | 917 | <span class="give-required-indicator">*</span> |
| 918 | 918 | <?php } ?> |
| 919 | 919 | </label> |
| 920 | 920 | |
| 921 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 921 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
| 922 | 922 | echo 'required '; |
| 923 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/> |
|
| 923 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/> |
|
| 924 | 924 | </div> |
| 925 | 925 | |
| 926 | 926 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
| 927 | 927 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 928 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 929 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 928 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 929 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 930 | 930 | <span class="give-required-indicator">*</span> |
| 931 | 931 | <?php } ?> |
| 932 | 932 | </label> |
| 933 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
| 933 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
| 934 | 934 | echo 'required '; |
| 935 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/> |
|
| 935 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/> |
|
| 936 | 936 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 937 | 937 | </div> |
| 938 | 938 | |
| 939 | 939 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 940 | 940 | <span class="give-forgot-password "> |
| 941 | - <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset Password' ) ?></a> |
|
| 941 | + <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset Password') ?></a> |
|
| 942 | 942 | </span> |
| 943 | 943 | </div> |
| 944 | 944 | |
| 945 | 945 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 946 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 947 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 948 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 946 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 947 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 948 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 949 | 949 | <?php } ?> |
| 950 | 950 | <span class="give-loading-animation"></span> |
| 951 | 951 | </div> |
| 952 | - <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
| 952 | + <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
| 953 | 953 | </fieldset><!--end #give-login-fields--> |
| 954 | 954 | <?php |
| 955 | 955 | echo ob_get_clean(); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 958 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 959 | 959 | |
| 960 | 960 | /** |
| 961 | 961 | * Payment Mode Select |
@@ -971,49 +971,49 @@ discard block |
||
| 971 | 971 | * |
| 972 | 972 | * @return void |
| 973 | 973 | */ |
| 974 | -function give_payment_mode_select( $form_id ) { |
|
| 974 | +function give_payment_mode_select($form_id) { |
|
| 975 | 975 | |
| 976 | 976 | $gateways = give_get_enabled_payment_gateways(); |
| 977 | 977 | |
| 978 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
| 978 | + do_action('give_payment_mode_top', $form_id); ?> |
|
| 979 | 979 | |
| 980 | 980 | <fieldset id="give-payment-mode-select"> |
| 981 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
| 981 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
| 982 | 982 | <div id="give-payment-mode-wrap"> |
| 983 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 984 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
| 983 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 984 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
| 985 | 985 | </legend> |
| 986 | 986 | <?php |
| 987 | 987 | |
| 988 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
| 988 | + do_action('give_payment_mode_before_gateways') ?> |
|
| 989 | 989 | |
| 990 | 990 | <ul id="give-gateway-radio-list"> |
| 991 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 992 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
| 991 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
| 992 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
| 993 | 993 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
| 994 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
| 995 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
| 994 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
| 995 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
| 996 | 996 | echo '</label></li>'; |
| 997 | 997 | endforeach; ?> |
| 998 | 998 | </ul> |
| 999 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
| 999 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
| 1000 | 1000 | </div> |
| 1001 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
| 1001 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
| 1002 | 1002 | </fieldset> |
| 1003 | 1003 | |
| 1004 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
| 1004 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
| 1005 | 1005 | |
| 1006 | 1006 | <div id="give_purchase_form_wrap"> |
| 1007 | 1007 | |
| 1008 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
| 1008 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
| 1009 | 1009 | |
| 1010 | 1010 | </div><!-- the checkout fields are loaded into this--> |
| 1011 | 1011 | |
| 1012 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
| 1012 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
| 1013 | 1013 | |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1016 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1017 | 1017 | |
| 1018 | 1018 | |
| 1019 | 1019 | /** |
@@ -1027,36 +1027,36 @@ discard block |
||
| 1027 | 1027 | * |
| 1028 | 1028 | * @return void |
| 1029 | 1029 | */ |
| 1030 | -function give_terms_agreement( $form_id ) { |
|
| 1030 | +function give_terms_agreement($form_id) { |
|
| 1031 | 1031 | |
| 1032 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1033 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
| 1034 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1032 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1033 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
| 1034 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1035 | 1035 | |
| 1036 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
| 1036 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
| 1037 | 1037 | <fieldset id="give_terms_agreement"> |
| 1038 | - <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
| 1038 | + <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
| 1039 | 1039 | <?php |
| 1040 | - do_action( 'give_before_terms' ); |
|
| 1041 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1042 | - do_action( 'give_after_terms' ); |
|
| 1040 | + do_action('give_before_terms'); |
|
| 1041 | + echo wpautop(stripslashes($terms)); |
|
| 1042 | + do_action('give_after_terms'); |
|
| 1043 | 1043 | ?> |
| 1044 | 1044 | </div> |
| 1045 | 1045 | <div id="give_show_terms"> |
| 1046 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1047 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1046 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1047 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1048 | 1048 | </div> |
| 1049 | 1049 | |
| 1050 | 1050 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
| 1051 | 1051 | <label |
| 1052 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label> |
|
| 1052 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label> |
|
| 1053 | 1053 | |
| 1054 | 1054 | </fieldset> |
| 1055 | 1055 | <?php |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
| 1059 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
| 1060 | 1060 | |
| 1061 | 1061 | /** |
| 1062 | 1062 | * Checkout Final Total |
@@ -1069,27 +1069,27 @@ discard block |
||
| 1069 | 1069 | * |
| 1070 | 1070 | * @return void |
| 1071 | 1071 | */ |
| 1072 | -function give_checkout_final_total( $form_id ) { |
|
| 1072 | +function give_checkout_final_total($form_id) { |
|
| 1073 | 1073 | |
| 1074 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1075 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1074 | + if (isset($_POST['give_total'])) { |
|
| 1075 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1076 | 1076 | } else { |
| 1077 | 1077 | //default total |
| 1078 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1078 | + $total = give_get_default_form_amount($form_id); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | //Only proceed if give_total available |
| 1081 | - if ( empty( $total ) ) { |
|
| 1081 | + if (empty($total)) { |
|
| 1082 | 1082 | return; |
| 1083 | 1083 | } |
| 1084 | 1084 | ?> |
| 1085 | 1085 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1086 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1087 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1086 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1087 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1088 | 1088 | </p> |
| 1089 | 1089 | <?php |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1092 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1093 | 1093 | |
| 1094 | 1094 | |
| 1095 | 1095 | /** |
@@ -1101,22 +1101,22 @@ discard block |
||
| 1101 | 1101 | * |
| 1102 | 1102 | * @return void |
| 1103 | 1103 | */ |
| 1104 | -function give_checkout_submit( $form_id ) { |
|
| 1104 | +function give_checkout_submit($form_id) { |
|
| 1105 | 1105 | ?> |
| 1106 | 1106 | <fieldset id="give_purchase_submit"> |
| 1107 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
| 1107 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
| 1108 | 1108 | |
| 1109 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
| 1109 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
| 1110 | 1110 | |
| 1111 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
| 1111 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
| 1112 | 1112 | |
| 1113 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
| 1113 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
| 1114 | 1114 | |
| 1115 | 1115 | </fieldset> |
| 1116 | 1116 | <?php |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1119 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1120 | 1120 | |
| 1121 | 1121 | |
| 1122 | 1122 | /** |
@@ -1129,17 +1129,17 @@ discard block |
||
| 1129 | 1129 | * |
| 1130 | 1130 | * @return string |
| 1131 | 1131 | */ |
| 1132 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1132 | +function give_checkout_button_purchase($form_id) { |
|
| 1133 | 1133 | |
| 1134 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1135 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1134 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1135 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1136 | 1136 | ob_start(); ?> |
| 1137 | 1137 | <div class="give-submit-button-wrap give-clearfix"> |
| 1138 | 1138 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
| 1139 | 1139 | <span class="give-loading-animation"></span> |
| 1140 | 1140 | </div> |
| 1141 | 1141 | <?php |
| 1142 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1142 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | /** |
@@ -1152,18 +1152,18 @@ discard block |
||
| 1152 | 1152 | * |
| 1153 | 1153 | * @return void |
| 1154 | 1154 | */ |
| 1155 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1155 | +function give_agree_to_terms_js($form_id) { |
|
| 1156 | 1156 | |
| 1157 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1157 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1158 | 1158 | |
| 1159 | - if ( $form_option === 'yes' ) { |
|
| 1159 | + if ($form_option === 'yes') { |
|
| 1160 | 1160 | ?> |
| 1161 | 1161 | <script type="text/javascript"> |
| 1162 | 1162 | jQuery(document).ready(function ($) { |
| 1163 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1163 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1164 | 1164 | e.preventDefault(); |
| 1165 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1166 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1165 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1166 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1167 | 1167 | return false; |
| 1168 | 1168 | }); |
| 1169 | 1169 | }); |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1175 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1176 | 1176 | |
| 1177 | 1177 | /** |
| 1178 | 1178 | * Show Give Goals |
@@ -1187,17 +1187,17 @@ discard block |
||
| 1187 | 1187 | * @return mixed |
| 1188 | 1188 | */ |
| 1189 | 1189 | |
| 1190 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1190 | +function give_show_goal_progress($form_id, $args) { |
|
| 1191 | 1191 | |
| 1192 | 1192 | ob_start(); |
| 1193 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1193 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1194 | 1194 | |
| 1195 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1195 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1196 | 1196 | |
| 1197 | 1197 | return true; |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1200 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1201 | 1201 | |
| 1202 | 1202 | /** |
| 1203 | 1203 | * Adds Actions to Render Form Content |
@@ -1209,19 +1209,19 @@ discard block |
||
| 1209 | 1209 | * |
| 1210 | 1210 | * @return void |
| 1211 | 1211 | */ |
| 1212 | -function give_form_content( $form_id, $args ) { |
|
| 1212 | +function give_form_content($form_id, $args) { |
|
| 1213 | 1213 | |
| 1214 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1214 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1215 | 1215 | ? $args['show_content'] |
| 1216 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1216 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1217 | 1217 | |
| 1218 | - if ( $show_content !== 'none' ) { |
|
| 1218 | + if ($show_content !== 'none') { |
|
| 1219 | 1219 | //add action according to value |
| 1220 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1220 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1221 | 1221 | } |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1224 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1225 | 1225 | |
| 1226 | 1226 | /** |
| 1227 | 1227 | * Renders Post Form Content |
@@ -1233,24 +1233,24 @@ discard block |
||
| 1233 | 1233 | * @return void |
| 1234 | 1234 | * @since 1.0 |
| 1235 | 1235 | */ |
| 1236 | -function give_form_display_content( $form_id, $args ) { |
|
| 1236 | +function give_form_display_content($form_id, $args) { |
|
| 1237 | 1237 | |
| 1238 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1239 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1238 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1239 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1240 | 1240 | ? $args['show_content'] |
| 1241 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1241 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1242 | 1242 | |
| 1243 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
| 1244 | - $content = apply_filters( 'the_content', $content ); |
|
| 1243 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
| 1244 | + $content = apply_filters('the_content', $content); |
|
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
| 1247 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
| 1248 | 1248 | |
| 1249 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1249 | + echo apply_filters('give_form_content_output', $output); |
|
| 1250 | 1250 | |
| 1251 | 1251 | //remove action to prevent content output on addition forms on page |
| 1252 | 1252 | //@see: https://github.com/WordImpress/Give/issues/634 |
| 1253 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1253 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | |
@@ -1263,16 +1263,16 @@ discard block |
||
| 1263 | 1263 | * |
| 1264 | 1264 | * @return void |
| 1265 | 1265 | */ |
| 1266 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1266 | +function give_checkout_hidden_fields($form_id) { |
|
| 1267 | 1267 | |
| 1268 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1269 | - if ( is_user_logged_in() ) { ?> |
|
| 1268 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1269 | + if (is_user_logged_in()) { ?> |
|
| 1270 | 1270 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1271 | 1271 | <?php } ?> |
| 1272 | 1272 | <input type="hidden" name="give_action" value="purchase"/> |
| 1273 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1273 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1274 | 1274 | <?php |
| 1275 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1275 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1276 | 1276 | |
| 1277 | 1277 | } |
| 1278 | 1278 | |
@@ -1287,20 +1287,20 @@ discard block |
||
| 1287 | 1287 | * |
| 1288 | 1288 | * @return string $content Filtered content |
| 1289 | 1289 | */ |
| 1290 | -function give_filter_success_page_content( $content ) { |
|
| 1290 | +function give_filter_success_page_content($content) { |
|
| 1291 | 1291 | |
| 1292 | 1292 | global $give_options; |
| 1293 | 1293 | |
| 1294 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1295 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1296 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1294 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1295 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1296 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | return $content; |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1303 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1304 | 1304 | |
| 1305 | 1305 | |
| 1306 | 1306 | /** |
@@ -1312,14 +1312,14 @@ discard block |
||
| 1312 | 1312 | |
| 1313 | 1313 | function give_test_mode_frontend_warning() { |
| 1314 | 1314 | |
| 1315 | - $test_mode = give_get_option( 'test_mode' ); |
|
| 1315 | + $test_mode = give_get_option('test_mode'); |
|
| 1316 | 1316 | |
| 1317 | - if ( $test_mode == 'on' ) { |
|
| 1318 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
| 1317 | + if ($test_mode == 'on') { |
|
| 1318 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice', 'give').'</strong>: '.esc_html__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
| 1319 | 1319 | } |
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1322 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1323 | 1323 | |
| 1324 | 1324 | |
| 1325 | 1325 | /** |
@@ -1335,21 +1335,21 @@ discard block |
||
| 1335 | 1335 | * @return string |
| 1336 | 1336 | */ |
| 1337 | 1337 | |
| 1338 | -function give_members_only_form( $final_output, $args ) { |
|
| 1338 | +function give_members_only_form($final_output, $args) { |
|
| 1339 | 1339 | |
| 1340 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1340 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1341 | 1341 | |
| 1342 | 1342 | //Sanity Check: Must have form_id & not be logged in |
| 1343 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1343 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1344 | 1344 | return $final_output; |
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | //Logged in only and Register / Login set to none |
| 1348 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1348 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1349 | 1349 | |
| 1350 | - $final_output = give_output_error( esc_html__( 'Please login in order to complete your donation.', 'give' ), false ); |
|
| 1350 | + $final_output = give_output_error(esc_html__('Please login in order to complete your donation.', 'give'), false); |
|
| 1351 | 1351 | |
| 1352 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1352 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1353 | 1353 | |
| 1354 | 1354 | } |
| 1355 | 1355 | |
@@ -1357,4 +1357,4 @@ discard block |
||
| 1357 | 1357 | |
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1360 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -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 Transaction 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 Transaction 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,114 +300,114 @@ 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/admin-actions.php'; |
|
| 373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 377 | - |
|
| 378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 380 | - |
|
| 381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 386 | - |
|
| 387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
| 388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
| 390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
| 391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 394 | - |
|
| 395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 404 | - |
|
| 405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 406 | - 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/admin-actions.php'; |
|
| 373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 377 | + |
|
| 378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 380 | + |
|
| 381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 386 | + |
|
| 387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
| 388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
| 390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
| 391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 394 | + |
|
| 395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 404 | + |
|
| 405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 407 | 407 | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 410 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 411 | 411 | |
| 412 | 412 | } |
| 413 | 413 | |
@@ -421,26 +421,26 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function load_textdomain() {
|
| 423 | 423 | // Set filter for Give's languages directory |
| 424 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 425 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 424 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 425 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 426 | 426 | |
| 427 | 427 | // Traditional WordPress plugin locale filter |
| 428 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 429 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 428 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 429 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 430 | 430 | |
| 431 | 431 | // Setup paths to current locale file |
| 432 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 433 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 432 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 433 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 434 | 434 | |
| 435 | - if ( file_exists( $mofile_global ) ) {
|
|
| 435 | + if (file_exists($mofile_global)) {
|
|
| 436 | 436 | // Look in global /wp-content/languages/give folder |
| 437 | - load_textdomain( 'give', $mofile_global ); |
|
| 438 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 437 | + load_textdomain('give', $mofile_global);
|
|
| 438 | + } elseif (file_exists($mofile_local)) {
|
|
| 439 | 439 | // Look in local location from filter `give_languages_directory` |
| 440 | - load_textdomain( 'give', $mofile_local ); |
|
| 440 | + load_textdomain('give', $mofile_local);
|
|
| 441 | 441 | } else {
|
| 442 | 442 | // Load the default language files packaged up w/ Give |
| 443 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 443 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return mixed |
| 24 | 24 | */ |
| 25 | 25 | function give_get_price_decimals() { |
| 26 | - return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) ); |
|
| 26 | + return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) ); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return mixed |
| 35 | 35 | */ |
| 36 | 36 | function give_get_price_thousand_separator() { |
| 37 | - return give_get_option( 'thousands_separator', ',' ); |
|
| 37 | + return give_get_option( 'thousands_separator', ',' ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | 47 | function give_get_price_decimal_separator() { |
| 48 | - return give_get_option( 'decimal_separator', '.' ); |
|
| 48 | + return give_get_option( 'decimal_separator', '.' ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -64,58 +64,58 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
| 66 | 66 | |
| 67 | - // Bailout. |
|
| 68 | - if( empty( $number ) ) { |
|
| 69 | - return $number; |
|
| 70 | - } |
|
| 67 | + // Bailout. |
|
| 68 | + if( empty( $number ) ) { |
|
| 69 | + return $number; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $thousand_separator = give_get_price_thousand_separator(); |
|
| 72 | + $thousand_separator = give_get_price_thousand_separator(); |
|
| 73 | 73 | |
| 74 | - $locale = localeconv(); |
|
| 75 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
| 74 | + $locale = localeconv(); |
|
| 75 | + $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
| 76 | 76 | |
| 77 | - // Remove locale from string |
|
| 78 | - if ( ! is_float( $number ) ) { |
|
| 79 | - $number = str_replace( $decimals, '.', $number ); |
|
| 80 | - } |
|
| 77 | + // Remove locale from string |
|
| 78 | + if ( ! is_float( $number ) ) { |
|
| 79 | + $number = str_replace( $decimals, '.', $number ); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - // Remove thousand amount formatting if amount has. |
|
| 83 | - // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
|
| 84 | - // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
|
| 85 | - if( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
| 86 | - $number = str_replace( $thousand_separator, '', $number ); |
|
| 87 | - } |
|
| 82 | + // Remove thousand amount formatting if amount has. |
|
| 83 | + // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
|
| 84 | + // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
|
| 85 | + if( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
| 86 | + $number = str_replace( $thousand_separator, '', $number ); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - // Remove non numeric entity before decimal separator. |
|
| 90 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
| 91 | - $default_dp = give_get_price_decimals(); |
|
| 89 | + // Remove non numeric entity before decimal separator. |
|
| 90 | + $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
| 91 | + $default_dp = give_get_price_decimals(); |
|
| 92 | 92 | |
| 93 | - // Format number of decimals in number. |
|
| 94 | - if( false !== $dp ) { |
|
| 95 | - $dp = intval( empty( $dp ) ? $default_dp : $dp ); |
|
| 96 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
| 97 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
| 98 | - } |
|
| 93 | + // Format number of decimals in number. |
|
| 94 | + if( false !== $dp ) { |
|
| 95 | + $dp = intval( empty( $dp ) ? $default_dp : $dp ); |
|
| 96 | + $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
| 97 | + $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - // Reset negative amount to zero. |
|
| 100 | + // Reset negative amount to zero. |
|
| 101 | 101 | if ( 0 > $number ) { |
| 102 | 102 | $number = number_format( 0, $default_dp, '.' ); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - // If number does not have decimal then add number of decimals to it. |
|
| 106 | - if( |
|
| 107 | - false === strpos( $number, '.' ) |
|
| 108 | - || ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) ) |
|
| 109 | - ) { |
|
| 110 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
| 111 | - } |
|
| 105 | + // If number does not have decimal then add number of decimals to it. |
|
| 106 | + if( |
|
| 107 | + false === strpos( $number, '.' ) |
|
| 108 | + || ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) ) |
|
| 109 | + ) { |
|
| 110 | + $number = number_format( $number, $default_dp, '.', '' ); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - // Trim zeros. |
|
| 114 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
| 115 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
| 116 | - } |
|
| 113 | + // Trim zeros. |
|
| 114 | + if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
| 115 | + $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
| 118 | + return apply_filters( 'give_sanitize_amount', $number ); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -186,42 +186,42 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | function give_human_format_large_amount( $amount ) { |
| 188 | 188 | |
| 189 | - // Get thousand separator. |
|
| 190 | - $thousands_sep = give_get_price_thousand_separator(); |
|
| 189 | + // Get thousand separator. |
|
| 190 | + $thousands_sep = give_get_price_thousand_separator(); |
|
| 191 | 191 | |
| 192 | - // Sanitize amount. |
|
| 193 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
| 192 | + // Sanitize amount. |
|
| 193 | + $sanitize_amount = give_sanitize_amount( $amount ); |
|
| 194 | 194 | |
| 195 | - // Explode amount to calculate name of large numbers. |
|
| 195 | + // Explode amount to calculate name of large numbers. |
|
| 196 | 196 | $amount_array = explode( $thousands_sep, $amount ); |
| 197 | 197 | |
| 198 | - // Calculate amount parts count. |
|
| 199 | - $amount_count_parts = count( $amount_array ); |
|
| 198 | + // Calculate amount parts count. |
|
| 199 | + $amount_count_parts = count( $amount_array ); |
|
| 200 | 200 | |
| 201 | - // Calculate large number formatted amount. |
|
| 202 | - if ( 4 < $amount_count_parts ){ |
|
| 203 | - $sanitize_amount = sprintf( |
|
| 201 | + // Calculate large number formatted amount. |
|
| 202 | + if ( 4 < $amount_count_parts ){ |
|
| 203 | + $sanitize_amount = sprintf( |
|
| 204 | 204 | /* translators: %s: number */ |
| 205 | 205 | esc_html__( '%s trillion', 'give' ), |
| 206 | 206 | round( ( $sanitize_amount / 1000000000000 ), 2 ) |
| 207 | 207 | ); |
| 208 | - } elseif ( 3 < $amount_count_parts ){ |
|
| 209 | - $sanitize_amount = sprintf( |
|
| 208 | + } elseif ( 3 < $amount_count_parts ){ |
|
| 209 | + $sanitize_amount = sprintf( |
|
| 210 | 210 | /* translators: %s: number */ |
| 211 | 211 | esc_html__( '%s billion', 'give' ), |
| 212 | 212 | round( ( $sanitize_amount / 1000000000 ), 2 ) |
| 213 | 213 | ); |
| 214 | - } elseif ( 2 < $amount_count_parts ) { |
|
| 215 | - $sanitize_amount = sprintf( |
|
| 214 | + } elseif ( 2 < $amount_count_parts ) { |
|
| 215 | + $sanitize_amount = sprintf( |
|
| 216 | 216 | /* translators: %s: number */ |
| 217 | 217 | esc_html__( '%s million', 'give' ), |
| 218 | 218 | round( ( $sanitize_amount / 1000000 ), 2 ) |
| 219 | 219 | ); |
| 220 | - } else{ |
|
| 221 | - $sanitize_amount = give_format_amount( $amount ); |
|
| 222 | - } |
|
| 220 | + } else{ |
|
| 221 | + $sanitize_amount = give_format_amount( $amount ); |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount ); |
|
| 224 | + return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -235,14 +235,14 @@ discard block |
||
| 235 | 235 | * @return string $amount Newly formatted amount or Price Not Available |
| 236 | 236 | */ |
| 237 | 237 | function give_format_decimal( $amount, $dp = false ){ |
| 238 | - $decimal_separator = give_get_price_decimal_separator(); |
|
| 239 | - $formatted_amount = give_sanitize_amount( $amount, $dp ); |
|
| 238 | + $decimal_separator = give_get_price_decimal_separator(); |
|
| 239 | + $formatted_amount = give_sanitize_amount( $amount, $dp ); |
|
| 240 | 240 | |
| 241 | - if( false !== strpos( $formatted_amount, '.' ) ) { |
|
| 242 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
| 243 | - } |
|
| 241 | + if( false !== strpos( $formatted_amount, '.' ) ) { |
|
| 242 | + $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
| 245 | + return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -286,66 +286,66 @@ discard block |
||
| 286 | 286 | $negative = $price < 0; |
| 287 | 287 | |
| 288 | 288 | if ( $negative ) { |
| 289 | - // Remove proceeding "-". |
|
| 289 | + // Remove proceeding "-". |
|
| 290 | 290 | $price = substr( $price, 1 ); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | $symbol = give_currency_symbol( $currency ); |
| 294 | 294 | |
| 295 | - switch ( $currency ): |
|
| 296 | - case 'GBP' : |
|
| 297 | - case 'BRL' : |
|
| 298 | - case 'EUR' : |
|
| 299 | - case 'USD' : |
|
| 300 | - case 'AUD' : |
|
| 301 | - case 'CAD' : |
|
| 302 | - case 'HKD' : |
|
| 303 | - case 'MXN' : |
|
| 304 | - case 'NZD' : |
|
| 305 | - case 'SGD' : |
|
| 306 | - case 'JPY' : |
|
| 307 | - case 'THB' : |
|
| 308 | - case 'INR' : |
|
| 309 | - case 'RIAL' : |
|
| 310 | - case 'TRY' : |
|
| 311 | - case 'RUB' : |
|
| 312 | - case 'SEK' : |
|
| 313 | - case 'PLN' : |
|
| 314 | - case 'PHP' : |
|
| 315 | - case 'TWD' : |
|
| 316 | - case 'MYR' : |
|
| 317 | - case 'CZK' : |
|
| 318 | - case 'DKK' : |
|
| 319 | - case 'HUF' : |
|
| 320 | - case 'ILS' : |
|
| 321 | - case 'MAD' : |
|
| 322 | - case 'KRW' : |
|
| 323 | - case 'ZAR' : |
|
| 324 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
| 325 | - break; |
|
| 326 | - case 'NOK' : |
|
| 327 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
| 328 | - break; |
|
| 329 | - default : |
|
| 330 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
| 331 | - break; |
|
| 332 | - endswitch; |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * Filter formatted amount with currency |
|
| 336 | - * |
|
| 337 | - * Filter name depends upon current value of currency and currency position. |
|
| 338 | - * For example : |
|
| 339 | - * if currency is USD and currency position is before then |
|
| 340 | - * filter name will be give_usd_currency_filter_before |
|
| 341 | - * |
|
| 342 | - * and if currency is USD and currency position is after then |
|
| 343 | - * filter name will be give_usd_currency_filter_after |
|
| 344 | - * |
|
| 345 | - */ |
|
| 346 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
| 347 | - |
|
| 348 | - if ( $negative ) { |
|
| 295 | + switch ( $currency ): |
|
| 296 | + case 'GBP' : |
|
| 297 | + case 'BRL' : |
|
| 298 | + case 'EUR' : |
|
| 299 | + case 'USD' : |
|
| 300 | + case 'AUD' : |
|
| 301 | + case 'CAD' : |
|
| 302 | + case 'HKD' : |
|
| 303 | + case 'MXN' : |
|
| 304 | + case 'NZD' : |
|
| 305 | + case 'SGD' : |
|
| 306 | + case 'JPY' : |
|
| 307 | + case 'THB' : |
|
| 308 | + case 'INR' : |
|
| 309 | + case 'RIAL' : |
|
| 310 | + case 'TRY' : |
|
| 311 | + case 'RUB' : |
|
| 312 | + case 'SEK' : |
|
| 313 | + case 'PLN' : |
|
| 314 | + case 'PHP' : |
|
| 315 | + case 'TWD' : |
|
| 316 | + case 'MYR' : |
|
| 317 | + case 'CZK' : |
|
| 318 | + case 'DKK' : |
|
| 319 | + case 'HUF' : |
|
| 320 | + case 'ILS' : |
|
| 321 | + case 'MAD' : |
|
| 322 | + case 'KRW' : |
|
| 323 | + case 'ZAR' : |
|
| 324 | + $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
| 325 | + break; |
|
| 326 | + case 'NOK' : |
|
| 327 | + $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
| 328 | + break; |
|
| 329 | + default : |
|
| 330 | + $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
| 331 | + break; |
|
| 332 | + endswitch; |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * Filter formatted amount with currency |
|
| 336 | + * |
|
| 337 | + * Filter name depends upon current value of currency and currency position. |
|
| 338 | + * For example : |
|
| 339 | + * if currency is USD and currency position is before then |
|
| 340 | + * filter name will be give_usd_currency_filter_before |
|
| 341 | + * |
|
| 342 | + * and if currency is USD and currency position is after then |
|
| 343 | + * filter name will be give_usd_currency_filter_after |
|
| 344 | + * |
|
| 345 | + */ |
|
| 346 | + $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
| 347 | + |
|
| 348 | + if ( $negative ) { |
|
| 349 | 349 | // Prepend the minus sign before the currency sign. |
| 350 | 350 | $formatted = '-' . $formatted; |
| 351 | 351 | } |
@@ -363,18 +363,18 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | function give_currency_decimal_filter() { |
| 365 | 365 | |
| 366 | - remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 366 | + remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 367 | 367 | |
| 368 | - // Set default number of decimals. |
|
| 369 | - $decimals = give_get_price_decimals(); |
|
| 368 | + // Set default number of decimals. |
|
| 369 | + $decimals = give_get_price_decimals(); |
|
| 370 | 370 | |
| 371 | - add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 371 | + add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 372 | 372 | |
| 373 | 373 | |
| 374 | - // Get number of decimals with backward compatibility ( version < 1.6 ) |
|
| 375 | - if( 1 <= func_num_args() ){ |
|
| 376 | - $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
| 377 | - } |
|
| 374 | + // Get number of decimals with backward compatibility ( version < 1.6 ) |
|
| 375 | + if( 1 <= func_num_args() ){ |
|
| 376 | + $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | 379 | $currency = give_get_currency(); |
| 380 | 380 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * @return mixed |
| 407 | 407 | */ |
| 408 | 408 | function give_sanitize_thousand_separator( $value, $field_args, $field ){ |
| 409 | - return $value; |
|
| 409 | + return $value; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | |
@@ -437,5 +437,5 @@ discard block |
||
| 437 | 437 | * @return mixed |
| 438 | 438 | */ |
| 439 | 439 | function give_sanitize_price_field_value( $value, $field_args, $field ){ |
| 440 | - return give_sanitize_amount( $value ); |
|
| 440 | + return give_sanitize_amount( $value ); |
|
| 441 | 441 | } |
| 442 | 442 | \ No newline at end of file |
@@ -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,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return mixed |
| 24 | 24 | */ |
| 25 | 25 | function give_get_price_decimals() { |
| 26 | - return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) ); |
|
| 26 | + return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0)); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return mixed |
| 35 | 35 | */ |
| 36 | 36 | function give_get_price_thousand_separator() { |
| 37 | - return give_get_option( 'thousands_separator', ',' ); |
|
| 37 | + return give_get_option('thousands_separator', ','); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | 47 | function give_get_price_decimal_separator() { |
| 48 | - return give_get_option( 'decimal_separator', '.' ); |
|
| 48 | + return give_get_option('decimal_separator', '.'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -62,60 +62,60 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string $amount Newly sanitized amount |
| 64 | 64 | */ |
| 65 | -function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
| 65 | +function give_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
| 66 | 66 | |
| 67 | 67 | // Bailout. |
| 68 | - if( empty( $number ) ) { |
|
| 68 | + if (empty($number)) { |
|
| 69 | 69 | return $number; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $thousand_separator = give_get_price_thousand_separator(); |
| 73 | 73 | |
| 74 | 74 | $locale = localeconv(); |
| 75 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
| 75 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
| 76 | 76 | |
| 77 | 77 | // Remove locale from string |
| 78 | - if ( ! is_float( $number ) ) { |
|
| 79 | - $number = str_replace( $decimals, '.', $number ); |
|
| 78 | + if ( ! is_float($number)) { |
|
| 79 | + $number = str_replace($decimals, '.', $number); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Remove thousand amount formatting if amount has. |
| 83 | 83 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
| 84 | 84 | // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
| 85 | - if( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
| 86 | - $number = str_replace( $thousand_separator, '', $number ); |
|
| 85 | + if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) { |
|
| 86 | + $number = str_replace($thousand_separator, '', $number); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // Remove non numeric entity before decimal separator. |
| 90 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
| 90 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
| 91 | 91 | $default_dp = give_get_price_decimals(); |
| 92 | 92 | |
| 93 | 93 | // Format number of decimals in number. |
| 94 | - if( false !== $dp ) { |
|
| 95 | - $dp = intval( empty( $dp ) ? $default_dp : $dp ); |
|
| 96 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
| 97 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
| 94 | + if (false !== $dp) { |
|
| 95 | + $dp = intval(empty($dp) ? $default_dp : $dp); |
|
| 96 | + $dp = apply_filters('give_sanitize_amount_decimals', $dp, $number); |
|
| 97 | + $number = number_format(floatval($number), $dp, '.', ''); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Reset negative amount to zero. |
| 101 | - if ( 0 > $number ) { |
|
| 102 | - $number = number_format( 0, $default_dp, '.' ); |
|
| 101 | + if (0 > $number) { |
|
| 102 | + $number = number_format(0, $default_dp, '.'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // If number does not have decimal then add number of decimals to it. |
| 106 | - if( |
|
| 107 | - false === strpos( $number, '.' ) |
|
| 108 | - || ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) ) |
|
| 106 | + if ( |
|
| 107 | + false === strpos($number, '.') |
|
| 108 | + || ($default_dp > strlen(substr($number, strpos($number, '.') + 1))) |
|
| 109 | 109 | ) { |
| 110 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
| 110 | + $number = number_format($number, $default_dp, '.', ''); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // Trim zeros. |
| 114 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
| 115 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
| 114 | + if ($trim_zeros && strstr($number, '.')) { |
|
| 115 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
| 118 | + return apply_filters('give_sanitize_amount', $number); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -128,47 +128,47 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return string $amount Newly formatted amount or Price Not Available |
| 130 | 130 | */ |
| 131 | -function give_format_amount( $amount, $decimals = true ) { |
|
| 131 | +function give_format_amount($amount, $decimals = true) { |
|
| 132 | 132 | |
| 133 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
| 134 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
| 133 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
| 134 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
| 135 | 135 | |
| 136 | 136 | // Format the amount |
| 137 | - if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) { |
|
| 138 | - $whole = substr( $amount, 0, $sep_found ); |
|
| 139 | - $part = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) ); |
|
| 140 | - $amount = $whole . '.' . $part; |
|
| 137 | + if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) { |
|
| 138 | + $whole = substr($amount, 0, $sep_found); |
|
| 139 | + $part = substr($amount, $sep_found + 1, (strlen($amount) - 1)); |
|
| 140 | + $amount = $whole.'.'.$part; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Strip , from the amount (if set as the thousands separator) |
| 144 | - if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 145 | - $amount = str_replace( ',', '', $amount ); |
|
| 144 | + if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 145 | + $amount = str_replace(',', '', $amount); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Strip . from the amount (if set as the thousands separator) AND , set to decimal separator |
| 149 | - if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 150 | - $amount = explode( '.', $amount ); |
|
| 151 | - $array_count = count( $amount ); |
|
| 152 | - if ( $decimals == true ) { |
|
| 153 | - unset( $amount[ $array_count - 1 ] ); |
|
| 149 | + if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 150 | + $amount = explode('.', $amount); |
|
| 151 | + $array_count = count($amount); |
|
| 152 | + if ($decimals == true) { |
|
| 153 | + unset($amount[$array_count - 1]); |
|
| 154 | 154 | } |
| 155 | - $amount = implode( '', $amount ); |
|
| 155 | + $amount = implode('', $amount); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Strip ' ' from the amount (if set as the thousands separator) |
| 159 | - if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) { |
|
| 160 | - $amount = str_replace( ' ', '', $amount ); |
|
| 159 | + if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) { |
|
| 160 | + $amount = str_replace(' ', '', $amount); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( empty( $amount ) ) { |
|
| 163 | + if (empty($amount)) { |
|
| 164 | 164 | $amount = 0; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $decimals = give_get_price_decimals(); |
| 168 | 168 | |
| 169 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
| 169 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
| 170 | 170 | |
| 171 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
| 171 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -184,44 +184,44 @@ discard block |
||
| 184 | 184 | * @param string $amount formatted amount number. |
| 185 | 185 | * @return float|string formatted amount number with large number names. |
| 186 | 186 | */ |
| 187 | -function give_human_format_large_amount( $amount ) { |
|
| 187 | +function give_human_format_large_amount($amount) { |
|
| 188 | 188 | |
| 189 | 189 | // Get thousand separator. |
| 190 | 190 | $thousands_sep = give_get_price_thousand_separator(); |
| 191 | 191 | |
| 192 | 192 | // Sanitize amount. |
| 193 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
| 193 | + $sanitize_amount = give_sanitize_amount($amount); |
|
| 194 | 194 | |
| 195 | 195 | // Explode amount to calculate name of large numbers. |
| 196 | - $amount_array = explode( $thousands_sep, $amount ); |
|
| 196 | + $amount_array = explode($thousands_sep, $amount); |
|
| 197 | 197 | |
| 198 | 198 | // Calculate amount parts count. |
| 199 | - $amount_count_parts = count( $amount_array ); |
|
| 199 | + $amount_count_parts = count($amount_array); |
|
| 200 | 200 | |
| 201 | 201 | // Calculate large number formatted amount. |
| 202 | - if ( 4 < $amount_count_parts ){ |
|
| 203 | - $sanitize_amount = sprintf( |
|
| 202 | + if (4 < $amount_count_parts) { |
|
| 203 | + $sanitize_amount = sprintf( |
|
| 204 | 204 | /* translators: %s: number */ |
| 205 | - esc_html__( '%s trillion', 'give' ), |
|
| 206 | - round( ( $sanitize_amount / 1000000000000 ), 2 ) |
|
| 205 | + esc_html__('%s trillion', 'give'), |
|
| 206 | + round(($sanitize_amount / 1000000000000), 2) |
|
| 207 | 207 | ); |
| 208 | - } elseif ( 3 < $amount_count_parts ){ |
|
| 209 | - $sanitize_amount = sprintf( |
|
| 208 | + } elseif (3 < $amount_count_parts) { |
|
| 209 | + $sanitize_amount = sprintf( |
|
| 210 | 210 | /* translators: %s: number */ |
| 211 | - esc_html__( '%s billion', 'give' ), |
|
| 212 | - round( ( $sanitize_amount / 1000000000 ), 2 ) |
|
| 211 | + esc_html__('%s billion', 'give'), |
|
| 212 | + round(($sanitize_amount / 1000000000), 2) |
|
| 213 | 213 | ); |
| 214 | - } elseif ( 2 < $amount_count_parts ) { |
|
| 215 | - $sanitize_amount = sprintf( |
|
| 214 | + } elseif (2 < $amount_count_parts) { |
|
| 215 | + $sanitize_amount = sprintf( |
|
| 216 | 216 | /* translators: %s: number */ |
| 217 | - esc_html__( '%s million', 'give' ), |
|
| 218 | - round( ( $sanitize_amount / 1000000 ), 2 ) |
|
| 217 | + esc_html__('%s million', 'give'), |
|
| 218 | + round(($sanitize_amount / 1000000), 2) |
|
| 219 | 219 | ); |
| 220 | - } else{ |
|
| 221 | - $sanitize_amount = give_format_amount( $amount ); |
|
| 220 | + } else { |
|
| 221 | + $sanitize_amount = give_format_amount($amount); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount ); |
|
| 224 | + return apply_filters('give_human_format_large_amount', $sanitize_amount, $amount); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return string $amount Newly formatted amount or Price Not Available |
| 236 | 236 | */ |
| 237 | -function give_format_decimal( $amount, $dp = false ){ |
|
| 237 | +function give_format_decimal($amount, $dp = false) { |
|
| 238 | 238 | $decimal_separator = give_get_price_decimal_separator(); |
| 239 | - $formatted_amount = give_sanitize_amount( $amount, $dp ); |
|
| 239 | + $formatted_amount = give_sanitize_amount($amount, $dp); |
|
| 240 | 240 | |
| 241 | - if( false !== strpos( $formatted_amount, '.' ) ) { |
|
| 242 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
| 241 | + if (false !== strpos($formatted_amount, '.')) { |
|
| 242 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
| 245 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -256,13 +256,13 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @return bool |
| 258 | 258 | */ |
| 259 | -function give_format_admin_multilevel_amount( $field_args, $field ) { |
|
| 259 | +function give_format_admin_multilevel_amount($field_args, $field) { |
|
| 260 | 260 | |
| 261 | - if ( empty( $field->value ) ) { |
|
| 261 | + if (empty($field->value)) { |
|
| 262 | 262 | return false; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - $field->value = give_format_decimal( $field->value ); |
|
| 265 | + $field->value = give_format_decimal($field->value); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -275,24 +275,24 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @return mixed|string|void |
| 277 | 277 | */ |
| 278 | -function give_currency_filter( $price = '', $currency = '' ) { |
|
| 278 | +function give_currency_filter($price = '', $currency = '') { |
|
| 279 | 279 | |
| 280 | - if ( empty( $currency ) ) { |
|
| 280 | + if (empty($currency)) { |
|
| 281 | 281 | $currency = give_get_currency(); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - $position = give_get_option( 'currency_position', 'before' ); |
|
| 284 | + $position = give_get_option('currency_position', 'before'); |
|
| 285 | 285 | |
| 286 | 286 | $negative = $price < 0; |
| 287 | 287 | |
| 288 | - if ( $negative ) { |
|
| 288 | + if ($negative) { |
|
| 289 | 289 | // Remove proceeding "-". |
| 290 | - $price = substr( $price, 1 ); |
|
| 290 | + $price = substr($price, 1); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - $symbol = give_currency_symbol( $currency ); |
|
| 293 | + $symbol = give_currency_symbol($currency); |
|
| 294 | 294 | |
| 295 | - switch ( $currency ): |
|
| 295 | + switch ($currency): |
|
| 296 | 296 | case 'GBP' : |
| 297 | 297 | case 'BRL' : |
| 298 | 298 | case 'EUR' : |
@@ -321,13 +321,13 @@ discard block |
||
| 321 | 321 | case 'MAD' : |
| 322 | 322 | case 'KRW' : |
| 323 | 323 | case 'ZAR' : |
| 324 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
| 324 | + $formatted = ('before' === $position ? $symbol.$price : $price.$symbol); |
|
| 325 | 325 | break; |
| 326 | 326 | case 'NOK' : |
| 327 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
| 327 | + $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol); |
|
| 328 | 328 | break; |
| 329 | 329 | default : |
| 330 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
| 330 | + $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency); |
|
| 331 | 331 | break; |
| 332 | 332 | endswitch; |
| 333 | 333 | |
@@ -343,11 +343,11 @@ discard block |
||
| 343 | 343 | * filter name will be give_usd_currency_filter_after |
| 344 | 344 | * |
| 345 | 345 | */ |
| 346 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
| 346 | + $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price); |
|
| 347 | 347 | |
| 348 | - if ( $negative ) { |
|
| 348 | + if ($negative) { |
|
| 349 | 349 | // Prepend the minus sign before the currency sign. |
| 350 | - $formatted = '-' . $formatted; |
|
| 350 | + $formatted = '-'.$formatted; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return $formatted; |
@@ -363,22 +363,22 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | function give_currency_decimal_filter() { |
| 365 | 365 | |
| 366 | - remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 366 | + remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 367 | 367 | |
| 368 | 368 | // Set default number of decimals. |
| 369 | 369 | $decimals = give_get_price_decimals(); |
| 370 | 370 | |
| 371 | - add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 371 | + add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 372 | 372 | |
| 373 | 373 | |
| 374 | 374 | // Get number of decimals with backward compatibility ( version < 1.6 ) |
| 375 | - if( 1 <= func_num_args() ){ |
|
| 376 | - $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
| 375 | + if (1 <= func_num_args()) { |
|
| 376 | + $decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0))); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $currency = give_get_currency(); |
| 380 | 380 | |
| 381 | - switch ( $currency ) { |
|
| 381 | + switch ($currency) { |
|
| 382 | 382 | case 'RIAL' : |
| 383 | 383 | case 'JPY' : |
| 384 | 384 | case 'TWD' : |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | break; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
| 391 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 395 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
| 394 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
| 395 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Sanitize thousand separator |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | * |
| 406 | 406 | * @return mixed |
| 407 | 407 | */ |
| 408 | -function give_sanitize_thousand_separator( $value, $field_args, $field ){ |
|
| 408 | +function give_sanitize_thousand_separator($value, $field_args, $field) { |
|
| 409 | 409 | return $value; |
| 410 | 410 | } |
| 411 | 411 | |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | * |
| 422 | 422 | * @return mixed |
| 423 | 423 | */ |
| 424 | -function give_sanitize_number_decimals( $value, $field_args, $field ){ |
|
| 424 | +function give_sanitize_number_decimals($value, $field_args, $field) { |
|
| 425 | 425 | return absint($value); |
| 426 | 426 | } |
| 427 | 427 | |
@@ -436,6 +436,6 @@ discard block |
||
| 436 | 436 | * |
| 437 | 437 | * @return mixed |
| 438 | 438 | */ |
| 439 | -function give_sanitize_price_field_value( $value, $field_args, $field ){ |
|
| 440 | - return give_sanitize_amount( $value ); |
|
| 439 | +function give_sanitize_price_field_value($value, $field_args, $field) { |
|
| 440 | + return give_sanitize_amount($value); |
|
| 441 | 441 | } |
| 442 | 442 | \ No newline at end of file |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
| 20 | 20 | * @since 1.0 |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
| 24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
| 24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Setup the variables |
| 28 | -$payment_id = absint( $_GET['id'] ); |
|
| 29 | -$payment = new Give_Payment( $payment_id ); |
|
| 28 | +$payment_id = absint($_GET['id']); |
|
| 29 | +$payment = new Give_Payment($payment_id); |
|
| 30 | 30 | |
| 31 | 31 | // Sanity check... fail if purchase ID is invalid |
| 32 | 32 | $payment_exists = $payment->ID; |
| 33 | -if ( empty( $payment_exists ) ) { |
|
| 34 | - wp_die( esc_html__( 'The specified ID does not belong to a payment. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 33 | +if (empty($payment_exists)) { |
|
| 34 | + wp_die(esc_html__('The specified ID does not belong to a payment. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $number = $payment->number; |
| 38 | 38 | $payment_meta = $payment->get_meta(); |
| 39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
| 39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
| 40 | 40 | $user_id = $payment->user_id; |
| 41 | 41 | $customer_id = $payment->customer_id; |
| 42 | -$payment_date = strtotime( $payment->date ); |
|
| 43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
| 42 | +$payment_date = strtotime($payment->date); |
|
| 43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
| 44 | 44 | $address = $payment->address; |
| 45 | 45 | $gateway = $payment->gateway; |
| 46 | 46 | $currency_code = $payment->currency; |
@@ -53,76 +53,76 @@ discard block |
||
| 53 | 53 | <h1 id="transaction-details-heading"><?php |
| 54 | 54 | printf( |
| 55 | 55 | /* translators: %s: payment number */ |
| 56 | - esc_html__( 'Payment %s', 'give' ), |
|
| 56 | + esc_html__('Payment %s', 'give'), |
|
| 57 | 57 | $number |
| 58 | 58 | ); |
| 59 | - if ( $payment_mode == 'test' ) { |
|
| 60 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This payment was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Payment', 'give' ) . '</span>'; |
|
| 59 | + if ($payment_mode == 'test') { |
|
| 60 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This payment was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Payment', 'give').'</span>'; |
|
| 61 | 61 | } |
| 62 | 62 | ?></h1> |
| 63 | 63 | |
| 64 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
| 64 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
| 65 | 65 | <form id="give-edit-order-form" method="post"> |
| 66 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
| 66 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
| 67 | 67 | <div id="poststuff"> |
| 68 | 68 | <div id="give-dashboard-widgets-wrap"> |
| 69 | 69 | <div id="post-body" class="metabox-holder columns-2"> |
| 70 | 70 | <div id="postbox-container-1" class="postbox-container"> |
| 71 | 71 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
| 72 | 72 | |
| 73 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
| 73 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
| 74 | 74 | |
| 75 | 75 | <div id="give-order-update" class="postbox give-order-data"> |
| 76 | 76 | |
| 77 | 77 | <h3 class="hndle"> |
| 78 | - <span><?php esc_html_e( 'Update Payment', 'give' ); ?></span> |
|
| 78 | + <span><?php esc_html_e('Update Payment', 'give'); ?></span> |
|
| 79 | 79 | </h3> |
| 80 | 80 | |
| 81 | 81 | <div class="inside"> |
| 82 | 82 | <div class="give-admin-box"> |
| 83 | 83 | |
| 84 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
| 84 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
| 85 | 85 | |
| 86 | 86 | <div class="give-admin-box-inside"> |
| 87 | 87 | <p> |
| 88 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
| 88 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
| 89 | 89 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 90 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 91 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 90 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 91 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 92 | 92 | <?php endforeach; ?> |
| 93 | 93 | </select> |
| 94 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 94 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 95 | 95 | </p> |
| 96 | 96 | </div> |
| 97 | 97 | |
| 98 | 98 | <div class="give-admin-box-inside"> |
| 99 | 99 | <p> |
| 100 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
| 101 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
| 100 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
| 101 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
| 102 | 102 | </p> |
| 103 | 103 | </div> |
| 104 | 104 | |
| 105 | 105 | <div class="give-admin-box-inside"> |
| 106 | 106 | <p> |
| 107 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
| 108 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
| 109 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
| 107 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
| 108 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
| 109 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
| 110 | 110 | </p> |
| 111 | 111 | </div> |
| 112 | 112 | |
| 113 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
| 113 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
| 114 | 114 | |
| 115 | 115 | <?php |
| 116 | 116 | //@TODO: Fees |
| 117 | - $fees = give_get_payment_fees( $payment_id ); |
|
| 118 | - if ( ! empty( $fees ) ) : ?> |
|
| 117 | + $fees = give_get_payment_fees($payment_id); |
|
| 118 | + if ( ! empty($fees)) : ?> |
|
| 119 | 119 | <div class="give-order-fees give-admin-box-inside"> |
| 120 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
| 120 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
| 121 | 121 | <ul class="give-payment-fees"> |
| 122 | - <?php foreach ( $fees as $fee ) : ?> |
|
| 122 | + <?php foreach ($fees as $fee) : ?> |
|
| 123 | 123 | <li> |
| 124 | 124 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
| 125 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
| 125 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
| 126 | 126 | </li> |
| 127 | 127 | <?php endforeach; ?> |
| 128 | 128 | </ul> |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | <div class="give-order-payment give-admin-box-inside"> |
| 133 | 133 | <p> |
| 134 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 135 | - <?php echo give_currency_symbol( $payment->currency ); ?> <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
| 134 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 135 | + <?php echo give_currency_symbol($payment->currency); ?> <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
| 136 | 136 | </p> |
| 137 | 137 | </div> |
| 138 | 138 | |
| 139 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
| 139 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
| 140 | 140 | |
| 141 | 141 | </div> |
| 142 | 142 | <!-- /.give-admin-box --> |
@@ -145,20 +145,20 @@ discard block |
||
| 145 | 145 | <!-- /.inside --> |
| 146 | 146 | |
| 147 | 147 | <div class="give-order-update-box give-admin-box"> |
| 148 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
| 148 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
| 149 | 149 | <div id="major-publishing-actions"> |
| 150 | 150 | <div id="publishing-action"> |
| 151 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/> |
|
| 152 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 153 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 151 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/> |
|
| 152 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 153 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 154 | 154 | 'give-action' => 'email_links', |
| 155 | 155 | 'purchase_id' => $payment_id |
| 156 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
| 156 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
| 157 | 157 | <?php endif; ?> |
| 158 | 158 | </div> |
| 159 | 159 | <div class="clear"></div> |
| 160 | 160 | </div> |
| 161 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
| 161 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
| 162 | 162 | </div> |
| 163 | 163 | <!-- /.give-order-update-box --> |
| 164 | 164 | |
@@ -168,55 +168,55 @@ discard block |
||
| 168 | 168 | <div id="give-order-details" class="postbox give-order-data"> |
| 169 | 169 | |
| 170 | 170 | <h3 class="hndle"> |
| 171 | - <span><?php esc_html_e( 'Payment Meta', 'give' ); ?></span> |
|
| 171 | + <span><?php esc_html_e('Payment Meta', 'give'); ?></span> |
|
| 172 | 172 | </h3> |
| 173 | 173 | |
| 174 | 174 | <div class="inside"> |
| 175 | 175 | <div class="give-admin-box"> |
| 176 | 176 | |
| 177 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
| 177 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
| 178 | 178 | |
| 179 | 179 | <?php |
| 180 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 181 | - if ( $gateway ) : ?> |
|
| 180 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 181 | + if ($gateway) : ?> |
|
| 182 | 182 | <div class="give-order-gateway give-admin-box-inside"> |
| 183 | 183 | <p> |
| 184 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 185 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 184 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 185 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 186 | 186 | </p> |
| 187 | 187 | </div> |
| 188 | 188 | <?php endif; ?> |
| 189 | 189 | |
| 190 | 190 | <div class="give-order-payment-key give-admin-box-inside"> |
| 191 | 191 | <p> |
| 192 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 193 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 192 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 193 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 194 | 194 | </p> |
| 195 | 195 | </div> |
| 196 | 196 | |
| 197 | 197 | <div class="give-order-ip give-admin-box-inside"> |
| 198 | 198 | <p> |
| 199 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 200 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 199 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 200 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 201 | 201 | </p> |
| 202 | 202 | </div> |
| 203 | 203 | |
| 204 | - <?php if ( $transaction_id ) : ?> |
|
| 204 | + <?php if ($transaction_id) : ?> |
|
| 205 | 205 | <div class="give-order-tx-id give-admin-box-inside"> |
| 206 | 206 | <p> |
| 207 | - <strong><?php esc_html_e( 'Transaction ID:', 'give' ); ?></strong> |
|
| 208 | - <?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?> |
|
| 207 | + <strong><?php esc_html_e('Transaction ID:', 'give'); ?></strong> |
|
| 208 | + <?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?> |
|
| 209 | 209 | </p> |
| 210 | 210 | </div> |
| 211 | 211 | <?php endif; ?> |
| 212 | 212 | |
| 213 | 213 | <div class="give-admin-box-inside"> |
| 214 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
| 215 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 214 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
| 215 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 216 | 216 | </p> |
| 217 | 217 | </div> |
| 218 | 218 | |
| 219 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
| 219 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
| 220 | 220 | |
| 221 | 221 | </div> |
| 222 | 222 | <!-- /.column-container --> |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | </div> |
| 228 | 228 | <!-- /#give-order-data --> |
| 229 | 229 | |
| 230 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
| 230 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
| 231 | 231 | |
| 232 | 232 | </div> |
| 233 | 233 | <!-- /#side-sortables --> |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
| 240 | 240 | |
| 241 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
| 241 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
| 242 | 242 | |
| 243 | 243 | <?php $column_count = 'columns-3'; ?> |
| 244 | 244 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 245 | 245 | <h3 class="hndle"> |
| 246 | - <span><?php esc_html_e( 'Donation Information', 'give' ); ?></span> |
|
| 246 | + <span><?php esc_html_e('Donation Information', 'give'); ?></span> |
|
| 247 | 247 | </h3> |
| 248 | 248 | |
| 249 | 249 | <div class="inside"> |
@@ -251,32 +251,32 @@ discard block |
||
| 251 | 251 | <table style="width:100%;"> |
| 252 | 252 | <thead> |
| 253 | 253 | <tr> |
| 254 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
| 255 | - <th><?php esc_html_e( 'Donation Form ID', 'give' ) ?></th> |
|
| 256 | - <th><?php esc_html_e( 'Donation Form Title', 'give' ) ?></th> |
|
| 257 | - <th><?php esc_html_e( 'Donation Level', 'give' ) ?></th> |
|
| 258 | - <th><?php esc_html_e( 'Donation Date', 'give' ) ?></th> |
|
| 259 | - <th><?php esc_html_e( 'Total Donation', 'give' ) ?></th> |
|
| 260 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
| 254 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
| 255 | + <th><?php esc_html_e('Donation Form ID', 'give') ?></th> |
|
| 256 | + <th><?php esc_html_e('Donation Form Title', 'give') ?></th> |
|
| 257 | + <th><?php esc_html_e('Donation Level', 'give') ?></th> |
|
| 258 | + <th><?php esc_html_e('Donation Date', 'give') ?></th> |
|
| 259 | + <th><?php esc_html_e('Total Donation', 'give') ?></th> |
|
| 260 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
| 261 | 261 | </tr> |
| 262 | 262 | </thead> |
| 263 | 263 | <tr> |
| 264 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
| 264 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
| 265 | 265 | <td> |
| 266 | 266 | <?php echo $payment_meta['form_id']; ?> |
| 267 | 267 | </td> |
| 268 | 268 | <td> |
| 269 | - <?php give_get_form_dropdown( array( |
|
| 269 | + <?php give_get_form_dropdown(array( |
|
| 270 | 270 | 'id' => $payment_meta['form_id'], |
| 271 | 271 | 'selected' => $payment_meta['form_id'], |
| 272 | 272 | 'chosen' => true |
| 273 | - ), true ); ?> |
|
| 273 | + ), true); ?> |
|
| 274 | 274 | </td> |
| 275 | 275 | <td> |
| 276 | 276 | <?php |
| 277 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 278 | - if ( empty( $var_prices ) ) { |
|
| 279 | - echo esc_html__( 'n/a', 'give' ); |
|
| 277 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 278 | + if (empty($var_prices)) { |
|
| 279 | + echo esc_html__('n/a', 'give'); |
|
| 280 | 280 | } else { |
| 281 | 281 | // Variable price dropdown options. |
| 282 | 282 | $variable_price_dropdown_option = array( |
@@ -288,20 +288,20 @@ discard block |
||
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | // Render variable prices select tag html. |
| 291 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 291 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 292 | 292 | } |
| 293 | 293 | ?> |
| 294 | 294 | </td> |
| 295 | 295 | <td> |
| 296 | 296 | <?php |
| 297 | 297 | //Transaction Date |
| 298 | - $date_format = get_option( 'date_format' ); |
|
| 299 | - echo date_i18n( $date_format, strtotime( $payment_date ) ); |
|
| 298 | + $date_format = get_option('date_format'); |
|
| 299 | + echo date_i18n($date_format, strtotime($payment_date)); |
|
| 300 | 300 | ?> |
| 301 | 301 | </td> |
| 302 | 302 | <td> |
| 303 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
| 304 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
| 303 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
| 304 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
| 305 | 305 | |
| 306 | 306 | </tr> |
| 307 | 307 | </table> |
@@ -313,64 +313,64 @@ discard block |
||
| 313 | 313 | </div> |
| 314 | 314 | <!-- /#give-donation-overview --> |
| 315 | 315 | |
| 316 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
| 316 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
| 317 | 317 | |
| 318 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
| 318 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
| 319 | 319 | |
| 320 | 320 | |
| 321 | 321 | <div id="give-customer-details" class="postbox"> |
| 322 | 322 | <h3 class="hndle"> |
| 323 | - <span><?php esc_html_e( 'Donor Details', 'give' ); ?></span> |
|
| 323 | + <span><?php esc_html_e('Donor Details', 'give'); ?></span> |
|
| 324 | 324 | </h3> |
| 325 | 325 | |
| 326 | 326 | <div class="inside give-clearfix"> |
| 327 | 327 | |
| 328 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
| 328 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
| 329 | 329 | |
| 330 | 330 | <div class="column-container customer-info"> |
| 331 | 331 | <div class="column"> |
| 332 | - <?php echo Give()->html->donor_dropdown( array( |
|
| 332 | + <?php echo Give()->html->donor_dropdown(array( |
|
| 333 | 333 | 'selected' => $customer->id, |
| 334 | 334 | 'name' => 'customer-id' |
| 335 | - ) ); ?> |
|
| 335 | + )); ?> |
|
| 336 | 336 | </div> |
| 337 | 337 | <div class="column"> |
| 338 | 338 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
| 339 | 339 | </div> |
| 340 | 340 | <div class="column"> |
| 341 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
| 342 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
| 343 | - <a href="<?php echo $customer_url; ?>"><?php esc_html_e( 'View Donor Details', 'give' ); ?></a> |
|
| 341 | + <?php if ( ! empty($customer->id)) : ?> |
|
| 342 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
| 343 | + <a href="<?php echo $customer_url; ?>"><?php esc_html_e('View Donor Details', 'give'); ?></a> |
|
| 344 | 344 | | |
| 345 | 345 | <?php endif; ?> |
| 346 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'New Donor', 'give' ); ?></a> |
|
| 346 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('New Donor', 'give'); ?></a> |
|
| 347 | 347 | </div> |
| 348 | 348 | </div> |
| 349 | 349 | |
| 350 | 350 | <div class="column-container new-customer" style="display: none"> |
| 351 | 351 | <div class="column"> |
| 352 | - <label for="give-new-customer-name"><?php esc_html_e( 'Name:', 'give' ); ?></label> |
|
| 352 | + <label for="give-new-customer-name"><?php esc_html_e('Name:', 'give'); ?></label> |
|
| 353 | 353 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
| 354 | 354 | </div> |
| 355 | 355 | <div class="column"> |
| 356 | - <label for="give-new-customer-email"><?php esc_html_e( 'Email:', 'give' ); ?></label> |
|
| 356 | + <label for="give-new-customer-email"><?php esc_html_e('Email:', 'give'); ?></label> |
|
| 357 | 357 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
| 358 | 358 | </div> |
| 359 | 359 | <div class="column"> |
| 360 | 360 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
| 361 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 361 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 362 | 362 | </div> |
| 363 | 363 | <div class="column"> |
| 364 | 364 | <small> |
| 365 | - <em><?php esc_html_e( '* Click "Save Payment" to create new donor.', 'give' ); ?></em> |
|
| 365 | + <em><?php esc_html_e('* Click "Save Payment" to create new donor.', 'give'); ?></em> |
|
| 366 | 366 | </small> |
| 367 | 367 | </div> |
| 368 | 368 | </div> |
| 369 | 369 | |
| 370 | 370 | <?php |
| 371 | 371 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
| 372 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 373 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 372 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 373 | + do_action('give_payment_view_details', $payment_id); |
|
| 374 | 374 | ?> |
| 375 | 375 | |
| 376 | 376 | </div> |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | <div id="give-billing-details" class="postbox"> |
| 383 | 383 | <h3 class="hndle"> |
| 384 | - <span><?php esc_html_e( 'Billing Address', 'give' ); ?></span> |
|
| 384 | + <span><?php esc_html_e('Billing Address', 'give'); ?></span> |
|
| 385 | 385 | </h3> |
| 386 | 386 | |
| 387 | 387 | <div class="inside give-clearfix"> |
@@ -392,62 +392,62 @@ discard block |
||
| 392 | 392 | <div class="data column-container"> |
| 393 | 393 | <div class="column"> |
| 394 | 394 | <div class="give-wrap-address-line1"> |
| 395 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 396 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 395 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 396 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 397 | 397 | </div> |
| 398 | 398 | |
| 399 | 399 | <div class="give-wrap-address-line2"> |
| 400 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 401 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 400 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 401 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 402 | 402 | </div> |
| 403 | 403 | |
| 404 | 404 | </div> |
| 405 | 405 | <div class="column"> |
| 406 | 406 | <div class="give-wrap-address-city"> |
| 407 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 408 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 407 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 408 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 409 | 409 | |
| 410 | 410 | </div> |
| 411 | 411 | |
| 412 | 412 | <div class="give-wrap-address-zip"> |
| 413 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 414 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 413 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 414 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 415 | 415 | |
| 416 | 416 | </div> |
| 417 | 417 | </div> |
| 418 | 418 | <div class="column"> |
| 419 | 419 | <div id="give-order-address-country-wrap"> |
| 420 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 420 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 421 | 421 | <?php |
| 422 | - echo Give()->html->select( array( |
|
| 422 | + echo Give()->html->select(array( |
|
| 423 | 423 | 'options' => give_get_country_list(), |
| 424 | 424 | 'name' => 'give-payment-address[0][country]', |
| 425 | 425 | 'selected' => $address['country'], |
| 426 | 426 | 'show_option_all' => false, |
| 427 | 427 | 'show_option_none' => false, |
| 428 | 428 | 'chosen' => true, |
| 429 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ) |
|
| 430 | - ) ); |
|
| 429 | + 'placeholder' => esc_attr__('Select a country', 'give') |
|
| 430 | + )); |
|
| 431 | 431 | ?> |
| 432 | 432 | </div> |
| 433 | 433 | |
| 434 | 434 | <div id="give-order-address-state-wrap"> |
| 435 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
| 435 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
| 436 | 436 | <?php |
| 437 | - $states = give_get_states( $address['country'] ); |
|
| 438 | - if ( ! empty( $states ) ) { |
|
| 439 | - echo Give()->html->select( array( |
|
| 437 | + $states = give_get_states($address['country']); |
|
| 438 | + if ( ! empty($states)) { |
|
| 439 | + echo Give()->html->select(array( |
|
| 440 | 440 | 'options' => $states, |
| 441 | 441 | 'name' => 'give-payment-address[0][state]', |
| 442 | 442 | 'selected' => $address['state'], |
| 443 | 443 | 'show_option_all' => false, |
| 444 | 444 | 'show_option_none' => false, |
| 445 | 445 | 'chosen' => true, |
| 446 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ) |
|
| 447 | - ) ); |
|
| 446 | + 'placeholder' => esc_attr__('Select a state', 'give') |
|
| 447 | + )); |
|
| 448 | 448 | } else { |
| 449 | 449 | ?> |
| 450 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 450 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 451 | 451 | <?php |
| 452 | 452 | } ?> |
| 453 | 453 | </div> |
@@ -457,38 +457,38 @@ discard block |
||
| 457 | 457 | </div> |
| 458 | 458 | <!-- /#give-order-address --> |
| 459 | 459 | |
| 460 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
| 460 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
| 461 | 461 | |
| 462 | 462 | </div> |
| 463 | 463 | <!-- /.inside --> |
| 464 | 464 | </div> |
| 465 | 465 | <!-- /#give-billing-details --> |
| 466 | 466 | |
| 467 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
| 467 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
| 468 | 468 | |
| 469 | 469 | <div id="give-payment-notes" class="postbox"> |
| 470 | - <h3 class="hndle"><span><?php esc_html_e( 'Payment Notes', 'give' ); ?></span></h3> |
|
| 470 | + <h3 class="hndle"><span><?php esc_html_e('Payment Notes', 'give'); ?></span></h3> |
|
| 471 | 471 | |
| 472 | 472 | <div class="inside"> |
| 473 | 473 | <div id="give-payment-notes-inner"> |
| 474 | 474 | <?php |
| 475 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 476 | - if ( ! empty( $notes ) ) : |
|
| 475 | + $notes = give_get_payment_notes($payment_id); |
|
| 476 | + if ( ! empty($notes)) : |
|
| 477 | 477 | $no_notes_display = ' style="display:none;"'; |
| 478 | - foreach ( $notes as $note ) : |
|
| 478 | + foreach ($notes as $note) : |
|
| 479 | 479 | |
| 480 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 480 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 481 | 481 | |
| 482 | 482 | endforeach; |
| 483 | 483 | else : |
| 484 | 484 | $no_notes_display = ''; |
| 485 | 485 | endif; |
| 486 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No payment notes', 'give' ) . '</p>'; ?> |
|
| 486 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No payment notes', 'give').'</p>'; ?> |
|
| 487 | 487 | </div> |
| 488 | 488 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 489 | 489 | |
| 490 | 490 | <div class="give-clearfix"> |
| 491 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
| 491 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
| 492 | 492 | </div> |
| 493 | 493 | |
| 494 | 494 | </div> |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | </div> |
| 497 | 497 | <!-- /#give-payment-notes --> |
| 498 | 498 | |
| 499 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
| 499 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
| 500 | 500 | </div> |
| 501 | 501 | <!-- /#normal-sortables --> |
| 502 | 502 | </div> |
@@ -507,10 +507,10 @@ discard block |
||
| 507 | 507 | <!-- #give-dashboard-widgets-wrap --> |
| 508 | 508 | </div> |
| 509 | 509 | <!-- /#post-stuff --> |
| 510 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
| 511 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
| 512 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 510 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
| 511 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
| 512 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 513 | 513 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 514 | 514 | </form> |
| 515 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
| 515 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
| 516 | 516 | </div><!-- /.wrap --> |
@@ -267,10 +267,10 @@ |
||
| 267 | 267 | 'donation' => esc_html__( 'Donation', 'give' ), |
| 268 | 268 | 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
| 269 | 269 | 'status' => esc_html__( 'Status', 'give' ), |
| 270 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 271 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 272 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 273 | - ); |
|
| 270 | + 'date' => esc_html__( 'Date', 'give' ), |
|
| 271 | + 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 272 | + 'details' => esc_html__( 'Details', 'give' ), |
|
| 273 | + ); |
|
| 274 | 274 | |
| 275 | 275 | return apply_filters( 'give_payments_table_columns', $columns ); |
| 276 | 276 | } |
@@ -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 | /** |
@@ -118,37 +118,37 @@ discard block |
||
| 118 | 118 | public function __construct() { |
| 119 | 119 | |
| 120 | 120 | // Set parent defaults |
| 121 | - parent::__construct( array( |
|
| 122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 121 | + parent::__construct(array( |
|
| 122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 124 | 124 | 'ajax' => false // Does this table support ajax? |
| 125 | - ) ); |
|
| 125 | + )); |
|
| 126 | 126 | |
| 127 | 127 | $this->get_payment_counts(); |
| 128 | 128 | $this->process_bulk_action(); |
| 129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function advanced_filters() { |
| 133 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 134 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
| 135 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 133 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 134 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
| 135 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 136 | 136 | ?> |
| 137 | 137 | <div id="give-payment-filters"> |
| 138 | 138 | <span id="give-payment-date-filters"> |
| 139 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
| 139 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
| 140 | 140 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
| 141 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
| 141 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
| 142 | 142 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
| 143 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
| 143 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
| 144 | 144 | </span> |
| 145 | - <?php if ( ! empty( $status ) ) : ?> |
|
| 146 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
| 145 | + <?php if ( ! empty($status)) : ?> |
|
| 146 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
| 147 | 147 | <?php endif; ?> |
| 148 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
| 149 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
| 148 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
| 149 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
| 150 | 150 | <?php endif; ?> |
| 151 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
| 151 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
| 152 | 152 | </div> |
| 153 | 153 | |
| 154 | 154 | <?php |
@@ -165,18 +165,18 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return void |
| 167 | 167 | */ |
| 168 | - public function search_box( $text, $input_id ) { |
|
| 169 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
| 168 | + public function search_box($text, $input_id) { |
|
| 169 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $input_id = $input_id . '-search-input'; |
|
| 173 | + $input_id = $input_id.'-search-input'; |
|
| 174 | 174 | |
| 175 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 176 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 175 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 176 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 177 | 177 | } |
| 178 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 179 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 178 | + if ( ! empty($_REQUEST['order'])) { |
|
| 179 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 180 | 180 | } |
| 181 | 181 | ?> |
| 182 | 182 | <p class="search-box"> |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @since 1.0 |
| 190 | 190 | */ |
| 191 | - do_action( 'give_payment_history_search' ); |
|
| 191 | + do_action('give_payment_history_search'); |
|
| 192 | 192 | ?> |
| 193 | 193 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 194 | 194 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
| 195 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
| 195 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
| 196 | 196 | </p> |
| 197 | 197 | <?php |
| 198 | 198 | } |
@@ -206,52 +206,52 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function get_views() { |
| 208 | 208 | |
| 209 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
| 210 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
| 211 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
| 212 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
| 213 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
| 214 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
| 215 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
| 216 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
| 217 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
| 209 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
| 210 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
| 211 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
| 212 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
| 213 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
| 214 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
| 215 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
| 216 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
| 217 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
| 218 | 218 | |
| 219 | 219 | $views = array( |
| 220 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
| 220 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
| 221 | 221 | 'status', |
| 222 | 222 | 'paged' |
| 223 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
| 224 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 223 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
| 224 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 225 | 225 | 'status' => 'publish', |
| 226 | 226 | 'paged' => false |
| 227 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
| 228 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 227 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
| 228 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 229 | 229 | 'status' => 'pending', |
| 230 | 230 | 'paged' => false |
| 231 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
| 232 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 231 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
| 232 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 233 | 233 | 'status' => 'refunded', |
| 234 | 234 | 'paged' => false |
| 235 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
| 236 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 235 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
| 236 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 237 | 237 | 'status' => 'revoked', |
| 238 | 238 | 'paged' => false |
| 239 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
| 240 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 239 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
| 240 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 241 | 241 | 'status' => 'failed', |
| 242 | 242 | 'paged' => false |
| 243 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
| 244 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 243 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
| 244 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 245 | 245 | 'status' => 'cancelled', |
| 246 | 246 | 'paged' => false |
| 247 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
| 248 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
| 247 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
| 248 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
| 249 | 249 | 'status' => 'abandoned', |
| 250 | 250 | 'paged' => false |
| 251 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ) |
|
| 251 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count) |
|
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - return apply_filters( 'give_payments_table_views', $views ); |
|
| 254 | + return apply_filters('give_payments_table_views', $views); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -264,15 +264,15 @@ discard block |
||
| 264 | 264 | public function get_columns() { |
| 265 | 265 | $columns = array( |
| 266 | 266 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
| 267 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
| 268 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
| 269 | - 'status' => esc_html__( 'Status', 'give' ), |
|
| 270 | - 'date' => esc_html__( 'Date', 'give' ), |
|
| 271 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 272 | - 'details' => esc_html__( 'Details', 'give' ), |
|
| 267 | + 'donation' => esc_html__('Donation', 'give'), |
|
| 268 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
| 269 | + 'status' => esc_html__('Status', 'give'), |
|
| 270 | + 'date' => esc_html__('Date', 'give'), |
|
| 271 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 272 | + 'details' => esc_html__('Details', 'give'), |
|
| 273 | 273 | ); |
| 274 | 274 | |
| 275 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
| 275 | + return apply_filters('give_payments_table_columns', $columns); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -284,12 +284,12 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function get_sortable_columns() { |
| 286 | 286 | $columns = array( |
| 287 | - 'donation' => array( 'ID', true ), |
|
| 288 | - 'amount' => array( 'amount', false ), |
|
| 289 | - 'date' => array( 'date', false ) |
|
| 287 | + 'donation' => array('ID', true), |
|
| 288 | + 'amount' => array('amount', false), |
|
| 289 | + 'date' => array('date', false) |
|
| 290 | 290 | ); |
| 291 | 291 | |
| 292 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
| 292 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -315,65 +315,65 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string Column Name |
| 317 | 317 | */ |
| 318 | - public function column_default( $payment, $column_name ) { |
|
| 318 | + public function column_default($payment, $column_name) { |
|
| 319 | 319 | |
| 320 | - $single_transaction_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
| 321 | - $row_actions = $this->get_row_actions( $payment ); |
|
| 320 | + $single_transaction_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
| 321 | + $row_actions = $this->get_row_actions($payment); |
|
| 322 | 322 | |
| 323 | - switch ( $column_name ) { |
|
| 323 | + switch ($column_name) { |
|
| 324 | 324 | case 'donation' : |
| 325 | 325 | $value = sprintf( |
| 326 | 326 | /* translators: 1: Payment link 2: Donor link */ |
| 327 | - esc_html__( '%1$s by %2$s', 'give' ), |
|
| 327 | + esc_html__('%1$s by %2$s', 'give'), |
|
| 328 | 328 | sprintf( |
| 329 | 329 | '<a href="%1$s">#%2$s</a>', |
| 330 | - get_permalink( $payment->ID ), |
|
| 330 | + get_permalink($payment->ID), |
|
| 331 | 331 | $payment->ID |
| 332 | 332 | ), |
| 333 | 333 | sprintf( |
| 334 | 334 | '%1$s<br>%2$s', |
| 335 | - $this->get_donor( $payment ), |
|
| 336 | - $this->get_donor_email( $payment ) |
|
| 335 | + $this->get_donor($payment), |
|
| 336 | + $this->get_donor_email($payment) |
|
| 337 | 337 | ) |
| 338 | 338 | ); |
| 339 | 339 | break; |
| 340 | 340 | |
| 341 | 341 | case 'amount' : |
| 342 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
| 343 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
| 342 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
| 343 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
| 344 | 344 | break; |
| 345 | 345 | |
| 346 | 346 | case 'donation_form' : |
| 347 | 347 | |
| 348 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
| 349 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
| 348 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
| 349 | + $level = give_get_payment_form_title($payment->meta, true); |
|
| 350 | 350 | |
| 351 | - if ( ! empty( $level ) ) { |
|
| 351 | + if ( ! empty($level)) { |
|
| 352 | 352 | $value .= $level; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | break; |
| 356 | 356 | |
| 357 | 357 | case 'date' : |
| 358 | - $date = strtotime( $payment->date ); |
|
| 359 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
| 358 | + $date = strtotime($payment->date); |
|
| 359 | + $value = date_i18n(get_option('date_format'), $date); |
|
| 360 | 360 | break; |
| 361 | 361 | |
| 362 | 362 | case 'status' : |
| 363 | - $value = $this->get_payment_status( $payment ); |
|
| 363 | + $value = $this->get_payment_status($payment); |
|
| 364 | 364 | break; |
| 365 | 365 | |
| 366 | 366 | case 'details' : |
| 367 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_transaction_url . '" data-tooltip="' . __( 'View details', 'give' ) . '" class="give-payment-details-link button button-small" title="' . __( 'View Details', 'give' ) . '"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
| 367 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.$single_transaction_url.'" data-tooltip="'.__('View details', 'give').'" class="give-payment-details-link button button-small" title="'.__('View Details', 'give').'"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
| 368 | 368 | break; |
| 369 | 369 | |
| 370 | 370 | default: |
| 371 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
| 371 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
| 372 | 372 | break; |
| 373 | 373 | |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
| 376 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
@@ -386,17 +386,17 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | * @return string Data shown in the Email column |
| 388 | 388 | */ |
| 389 | - public function get_donor_email( $payment ) { |
|
| 389 | + public function get_donor_email($payment) { |
|
| 390 | 390 | |
| 391 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 391 | + $email = give_get_payment_user_email($payment->ID); |
|
| 392 | 392 | |
| 393 | - if ( empty( $email ) ) { |
|
| 394 | - $email = esc_html__( '(unknown)', 'give' ); |
|
| 393 | + if (empty($email)) { |
|
| 394 | + $email = esc_html__('(unknown)', 'give'); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
| 397 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; |
|
| 398 | 398 | |
| 399 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
| 399 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -406,31 +406,31 @@ discard block |
||
| 406 | 406 | * |
| 407 | 407 | * @return mixed|void |
| 408 | 408 | */ |
| 409 | - function get_row_actions( $payment ) { |
|
| 409 | + function get_row_actions($payment) { |
|
| 410 | 410 | |
| 411 | 411 | $row_actions = array(); |
| 412 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 412 | + $email = give_get_payment_user_email($payment->ID); |
|
| 413 | 413 | |
| 414 | 414 | // Add search term string back to base URL |
| 415 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
| 416 | - if ( ! empty( $search_terms ) ) { |
|
| 417 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
| 415 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
| 416 | + if ( ! empty($search_terms)) { |
|
| 417 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
| 421 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
| 420 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
| 421 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
| 422 | 422 | 'give-action' => 'email_links', |
| 423 | 423 | 'purchase_id' => $payment->ID |
| 424 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
| 424 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
| 425 | 425 | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
| 428 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
| 429 | 429 | 'give-action' => 'delete_payment', |
| 430 | 430 | 'purchase_id' => $payment->ID |
| 431 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
| 431 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
| 432 | 432 | |
| 433 | - return apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
| 433 | + return apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | |
@@ -444,10 +444,10 @@ discard block |
||
| 444 | 444 | * |
| 445 | 445 | * @return string Data shown in the Email column |
| 446 | 446 | */ |
| 447 | - function get_payment_status( $payment ) { |
|
| 448 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
| 449 | - if ( $payment->mode == 'test' ) { |
|
| 450 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
| 447 | + function get_payment_status($payment) { |
|
| 448 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
| 449 | + if ($payment->mode == 'test') { |
|
| 450 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | return $value; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * |
| 464 | 464 | * @return string Displays a checkbox |
| 465 | 465 | */ |
| 466 | - public function column_cb( $payment ) { |
|
| 466 | + public function column_cb($payment) { |
|
| 467 | 467 | return sprintf( |
| 468 | 468 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
| 469 | 469 | 'payment', |
@@ -481,8 +481,8 @@ discard block |
||
| 481 | 481 | * |
| 482 | 482 | * @return string Displays a checkbox |
| 483 | 483 | */ |
| 484 | - public function get_payment_id( $payment ) { |
|
| 485 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
| 484 | + public function get_payment_id($payment) { |
|
| 485 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -495,19 +495,19 @@ discard block |
||
| 495 | 495 | * |
| 496 | 496 | * @return string Data shown in the User column |
| 497 | 497 | */ |
| 498 | - public function get_donor( $payment ) { |
|
| 498 | + public function get_donor($payment) { |
|
| 499 | 499 | |
| 500 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
| 500 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
| 501 | 501 | |
| 502 | - if ( ! empty( $customer_id ) ) { |
|
| 503 | - $customer = new Give_Customer( $customer_id ); |
|
| 504 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
| 502 | + if ( ! empty($customer_id)) { |
|
| 503 | + $customer = new Give_Customer($customer_id); |
|
| 504 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
| 505 | 505 | } else { |
| 506 | - $email = give_get_payment_user_email( $payment->ID ); |
|
| 507 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
| 506 | + $email = give_get_payment_user_email($payment->ID); |
|
| 507 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
| 510 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | /** |
@@ -519,18 +519,18 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | public function get_bulk_actions() { |
| 521 | 521 | $actions = array( |
| 522 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
| 523 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
| 524 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
| 525 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
| 526 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
| 527 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
| 528 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
| 529 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
| 530 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
| 522 | + 'delete' => esc_html__('Delete', 'give'), |
|
| 523 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
| 524 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
| 525 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
| 526 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
| 527 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
| 528 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
| 529 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
| 530 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
| 531 | 531 | ); |
| 532 | 532 | |
| 533 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
| 533 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | /** |
@@ -541,59 +541,59 @@ discard block |
||
| 541 | 541 | * @return void |
| 542 | 542 | */ |
| 543 | 543 | public function process_bulk_action() { |
| 544 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
| 544 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
| 545 | 545 | $action = $this->current_action(); |
| 546 | 546 | |
| 547 | - if ( ! is_array( $ids ) ) { |
|
| 548 | - $ids = array( $ids ); |
|
| 547 | + if ( ! is_array($ids)) { |
|
| 548 | + $ids = array($ids); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - if ( empty( $action ) ) { |
|
| 551 | + if (empty($action)) { |
|
| 552 | 552 | return; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - foreach ( $ids as $id ) { |
|
| 555 | + foreach ($ids as $id) { |
|
| 556 | 556 | |
| 557 | 557 | // Detect when a bulk action is being triggered... |
| 558 | - switch ( $this->current_action() ) { |
|
| 558 | + switch ($this->current_action()) { |
|
| 559 | 559 | |
| 560 | 560 | case'delete': |
| 561 | - give_delete_purchase( $id ); |
|
| 561 | + give_delete_purchase($id); |
|
| 562 | 562 | break; |
| 563 | 563 | |
| 564 | 564 | case 'set-status-publish': |
| 565 | - give_update_payment_status( $id, 'publish' ); |
|
| 565 | + give_update_payment_status($id, 'publish'); |
|
| 566 | 566 | break; |
| 567 | 567 | |
| 568 | 568 | case 'set-status-pending': |
| 569 | - give_update_payment_status( $id, 'pending' ); |
|
| 569 | + give_update_payment_status($id, 'pending'); |
|
| 570 | 570 | break; |
| 571 | 571 | |
| 572 | 572 | case 'set-status-refunded': |
| 573 | - give_update_payment_status( $id, 'refunded' ); |
|
| 573 | + give_update_payment_status($id, 'refunded'); |
|
| 574 | 574 | break; |
| 575 | 575 | case 'set-status-revoked': |
| 576 | - give_update_payment_status( $id, 'revoked' ); |
|
| 576 | + give_update_payment_status($id, 'revoked'); |
|
| 577 | 577 | break; |
| 578 | 578 | |
| 579 | 579 | case 'set-status-failed': |
| 580 | - give_update_payment_status( $id, 'failed' ); |
|
| 580 | + give_update_payment_status($id, 'failed'); |
|
| 581 | 581 | break; |
| 582 | 582 | |
| 583 | 583 | case 'set-status-cancelled': |
| 584 | - give_update_payment_status( $id, 'cancelled' ); |
|
| 584 | + give_update_payment_status($id, 'cancelled'); |
|
| 585 | 585 | break; |
| 586 | 586 | |
| 587 | 587 | case 'set-status-abandoned': |
| 588 | - give_update_payment_status( $id, 'abandoned' ); |
|
| 588 | + give_update_payment_status($id, 'abandoned'); |
|
| 589 | 589 | break; |
| 590 | 590 | |
| 591 | 591 | case 'set-status-preapproval': |
| 592 | - give_update_payment_status( $id, 'preapproval' ); |
|
| 592 | + give_update_payment_status($id, 'preapproval'); |
|
| 593 | 593 | break; |
| 594 | 594 | |
| 595 | 595 | case 'resend-receipt': |
| 596 | - give_email_donation_receipt( $id, false ); |
|
| 596 | + give_email_donation_receipt($id, false); |
|
| 597 | 597 | break; |
| 598 | 598 | } |
| 599 | 599 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | * @param int $id The ID of the payment. |
| 606 | 606 | * @param string $current_action The action that is being triggered. |
| 607 | 607 | */ |
| 608 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
| 608 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | } |
@@ -621,27 +621,27 @@ discard block |
||
| 621 | 621 | |
| 622 | 622 | $args = array(); |
| 623 | 623 | |
| 624 | - if ( isset( $_GET['user'] ) ) { |
|
| 625 | - $args['user'] = urldecode( $_GET['user'] ); |
|
| 626 | - } elseif ( isset( $_GET['s'] ) ) { |
|
| 627 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
| 628 | - if ( $is_user ) { |
|
| 629 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
| 630 | - unset( $args['s'] ); |
|
| 624 | + if (isset($_GET['user'])) { |
|
| 625 | + $args['user'] = urldecode($_GET['user']); |
|
| 626 | + } elseif (isset($_GET['s'])) { |
|
| 627 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
| 628 | + if ($is_user) { |
|
| 629 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
| 630 | + unset($args['s']); |
|
| 631 | 631 | } else { |
| 632 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
| 632 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
| 637 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
| 636 | + if ( ! empty($_GET['start-date'])) { |
|
| 637 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
| 641 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
| 640 | + if ( ! empty($_GET['end-date'])) { |
|
| 641 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - $payment_count = give_count_payments( $args ); |
|
| 644 | + $payment_count = give_count_payments($args); |
|
| 645 | 645 | $this->complete_count = $payment_count->publish; |
| 646 | 646 | $this->pending_count = $payment_count->pending; |
| 647 | 647 | $this->refunded_count = $payment_count->refunded; |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | $this->cancelled_count = $payment_count->cancelled; |
| 651 | 651 | $this->abandoned_count = $payment_count->abandoned; |
| 652 | 652 | |
| 653 | - foreach ( $payment_count as $count ) { |
|
| 653 | + foreach ($payment_count as $count) { |
|
| 654 | 654 | $this->total_count += $count; |
| 655 | 655 | } |
| 656 | 656 | } |
@@ -665,26 +665,26 @@ discard block |
||
| 665 | 665 | public function payments_data() { |
| 666 | 666 | |
| 667 | 667 | $per_page = $this->per_page; |
| 668 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
| 669 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
| 670 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
| 671 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 672 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
| 673 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
| 674 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
| 675 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
| 676 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
| 677 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
| 678 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
| 679 | - |
|
| 680 | - if ( ! empty( $search ) ) { |
|
| 668 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
| 669 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
| 670 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
| 671 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
| 672 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
| 673 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
| 674 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
| 675 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
| 676 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
| 677 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
| 678 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
| 679 | + |
|
| 680 | + if ( ! empty($search)) { |
|
| 681 | 681 | $status = 'any'; // Force all payment statuses when searching |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | $args = array( |
| 685 | 685 | 'output' => 'payments', |
| 686 | 686 | 'number' => $per_page, |
| 687 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
| 687 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
| 688 | 688 | 'orderby' => $orderby, |
| 689 | 689 | 'order' => $order, |
| 690 | 690 | 'user' => $user, |
@@ -698,14 +698,14 @@ discard block |
||
| 698 | 698 | 'end_date' => $end_date, |
| 699 | 699 | ); |
| 700 | 700 | |
| 701 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
| 701 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
| 702 | 702 | |
| 703 | 703 | $args['search_in_notes'] = true; |
| 704 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
| 704 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
| 705 | 705 | |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - $p_query = new Give_Payments_Query( $args ); |
|
| 708 | + $p_query = new Give_Payments_Query($args); |
|
| 709 | 709 | |
| 710 | 710 | return $p_query->get_payments(); |
| 711 | 711 | |
@@ -725,17 +725,17 @@ discard block |
||
| 725 | 725 | */ |
| 726 | 726 | public function prepare_items() { |
| 727 | 727 | |
| 728 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
| 728 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
| 729 | 729 | |
| 730 | 730 | $columns = $this->get_columns(); |
| 731 | 731 | $hidden = array(); // No hidden columns |
| 732 | 732 | $sortable = $this->get_sortable_columns(); |
| 733 | 733 | $data = $this->payments_data(); |
| 734 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
| 734 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
| 735 | 735 | |
| 736 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 736 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 737 | 737 | |
| 738 | - switch ( $status ) { |
|
| 738 | + switch ($status) { |
|
| 739 | 739 | case 'publish': |
| 740 | 740 | $total_items = $this->complete_count; |
| 741 | 741 | break; |
@@ -762,19 +762,19 @@ discard block |
||
| 762 | 762 | break; |
| 763 | 763 | default: |
| 764 | 764 | // Retrieve the count of the non-default-Give status |
| 765 | - $count = wp_count_posts( 'give_payment' ); |
|
| 765 | + $count = wp_count_posts('give_payment'); |
|
| 766 | 766 | $total_items = $count->{$status}; |
| 767 | 767 | break; |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | $this->items = $data; |
| 771 | 771 | |
| 772 | - $this->set_pagination_args( array( |
|
| 772 | + $this->set_pagination_args(array( |
|
| 773 | 773 | 'total_items' => $total_items, |
| 774 | 774 | // WE have to calculate the total number of items |
| 775 | 775 | 'per_page' => $this->per_page, |
| 776 | 776 | // WE have to determine how many items to show on a page |
| 777 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 777 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 778 | 778 | // WE have to calculate the total number of pages |
| 779 | 779 | ) |
| 780 | 780 | ); |
@@ -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 | |
@@ -26,52 +26,52 @@ discard block |
||
| 26 | 26 | * @return void |
| 27 | 27 | * |
| 28 | 28 | */ |
| 29 | -function give_update_payment_details( $data ) { |
|
| 29 | +function give_update_payment_details($data) { |
|
| 30 | 30 | |
| 31 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
| 32 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 31 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
| 32 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
| 35 | + check_admin_referer('give_update_payment_details_nonce'); |
|
| 36 | 36 | |
| 37 | 37 | // Retrieve the payment ID |
| 38 | - $payment_id = absint( $data['give_payment_id'] ); |
|
| 38 | + $payment_id = absint($data['give_payment_id']); |
|
| 39 | 39 | |
| 40 | 40 | /* @var Give_Payment $payment */ |
| 41 | - $payment = new Give_Payment( $payment_id ); |
|
| 41 | + $payment = new Give_Payment($payment_id); |
|
| 42 | 42 | |
| 43 | 43 | // Retrieve existing payment meta |
| 44 | 44 | $meta = $payment->get_meta(); |
| 45 | 45 | $user_info = $payment->user_info; |
| 46 | 46 | |
| 47 | 47 | $status = $data['give-payment-status']; |
| 48 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
| 49 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
| 48 | + $date = sanitize_text_field($data['give-payment-date']); |
|
| 49 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
| 50 | 50 | |
| 51 | 51 | // Restrict to our high and low |
| 52 | - if ( $hour > 23 ) { |
|
| 52 | + if ($hour > 23) { |
|
| 53 | 53 | $hour = 23; |
| 54 | - } elseif ( $hour < 0 ) { |
|
| 54 | + } elseif ($hour < 0) { |
|
| 55 | 55 | $hour = 00; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
| 58 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
| 59 | 59 | |
| 60 | 60 | // Restrict to our high and low |
| 61 | - if ( $minute > 59 ) { |
|
| 61 | + if ($minute > 59) { |
|
| 62 | 62 | $minute = 59; |
| 63 | - } elseif ( $minute < 0 ) { |
|
| 63 | + } elseif ($minute < 0) { |
|
| 64 | 64 | $minute = 00; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
| 67 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
| 68 | 68 | |
| 69 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
| 70 | - $new_total = give_sanitize_amount( $data['give-payment-total'] ); |
|
| 71 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
| 69 | + $curr_total = give_sanitize_amount($payment->total); |
|
| 70 | + $new_total = give_sanitize_amount($data['give-payment-total']); |
|
| 71 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
| 72 | 72 | |
| 73 | - $curr_customer_id = sanitize_text_field( $data['give-current-customer'] ); |
|
| 74 | - $new_customer_id = sanitize_text_field( $data['customer-id'] ); |
|
| 73 | + $curr_customer_id = sanitize_text_field($data['give-current-customer']); |
|
| 74 | + $new_customer_id = sanitize_text_field($data['customer-id']); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Fires before updating edited purchase. |
@@ -80,62 +80,62 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param int $payment_id The ID of the payment. |
| 82 | 82 | */ |
| 83 | - do_action( 'give_update_edited_purchase', $payment_id ); |
|
| 83 | + do_action('give_update_edited_purchase', $payment_id); |
|
| 84 | 84 | |
| 85 | 85 | $payment->date = $date; |
| 86 | 86 | $updated = $payment->save(); |
| 87 | 87 | |
| 88 | - if ( 0 === $updated ) { |
|
| 89 | - wp_die( esc_html__( 'Error Updating Payment.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 88 | + if (0 === $updated) { |
|
| 89 | + wp_die(esc_html__('Error Updating Payment.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | $customer_changed = false; |
| 94 | 94 | |
| 95 | - if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) { |
|
| 95 | + if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') { |
|
| 96 | 96 | |
| 97 | - $email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : ''; |
|
| 98 | - $names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : ''; |
|
| 97 | + $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : ''; |
|
| 98 | + $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : ''; |
|
| 99 | 99 | |
| 100 | - if ( empty( $email ) || empty( $names ) ) { |
|
| 101 | - wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
| 100 | + if (empty($email) || empty($names)) { |
|
| 101 | + wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $customer = new Give_Customer( $email ); |
|
| 105 | - if ( empty( $customer->id ) ) { |
|
| 106 | - $customer_data = array( 'name' => $names, 'email' => $email ); |
|
| 107 | - $user_id = email_exists( $email ); |
|
| 108 | - if ( false !== $user_id ) { |
|
| 104 | + $customer = new Give_Customer($email); |
|
| 105 | + if (empty($customer->id)) { |
|
| 106 | + $customer_data = array('name' => $names, 'email' => $email); |
|
| 107 | + $user_id = email_exists($email); |
|
| 108 | + if (false !== $user_id) { |
|
| 109 | 109 | $customer_data['user_id'] = $user_id; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if ( ! $customer->create( $customer_data ) ) { |
|
| 112 | + if ( ! $customer->create($customer_data)) { |
|
| 113 | 113 | // Failed to crete the new donor, assume the previous donor |
| 114 | 114 | $customer_changed = false; |
| 115 | - $customer = new Give_Customer( $curr_customer_id ); |
|
| 116 | - give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) ); |
|
| 115 | + $customer = new Give_Customer($curr_customer_id); |
|
| 116 | + give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give')); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $new_customer_id = $customer->id; |
| 121 | 121 | |
| 122 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
| 122 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
| 123 | 123 | |
| 124 | 124 | $customer_changed = true; |
| 125 | 125 | |
| 126 | - } elseif ( $curr_customer_id !== $new_customer_id ) { |
|
| 126 | + } elseif ($curr_customer_id !== $new_customer_id) { |
|
| 127 | 127 | |
| 128 | - $customer = new Give_Customer( $new_customer_id ); |
|
| 128 | + $customer = new Give_Customer($new_customer_id); |
|
| 129 | 129 | $email = $customer->email; |
| 130 | 130 | $names = $customer->name; |
| 131 | 131 | |
| 132 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
| 132 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
| 133 | 133 | |
| 134 | 134 | $customer_changed = true; |
| 135 | 135 | |
| 136 | 136 | } else { |
| 137 | 137 | |
| 138 | - $customer = new Give_Customer( $curr_customer_id ); |
|
| 138 | + $customer = new Give_Customer($curr_customer_id); |
|
| 139 | 139 | $email = $customer->email; |
| 140 | 140 | $names = $customer->name; |
| 141 | 141 | |
@@ -143,38 +143,38 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | // Setup first and last name from input values |
| 146 | - $names = explode( ' ', $names ); |
|
| 147 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
| 146 | + $names = explode(' ', $names); |
|
| 147 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
| 148 | 148 | $last_name = ''; |
| 149 | - if ( ! empty( $names[1] ) ) { |
|
| 150 | - unset( $names[0] ); |
|
| 151 | - $last_name = implode( ' ', $names ); |
|
| 149 | + if ( ! empty($names[1])) { |
|
| 150 | + unset($names[0]); |
|
| 151 | + $last_name = implode(' ', $names); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | - if ( $customer_changed ) { |
|
| 155 | + if ($customer_changed) { |
|
| 156 | 156 | |
| 157 | 157 | // Remove the stats and payment from the previous customer and attach it to the new customer |
| 158 | - $previous_customer->remove_payment( $payment_id, false ); |
|
| 159 | - $customer->attach_payment( $payment_id, false ); |
|
| 158 | + $previous_customer->remove_payment($payment_id, false); |
|
| 159 | + $customer->attach_payment($payment_id, false); |
|
| 160 | 160 | |
| 161 | - if ( 'publish' == $status ) { |
|
| 161 | + if ('publish' == $status) { |
|
| 162 | 162 | |
| 163 | 163 | // Reduce previous user donation count and amount. |
| 164 | 164 | $previous_customer->decrease_purchase_count(); |
| 165 | - $previous_customer->decrease_value( $curr_total ); |
|
| 165 | + $previous_customer->decrease_value($curr_total); |
|
| 166 | 166 | |
| 167 | 167 | // If purchase was completed adjust stats of new customers. |
| 168 | 168 | $customer->increase_purchase_count(); |
| 169 | - $customer->increase_value( $new_total ); |
|
| 169 | + $customer->increase_value($new_total); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $payment->customer_id = $customer->id; |
| 173 | - } else{ |
|
| 173 | + } else { |
|
| 174 | 174 | |
| 175 | - if( 'publish' === $status ){ |
|
| 175 | + if ('publish' === $status) { |
|
| 176 | 176 | // Update user donation stat. |
| 177 | - $customer->update_donation_value( $curr_total, $new_total ); |
|
| 177 | + $customer->update_donation_value($curr_total, $new_total); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | // Check for payment notes |
| 191 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
| 191 | + if ( ! empty($data['give-payment-note'])) { |
|
| 192 | 192 | |
| 193 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
| 194 | - give_insert_payment_note( $payment_id, $note ); |
|
| 193 | + $note = wp_kses($data['give-payment-note'], array()); |
|
| 194 | + give_insert_payment_note($payment_id, $note); |
|
| 195 | 195 | |
| 196 | 196 | } |
| 197 | 197 | |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | $payment->status = $status; |
| 200 | 200 | |
| 201 | 201 | // Adjust total store earnings if the payment total has been changed |
| 202 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
| 202 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
| 203 | 203 | |
| 204 | - if ( $new_total > $curr_total ) { |
|
| 204 | + if ($new_total > $curr_total) { |
|
| 205 | 205 | // Increase if our new total is higher |
| 206 | 206 | $difference = $new_total - $curr_total; |
| 207 | - give_increase_total_earnings( $difference ); |
|
| 207 | + give_increase_total_earnings($difference); |
|
| 208 | 208 | |
| 209 | - } elseif ( $curr_total > $new_total ) { |
|
| 209 | + } elseif ($curr_total > $new_total) { |
|
| 210 | 210 | // Decrease if our new total is lower |
| 211 | 211 | $difference = $curr_total - $new_total; |
| 212 | - give_decrease_total_earnings( $difference ); |
|
| 212 | + give_decrease_total_earnings($difference); |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |
@@ -218,16 +218,16 @@ discard block |
||
| 218 | 218 | $payment->save(); |
| 219 | 219 | |
| 220 | 220 | // Get new give form ID. |
| 221 | - $new_form_id = absint( $data['forms'] ); |
|
| 222 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
| 221 | + $new_form_id = absint($data['forms']); |
|
| 222 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
| 223 | 223 | |
| 224 | 224 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
| 225 | 225 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
| 226 | 226 | /* Check if user want to transfer current payment to new give form id. */ |
| 227 | - if( $new_form_id != $current_form_id ) { |
|
| 227 | + if ($new_form_id != $current_form_id) { |
|
| 228 | 228 | |
| 229 | 229 | // Get new give form title. |
| 230 | - $new_form_title = get_the_title( $new_form_id ); |
|
| 230 | + $new_form_title = get_the_title($new_form_id); |
|
| 231 | 231 | |
| 232 | 232 | // Update new give form data in payment data. |
| 233 | 233 | $payment_meta = $payment->get_meta(); |
@@ -235,28 +235,28 @@ discard block |
||
| 235 | 235 | $payment_meta['form_id'] = $new_form_id; |
| 236 | 236 | |
| 237 | 237 | // Update price id post meta data for set donation form. |
| 238 | - if( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 238 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 239 | 239 | $payment_meta['price_id'] = ''; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Update payment give form meta data. |
| 243 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
| 244 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
| 245 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 243 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
| 244 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
| 245 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 246 | 246 | |
| 247 | 247 | // Update price id payment metadata. |
| 248 | - if( ! give_has_variable_prices( $new_form_id ) ) { |
|
| 249 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
| 248 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
| 249 | + $payment->update_meta('_give_payment_price_id', ''); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | // If purchase was completed, adjust stats of forms |
| 254 | - if ( 'publish' == $status ) { |
|
| 254 | + if ('publish' == $status) { |
|
| 255 | 255 | |
| 256 | 256 | // Decrease sale of old give form. For other payment status |
| 257 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
| 257 | + $current_form = new Give_Donate_Form($current_form_id); |
|
| 258 | 258 | $current_form->decrease_sales(); |
| 259 | - $current_form->decrease_earnings( $curr_total ); |
|
| 259 | + $current_form->decrease_earnings($curr_total); |
|
| 260 | 260 | |
| 261 | 261 | // Increase sale of new give form. |
| 262 | 262 | $new_form = new Give_Donate_Form($new_form_id); |
@@ -265,27 +265,27 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // Re setup payment to update new meta value in object. |
| 268 | - $payment->update_payment_setup( $payment->ID ); |
|
| 268 | + $payment->update_payment_setup($payment->ID); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Update price id if current form is variable form. |
| 272 | - if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
| 272 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
| 273 | 273 | |
| 274 | 274 | // Get payment meta data. |
| 275 | 275 | $payment_meta = $payment->get_meta(); |
| 276 | 276 | |
| 277 | 277 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
| 278 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
| 278 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
| 279 | 279 | |
| 280 | 280 | // Update payment meta data. |
| 281 | 281 | $payment_meta['price_id'] = $data['give-variable-price']; |
| 282 | 282 | |
| 283 | 283 | // Update payment give form meta data. |
| 284 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
| 285 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
| 284 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
| 285 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
| 286 | 286 | |
| 287 | 287 | // Re setup payment to update new meta value in object. |
| 288 | - $payment->update_payment_setup( $payment->ID ); |
|
| 288 | + $payment->update_payment_setup($payment->ID); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -295,13 +295,13 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @param int $payment_id The ID of the payment. |
| 297 | 297 | */ |
| 298 | - do_action( 'give_updated_edited_purchase', $payment_id ); |
|
| 298 | + do_action('give_updated_edited_purchase', $payment_id); |
|
| 299 | 299 | |
| 300 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
| 300 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id)); |
|
| 301 | 301 | exit; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
| 304 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * Trigger a Purchase Deletion |
@@ -312,48 +312,48 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @return void |
| 314 | 314 | */ |
| 315 | -function give_trigger_purchase_delete( $data ) { |
|
| 316 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) { |
|
| 315 | +function give_trigger_purchase_delete($data) { |
|
| 316 | + if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) { |
|
| 317 | 317 | |
| 318 | - $payment_id = absint( $data['purchase_id'] ); |
|
| 318 | + $payment_id = absint($data['purchase_id']); |
|
| 319 | 319 | |
| 320 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 321 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 320 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 321 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - give_delete_purchase( $payment_id ); |
|
| 325 | - wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) ); |
|
| 324 | + give_delete_purchase($payment_id); |
|
| 325 | + wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted')); |
|
| 326 | 326 | give_die(); |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | -add_action( 'give_delete_payment', 'give_trigger_purchase_delete' ); |
|
| 330 | +add_action('give_delete_payment', 'give_trigger_purchase_delete'); |
|
| 331 | 331 | |
| 332 | 332 | /** |
| 333 | 333 | * AJAX Store Payment Note |
| 334 | 334 | */ |
| 335 | 335 | function give_ajax_store_payment_note() { |
| 336 | 336 | |
| 337 | - $payment_id = absint( $_POST['payment_id'] ); |
|
| 338 | - $note = wp_kses( $_POST['note'], array() ); |
|
| 337 | + $payment_id = absint($_POST['payment_id']); |
|
| 338 | + $note = wp_kses($_POST['note'], array()); |
|
| 339 | 339 | |
| 340 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
| 341 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 340 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
| 341 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if ( empty( $payment_id ) ) { |
|
| 345 | - die( '-1' ); |
|
| 344 | + if (empty($payment_id)) { |
|
| 345 | + die('-1'); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - if ( empty( $note ) ) { |
|
| 349 | - die( '-1' ); |
|
| 348 | + if (empty($note)) { |
|
| 349 | + die('-1'); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
| 353 | - die( give_get_payment_note_html( $note_id ) ); |
|
| 352 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
| 353 | + die(give_get_payment_note_html($note_id)); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
| 356 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | 359 | * Triggers a payment note deletion without ajax |
@@ -364,24 +364,24 @@ discard block |
||
| 364 | 364 | * |
| 365 | 365 | * @return void |
| 366 | 366 | */ |
| 367 | -function give_trigger_payment_note_deletion( $data ) { |
|
| 367 | +function give_trigger_payment_note_deletion($data) { |
|
| 368 | 368 | |
| 369 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
| 369 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
| 370 | 370 | return; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
| 374 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 373 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
| 374 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
| 377 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id'])); |
|
| 378 | 378 | |
| 379 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
| 379 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
| 380 | 380 | |
| 381 | - wp_redirect( $edit_order_url ); |
|
| 381 | + wp_redirect($edit_order_url); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
| 384 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | 387 | * Delete a payment note deletion with ajax |
@@ -392,16 +392,16 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | function give_ajax_delete_payment_note() { |
| 394 | 394 | |
| 395 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
| 396 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 395 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
| 396 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
| 400 | - die( '1' ); |
|
| 399 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
| 400 | + die('1'); |
|
| 401 | 401 | } else { |
| 402 | - die( '-1' ); |
|
| 402 | + die('-1'); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
| 408 | 407 | \ No newline at end of file |
| 408 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
| 409 | 409 | \ No newline at end of file |
@@ -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 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | * @since 1.0 |
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
| 31 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
| 32 | - add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000 ); |
|
| 30 | + add_action('admin_notices', array($this, 'show_notices')); |
|
| 31 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
| 32 | + add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | public function give_admin_bar_menu() { |
| 43 | 43 | global $wp_admin_bar; |
| 44 | 44 | |
| 45 | - if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) { |
|
| 45 | + if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | //Add the main siteadmin menu item |
| 50 | - $wp_admin_bar->add_menu( array( |
|
| 50 | + $wp_admin_bar->add_menu(array( |
|
| 51 | 51 | 'id' => 'give-test-notice', |
| 52 | - 'href' => admin_url() . 'edit.php?post_type=give_forms&page=give-settings&tab=gateways', |
|
| 52 | + 'href' => admin_url().'edit.php?post_type=give_forms&page=give-settings&tab=gateways', |
|
| 53 | 53 | 'parent' => 'top-secondary', |
| 54 | - 'title' => esc_html__( 'Give Test Mode Active', 'give' ), |
|
| 55 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
| 56 | - ) ); |
|
| 54 | + 'title' => esc_html__('Give Test Mode Active', 'give'), |
|
| 55 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
| 56 | + )); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -68,98 +68,98 @@ discard block |
||
| 68 | 68 | 'error' => array() |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | - if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) { |
|
| 71 | + if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) { |
|
| 72 | 72 | echo '<div class="error">'; |
| 73 | - echo '<p>' . esc_html__( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>'; |
|
| 73 | + echo '<p>'.esc_html__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>'; |
|
| 74 | 74 | /* translators: %s: https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/ */ |
| 75 | - echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/' ) ) . '</p>'; |
|
| 76 | - echo '<p><a href="' . add_query_arg( array( |
|
| 75 | + echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/')).'</p>'; |
|
| 76 | + echo '<p><a href="'.add_query_arg(array( |
|
| 77 | 77 | 'give_action' => 'dismiss_notices', |
| 78 | 78 | 'give_notice' => 'admin_ajax_inaccessible' |
| 79 | - ) ) . '">' . esc_attr__( 'Dismiss Notice', 'give' ) . '</a></p>'; |
|
| 79 | + )).'">'.esc_attr__('Dismiss Notice', 'give').'</a></p>'; |
|
| 80 | 80 | echo '</div>'; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | - if ( isset( $_GET['give-message'] ) ) { |
|
| 84 | + if (isset($_GET['give-message'])) { |
|
| 85 | 85 | |
| 86 | 86 | // Donation reports errors |
| 87 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
| 88 | - switch ( $_GET['give-message'] ) { |
|
| 87 | + if (current_user_can('view_give_reports')) { |
|
| 88 | + switch ($_GET['give-message']) { |
|
| 89 | 89 | case 'payment_deleted' : |
| 90 | - $notices['updated']['give-payment-deleted'] = esc_attr__( 'The payment has been deleted.', 'give' ); |
|
| 90 | + $notices['updated']['give-payment-deleted'] = esc_attr__('The payment has been deleted.', 'give'); |
|
| 91 | 91 | break; |
| 92 | 92 | case 'email_sent' : |
| 93 | - $notices['updated']['give-payment-sent'] = esc_attr__( 'The donation receipt has been resent.', 'give' ); |
|
| 93 | + $notices['updated']['give-payment-sent'] = esc_attr__('The donation receipt has been resent.', 'give'); |
|
| 94 | 94 | break; |
| 95 | 95 | case 'refreshed-reports' : |
| 96 | - $notices['updated']['give-refreshed-reports'] = esc_attr__( 'The reports cache has been cleared.', 'give' ); |
|
| 96 | + $notices['updated']['give-refreshed-reports'] = esc_attr__('The reports cache has been cleared.', 'give'); |
|
| 97 | 97 | break; |
| 98 | 98 | case 'payment-note-deleted' : |
| 99 | - $notices['updated']['give-payment-note-deleted'] = esc_attr__( 'The payment note has been deleted.', 'give' ); |
|
| 99 | + $notices['updated']['give-payment-note-deleted'] = esc_attr__('The payment note has been deleted.', 'give'); |
|
| 100 | 100 | break; |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // Give settings notices and errors |
| 105 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
| 106 | - switch ( $_GET['give-message'] ) { |
|
| 105 | + if (current_user_can('manage_give_settings')) { |
|
| 106 | + switch ($_GET['give-message']) { |
|
| 107 | 107 | case 'settings-imported' : |
| 108 | - $notices['updated']['give-settings-imported'] = esc_attr__( 'The settings have been imported.', 'give' ); |
|
| 108 | + $notices['updated']['give-settings-imported'] = esc_attr__('The settings have been imported.', 'give'); |
|
| 109 | 109 | break; |
| 110 | 110 | case 'api-key-generated' : |
| 111 | - $notices['updated']['give-api-key-generated'] = esc_attr__( 'API keys have been generated.', 'give' ); |
|
| 111 | + $notices['updated']['give-api-key-generated'] = esc_attr__('API keys have been generated.', 'give'); |
|
| 112 | 112 | break; |
| 113 | 113 | case 'api-key-exists' : |
| 114 | - $notices['error']['give-api-key-exists'] = esc_attr__( 'The specified user already has API keys.', 'give' ); |
|
| 114 | + $notices['error']['give-api-key-exists'] = esc_attr__('The specified user already has API keys.', 'give'); |
|
| 115 | 115 | break; |
| 116 | 116 | case 'api-key-regenerated' : |
| 117 | - $notices['updated']['give-api-key-regenerated'] = esc_attr__( 'API keys have been regenerated.', 'give' ); |
|
| 117 | + $notices['updated']['give-api-key-regenerated'] = esc_attr__('API keys have been regenerated.', 'give'); |
|
| 118 | 118 | break; |
| 119 | 119 | case 'api-key-revoked' : |
| 120 | - $notices['updated']['give-api-key-revoked'] = esc_attr__( 'API keys have been revoked.', 'give' ); |
|
| 120 | + $notices['updated']['give-api-key-revoked'] = esc_attr__('API keys have been revoked.', 'give'); |
|
| 121 | 121 | break; |
| 122 | 122 | case 'sent-test-email' : |
| 123 | - $notices['updated']['give-sent-test-email'] = esc_attr__( 'The test email has been sent.', 'give' ); |
|
| 123 | + $notices['updated']['give-sent-test-email'] = esc_attr__('The test email has been sent.', 'give'); |
|
| 124 | 124 | break; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | // Payments errors |
| 128 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
| 129 | - switch ( $_GET['give-message'] ) { |
|
| 128 | + if (current_user_can('edit_give_payments')) { |
|
| 129 | + switch ($_GET['give-message']) { |
|
| 130 | 130 | case 'note-added' : |
| 131 | - $notices['updated']['give-note-added'] = esc_attr__( 'The payment note has been added.', 'give' ); |
|
| 131 | + $notices['updated']['give-note-added'] = esc_attr__('The payment note has been added.', 'give'); |
|
| 132 | 132 | break; |
| 133 | 133 | case 'payment-updated' : |
| 134 | - $notices['updated']['give-payment-updated'] = esc_attr__( 'The payment has been updated.', 'give' ); |
|
| 134 | + $notices['updated']['give-payment-updated'] = esc_attr__('The payment has been updated.', 'give'); |
|
| 135 | 135 | break; |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Customer Notices |
| 140 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
| 141 | - switch ( $_GET['give-message'] ) { |
|
| 140 | + if (current_user_can('edit_give_payments')) { |
|
| 141 | + switch ($_GET['give-message']) { |
|
| 142 | 142 | case 'customer-deleted' : |
| 143 | - $notices['updated']['give-customer-deleted'] = esc_attr__( 'The donor has been deleted.', 'give' ); |
|
| 143 | + $notices['updated']['give-customer-deleted'] = esc_attr__('The donor has been deleted.', 'give'); |
|
| 144 | 144 | break; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( count( $notices['updated'] ) > 0 ) { |
|
| 151 | - foreach ( $notices['updated'] as $notice => $message ) { |
|
| 152 | - add_settings_error( 'give-notices', $notice, $message, 'updated' ); |
|
| 150 | + if (count($notices['updated']) > 0) { |
|
| 151 | + foreach ($notices['updated'] as $notice => $message) { |
|
| 152 | + add_settings_error('give-notices', $notice, $message, 'updated'); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( count( $notices['error'] ) > 0 ) { |
|
| 157 | - foreach ( $notices['error'] as $notice => $message ) { |
|
| 158 | - add_settings_error( 'give-notices', $notice, $message, 'error' ); |
|
| 156 | + if (count($notices['error']) > 0) { |
|
| 157 | + foreach ($notices['error'] as $notice => $message) { |
|
| 158 | + add_settings_error('give-notices', $notice, $message, 'error'); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - settings_errors( 'give-notices' ); |
|
| 162 | + settings_errors('give-notices'); |
|
| 163 | 163 | |
| 164 | 164 | } |
| 165 | 165 | |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | * @return void |
| 172 | 172 | */ |
| 173 | 173 | function give_admin_addons_notices() { |
| 174 | - add_settings_error( 'give-notices', 'give-addons-feed-error', esc_attr__( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' ); |
|
| 175 | - settings_errors( 'give-notices' ); |
|
| 174 | + add_settings_error('give-notices', 'give-addons-feed-error', esc_attr__('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error'); |
|
| 175 | + settings_errors('give-notices'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | * @return void |
| 184 | 184 | */ |
| 185 | 185 | function dismiss_notices() { |
| 186 | - if ( isset( $_GET['give_notice'] ) ) { |
|
| 187 | - update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 ); |
|
| 188 | - wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) ); |
|
| 186 | + if (isset($_GET['give_notice'])) { |
|
| 187 | + update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1); |
|
| 188 | + wp_redirect(remove_query_arg(array('give_action', 'give_notice'))); |
|
| 189 | 189 | exit; |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -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 | |