@@ -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 donation 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 donation. 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 donation. 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 | $currency_code = $payment->currency; |
| 46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | <h1 id="transaction-details-heading"><?php |
| 53 | 53 | printf( |
| 54 | 54 | /* translators: %s: donation number */ |
| 55 | - esc_html__( 'Donation %s', 'give' ), |
|
| 55 | + esc_html__('Donation %s', 'give'), |
|
| 56 | 56 | $number |
| 57 | 57 | ); |
| 58 | - if ( $payment_mode == 'test' ) { |
|
| 59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
| 58 | + if ($payment_mode == 'test') { |
|
| 59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
| 60 | 60 | } |
| 61 | 61 | ?></h1> |
| 62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param int $payment_id Payment id. |
| 70 | 70 | */ |
| 71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
| 71 | + do_action('give_view_order_details_before', $payment_id); |
|
| 72 | 72 | ?> |
| 73 | 73 | <form id="give-edit-order-form" method="post"> |
| 74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param int $payment_id Payment id. |
| 81 | 81 | */ |
| 82 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
| 82 | + do_action('give_view_order_details_form_top', $payment_id); |
|
| 83 | 83 | ?> |
| 84 | 84 | <div id="poststuff"> |
| 85 | 85 | <div id="give-dashboard-widgets-wrap"> |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @param int $payment_id Payment id. |
| 97 | 97 | */ |
| 98 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
| 98 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
| 99 | 99 | ?> |
| 100 | 100 | |
| 101 | 101 | <div id="give-order-update" class="postbox give-order-data"> |
| 102 | 102 | |
| 103 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
| 103 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
| 104 | 104 | |
| 105 | 105 | <div class="inside"> |
| 106 | 106 | <div class="give-admin-box"> |
@@ -113,33 +113,33 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param int $payment_id Payment id. |
| 115 | 115 | */ |
| 116 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
| 116 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
| 117 | 117 | ?> |
| 118 | 118 | |
| 119 | 119 | <div class="give-admin-box-inside"> |
| 120 | 120 | <p> |
| 121 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
| 121 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
| 122 | 122 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
| 123 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
| 124 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
| 123 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
| 124 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
| 125 | 125 | <?php endforeach; ?> |
| 126 | 126 | </select> |
| 127 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 127 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
| 128 | 128 | </p> |
| 129 | 129 | </div> |
| 130 | 130 | |
| 131 | 131 | <div class="give-admin-box-inside"> |
| 132 | 132 | <p> |
| 133 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
| 134 | - <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"/> |
|
| 133 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
| 134 | + <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"/> |
|
| 135 | 135 | </p> |
| 136 | 136 | </div> |
| 137 | 137 | |
| 138 | 138 | <div class="give-admin-box-inside"> |
| 139 | 139 | <p> |
| 140 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
| 141 | - <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"/> : |
|
| 142 | - <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"/> |
|
| 140 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
| 141 | + <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"/> : |
|
| 142 | + <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"/> |
|
| 143 | 143 | </p> |
| 144 | 144 | </div> |
| 145 | 145 | |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | * |
| 154 | 154 | * @param int $payment_id Payment id. |
| 155 | 155 | */ |
| 156 | - do_action( 'give_view_order_details_update_inner', $payment_id ); |
|
| 156 | + do_action('give_view_order_details_update_inner', $payment_id); |
|
| 157 | 157 | |
| 158 | 158 | // @TODO: Fees |
| 159 | - $fees = give_get_payment_fees( $payment_id ); |
|
| 160 | - if ( ! empty( $fees ) ) : ?> |
|
| 159 | + $fees = give_get_payment_fees($payment_id); |
|
| 160 | + if ( ! empty($fees)) : ?> |
|
| 161 | 161 | <div class="give-order-fees give-admin-box-inside"> |
| 162 | - <p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p> |
|
| 162 | + <p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p> |
|
| 163 | 163 | <ul class="give-payment-fees"> |
| 164 | - <?php foreach ( $fees as $fee ) : ?> |
|
| 164 | + <?php foreach ($fees as $fee) : ?> |
|
| 165 | 165 | <li> |
| 166 | 166 | <span class="fee-label"><?php echo $fee['label']; ?>:</span> |
| 167 | - <span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
| 167 | + <span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
| 168 | 168 | </li> |
| 169 | 169 | <?php endforeach; ?> |
| 170 | 170 | </ul> |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | <div class="give-order-payment give-admin-box-inside"> |
| 175 | 175 | <p> |
| 176 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
| 177 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
| 178 | - <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 ) ) ); ?>"/> |
|
| 176 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
| 177 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
| 178 | + <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))); ?>"/> |
|
| 179 | 179 | </p> |
| 180 | 180 | </div> |
| 181 | 181 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * |
| 188 | 188 | * @param int $payment_id Payment id. |
| 189 | 189 | */ |
| 190 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
| 190 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
| 191 | 191 | ?> |
| 192 | 192 | |
| 193 | 193 | </div> |
@@ -205,17 +205,17 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @param int $payment_id Payment id. |
| 207 | 207 | */ |
| 208 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
| 208 | + do_action('give_view_order_details_update_before', $payment_id); |
|
| 209 | 209 | ?> |
| 210 | 210 | |
| 211 | 211 | <div id="major-publishing-actions"> |
| 212 | 212 | <div id="publishing-action"> |
| 213 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
| 214 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
| 215 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 213 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
| 214 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
| 215 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 216 | 216 | 'give-action' => 'email_links', |
| 217 | 217 | 'purchase_id' => $payment_id, |
| 218 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
| 218 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
| 219 | 219 | <?php endif; ?> |
| 220 | 220 | </div> |
| 221 | 221 | <div class="clear"></div> |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @param int $payment_id Payment id. |
| 231 | 231 | */ |
| 232 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
| 232 | + do_action('give_view_order_details_update_after', $payment_id); |
|
| 233 | 233 | ?> |
| 234 | 234 | |
| 235 | 235 | </div> |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | <div id="give-order-details" class="postbox give-order-data"> |
| 242 | 242 | |
| 243 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
| 243 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
| 244 | 244 | |
| 245 | 245 | <div class="inside"> |
| 246 | 246 | <div class="give-admin-box"> |
@@ -253,44 +253,44 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @param int $payment_id Payment id. |
| 255 | 255 | */ |
| 256 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
| 256 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
| 257 | 257 | |
| 258 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
| 259 | - if ( $gateway ) : ?> |
|
| 258 | + $gateway = give_get_payment_gateway($payment_id); |
|
| 259 | + if ($gateway) : ?> |
|
| 260 | 260 | <div class="give-order-gateway give-admin-box-inside"> |
| 261 | 261 | <p> |
| 262 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
| 263 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
| 262 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
| 263 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
| 264 | 264 | </p> |
| 265 | 265 | </div> |
| 266 | 266 | <?php endif; ?> |
| 267 | 267 | |
| 268 | 268 | <div class="give-order-payment-key give-admin-box-inside"> |
| 269 | 269 | <p> |
| 270 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
| 271 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
| 270 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
| 271 | + <?php echo give_get_payment_key($payment_id); ?> |
|
| 272 | 272 | </p> |
| 273 | 273 | </div> |
| 274 | 274 | |
| 275 | 275 | <div class="give-order-ip give-admin-box-inside"> |
| 276 | 276 | <p> |
| 277 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
| 278 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
| 277 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
| 278 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
| 279 | 279 | </p> |
| 280 | 280 | </div> |
| 281 | 281 | |
| 282 | - <?php if ( $transaction_id ) : ?> |
|
| 282 | + <?php if ($transaction_id) : ?> |
|
| 283 | 283 | <div class="give-order-tx-id give-admin-box-inside"> |
| 284 | 284 | <p> |
| 285 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
| 286 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
| 285 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
| 286 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
| 287 | 287 | </p> |
| 288 | 288 | </div> |
| 289 | 289 | <?php endif; ?> |
| 290 | 290 | |
| 291 | 291 | <div class="give-admin-box-inside"> |
| 292 | - <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 ) ) ) ); ?> |
|
| 293 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
| 292 | + <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)))); ?> |
|
| 293 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
| 294 | 294 | </p> |
| 295 | 295 | </div> |
| 296 | 296 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @param int $payment_id Payment id. |
| 304 | 304 | */ |
| 305 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
| 305 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
| 306 | 306 | ?> |
| 307 | 307 | |
| 308 | 308 | </div> |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @param int $payment_id Payment id. |
| 324 | 324 | */ |
| 325 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
| 325 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
| 326 | 326 | ?> |
| 327 | 327 | |
| 328 | 328 | </div> |
@@ -342,55 +342,55 @@ discard block |
||
| 342 | 342 | * |
| 343 | 343 | * @param int $payment_id Payment id. |
| 344 | 344 | */ |
| 345 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
| 345 | + do_action('give_view_order_details_main_before', $payment_id); |
|
| 346 | 346 | ?> |
| 347 | 347 | |
| 348 | 348 | <?php $column_count = 'columns-3'; ?> |
| 349 | 349 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
| 350 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
| 350 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
| 351 | 351 | |
| 352 | 352 | <div class="inside"> |
| 353 | 353 | |
| 354 | 354 | <div class="column-container"> |
| 355 | 355 | <div class="column"> |
| 356 | 356 | <p> |
| 357 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
| 357 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
| 358 | 358 | <?php |
| 359 | - if ( $payment_meta['form_id'] ) : |
|
| 359 | + if ($payment_meta['form_id']) : |
|
| 360 | 360 | printf( |
| 361 | 361 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 362 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
| 362 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
| 363 | 363 | $payment_meta['form_id'] |
| 364 | 364 | ); |
| 365 | 365 | endif; |
| 366 | 366 | ?> |
| 367 | 367 | </p> |
| 368 | 368 | <p> |
| 369 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
| 370 | - <?php give_get_form_dropdown( array( |
|
| 369 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
| 370 | + <?php give_get_form_dropdown(array( |
|
| 371 | 371 | 'id' => $payment_meta['form_id'], |
| 372 | 372 | 'selected' => $payment_meta['form_id'], |
| 373 | 373 | 'chosen' => true, |
| 374 | - ), true ); ?> |
|
| 374 | + ), true); ?> |
|
| 375 | 375 | </p> |
| 376 | 376 | </div> |
| 377 | 377 | <div class="column"> |
| 378 | 378 | <p> |
| 379 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
| 380 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
| 379 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
| 380 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
| 381 | 381 | </p> |
| 382 | 382 | <p> |
| 383 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
| 383 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
| 384 | 384 | <span class="give-donation-level"> |
| 385 | 385 | <?php |
| 386 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
| 387 | - if ( empty( $var_prices ) ) { |
|
| 388 | - esc_html_e( 'n/a', 'give' ); |
|
| 386 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
| 387 | + if (empty($var_prices)) { |
|
| 388 | + esc_html_e('n/a', 'give'); |
|
| 389 | 389 | } else { |
| 390 | 390 | $prices_atts = ''; |
| 391 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
| 392 | - foreach ( $variable_prices as $variable_price ) { |
|
| 393 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
| 391 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
| 392 | + foreach ($variable_prices as $variable_price) { |
|
| 393 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | // Variable price dropdown options. |
@@ -400,11 +400,11 @@ discard block |
||
| 400 | 400 | 'chosen' => true, |
| 401 | 401 | 'show_option_all' => '', |
| 402 | 402 | 'show_option_none' => '', |
| 403 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
| 403 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
| 404 | 404 | 'selected' => $payment_meta['price_id'], |
| 405 | 405 | ); |
| 406 | 406 | // Render variable prices select tag html. |
| 407 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
| 407 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
| 408 | 408 | } |
| 409 | 409 | ?> |
| 410 | 410 | </span> |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | </div> |
| 413 | 413 | <div class="column"> |
| 414 | 414 | <p> |
| 415 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
| 416 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?> |
|
| 415 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
| 416 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?> |
|
| 417 | 417 | </p> |
| 418 | 418 | <p> |
| 419 | 419 | <?php |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | * |
| 427 | 427 | * @param int $payment_id Payment id. |
| 428 | 428 | */ |
| 429 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
| 429 | + do_action('give_donation_details_thead_before', $payment_id); |
|
| 430 | 430 | |
| 431 | 431 | |
| 432 | 432 | /** |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | * |
| 439 | 439 | * @param int $payment_id Payment id. |
| 440 | 440 | */ |
| 441 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
| 441 | + do_action('give_donation_details_thead_after', $payment_id); |
|
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | 444 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * |
| 450 | 450 | * @param int $payment_id Payment id. |
| 451 | 451 | */ |
| 452 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
| 452 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
| 453 | 453 | |
| 454 | 454 | /** |
| 455 | 455 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * |
| 461 | 461 | * @param int $payment_id Payment id. |
| 462 | 462 | */ |
| 463 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
| 463 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
| 464 | 464 | ?> |
| 465 | 465 | </p> |
| 466 | 466 | </div> |
@@ -480,57 +480,57 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @param int $payment_id Payment id. |
| 482 | 482 | */ |
| 483 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
| 483 | + do_action('give_view_order_details_files_after', $payment_id); |
|
| 484 | 484 | ?> |
| 485 | 485 | |
| 486 | 486 | <div id="give-donor-details" class="postbox"> |
| 487 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
| 487 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
| 488 | 488 | |
| 489 | 489 | <div class="inside"> |
| 490 | 490 | |
| 491 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
| 491 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
| 492 | 492 | |
| 493 | 493 | <div class="column-container customer-info"> |
| 494 | 494 | <div class="column"> |
| 495 | 495 | <p> |
| 496 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
| 496 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
| 497 | 497 | <?php |
| 498 | - if ( ! empty( $customer->id ) ) { |
|
| 498 | + if ( ! empty($customer->id)) { |
|
| 499 | 499 | printf( |
| 500 | 500 | '<a href="%1$s" target="_blank">#%2$s</a>', |
| 501 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ), |
|
| 501 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id), |
|
| 502 | 502 | $customer->id |
| 503 | 503 | ); |
| 504 | 504 | } |
| 505 | 505 | ?> |
| 506 | 506 | </p> |
| 507 | 507 | <p> |
| 508 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
| 509 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
| 508 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
| 509 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
| 510 | 510 | </p> |
| 511 | 511 | </div> |
| 512 | 512 | <div class="column"> |
| 513 | 513 | <p> |
| 514 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
| 514 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
| 515 | 515 | <?php echo $customer->name; ?> |
| 516 | 516 | </p> |
| 517 | 517 | <p> |
| 518 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
| 518 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
| 519 | 519 | <?php echo $customer->email; ?> |
| 520 | 520 | </p> |
| 521 | 521 | </div> |
| 522 | 522 | <div class="column"> |
| 523 | 523 | <p> |
| 524 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
| 524 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
| 525 | 525 | <?php |
| 526 | - echo Give()->html->donor_dropdown( array( |
|
| 526 | + echo Give()->html->donor_dropdown(array( |
|
| 527 | 527 | 'selected' => $customer->id, |
| 528 | 528 | 'name' => 'customer-id', |
| 529 | - ) ); |
|
| 529 | + )); |
|
| 530 | 530 | ?> |
| 531 | 531 | </p> |
| 532 | 532 | <p> |
| 533 | - <a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
| 533 | + <a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
| 534 | 534 | </p> |
| 535 | 535 | </div> |
| 536 | 536 | </div> |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | <div class="column-container new-customer" style="display: none"> |
| 539 | 539 | <div class="column"> |
| 540 | 540 | <p> |
| 541 | - <label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
| 541 | + <label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
| 542 | 542 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
| 543 | 543 | </p> |
| 544 | 544 | </div> |
| 545 | 545 | <div class="column"> |
| 546 | 546 | <p> |
| 547 | - <label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
| 547 | + <label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
| 548 | 548 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
| 549 | 549 | </p> |
| 550 | 550 | </div> |
@@ -552,9 +552,9 @@ discard block |
||
| 552 | 552 | <p> |
| 553 | 553 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
| 554 | 554 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
| 555 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
| 555 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
| 556 | 556 | <br> |
| 557 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
| 557 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
| 558 | 558 | </p> |
| 559 | 559 | </div> |
| 560 | 560 | </div> |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | * @param array $payment_meta Payment meta. |
| 571 | 571 | * @param array $user_info User information. |
| 572 | 572 | */ |
| 573 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
| 573 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
| 574 | 574 | |
| 575 | 575 | /** |
| 576 | 576 | * Fires in order details page, in the donor-details metabox. |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | * |
| 580 | 580 | * @param int $payment_id Payment id. |
| 581 | 581 | */ |
| 582 | - do_action( 'give_payment_view_details', $payment_id ); |
|
| 582 | + do_action('give_payment_view_details', $payment_id); |
|
| 583 | 583 | ?> |
| 584 | 584 | |
| 585 | 585 | </div> |
@@ -595,11 +595,11 @@ discard block |
||
| 595 | 595 | * |
| 596 | 596 | * @param int $payment_id Payment id. |
| 597 | 597 | */ |
| 598 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
| 598 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
| 599 | 599 | ?> |
| 600 | 600 | |
| 601 | 601 | <div id="give-billing-details" class="postbox"> |
| 602 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
| 602 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
| 603 | 603 | |
| 604 | 604 | <div class="inside"> |
| 605 | 605 | |
@@ -609,57 +609,57 @@ discard block |
||
| 609 | 609 | <div class="data column-container"> |
| 610 | 610 | <div class="column"> |
| 611 | 611 | <div class="give-wrap-address-line1"> |
| 612 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
| 613 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
| 612 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
| 613 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
| 614 | 614 | </div> |
| 615 | 615 | <div class="give-wrap-address-line2"> |
| 616 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
| 617 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
| 616 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
| 617 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
| 618 | 618 | </div> |
| 619 | 619 | </div> |
| 620 | 620 | <div class="column"> |
| 621 | 621 | <div class="give-wrap-address-city"> |
| 622 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
| 623 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
| 622 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
| 623 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
| 624 | 624 | </div> |
| 625 | 625 | <div class="give-wrap-address-zip"> |
| 626 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
| 627 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
| 626 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
| 627 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
| 628 | 628 | |
| 629 | 629 | </div> |
| 630 | 630 | </div> |
| 631 | 631 | <div class="column"> |
| 632 | 632 | <div id="give-order-address-country-wrap"> |
| 633 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
| 633 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
| 634 | 634 | <?php |
| 635 | - echo Give()->html->select( array( |
|
| 635 | + echo Give()->html->select(array( |
|
| 636 | 636 | 'options' => give_get_country_list(), |
| 637 | 637 | 'name' => 'give-payment-address[0][country]', |
| 638 | 638 | 'selected' => $address['country'], |
| 639 | 639 | 'show_option_all' => false, |
| 640 | 640 | 'show_option_none' => false, |
| 641 | 641 | 'chosen' => true, |
| 642 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
| 643 | - ) ); |
|
| 642 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
| 643 | + )); |
|
| 644 | 644 | ?> |
| 645 | 645 | </div> |
| 646 | 646 | <div id="give-order-address-state-wrap"> |
| 647 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
| 647 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
| 648 | 648 | <?php |
| 649 | - $states = give_get_states( $address['country'] ); |
|
| 650 | - if ( ! empty( $states ) ) { |
|
| 651 | - echo Give()->html->select( array( |
|
| 649 | + $states = give_get_states($address['country']); |
|
| 650 | + if ( ! empty($states)) { |
|
| 651 | + echo Give()->html->select(array( |
|
| 652 | 652 | 'options' => $states, |
| 653 | 653 | 'name' => 'give-payment-address[0][state]', |
| 654 | 654 | 'selected' => $address['state'], |
| 655 | 655 | 'show_option_all' => false, |
| 656 | 656 | 'show_option_none' => false, |
| 657 | 657 | 'chosen' => true, |
| 658 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
| 659 | - ) ); |
|
| 658 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
| 659 | + )); |
|
| 660 | 660 | } else { |
| 661 | 661 | ?> |
| 662 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
| 662 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
| 663 | 663 | <?php |
| 664 | 664 | } ?> |
| 665 | 665 | </div> |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | * |
| 680 | 680 | * @param int $payment_id Payment id. |
| 681 | 681 | */ |
| 682 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
| 682 | + do_action('give_payment_billing_details', $payment_id); |
|
| 683 | 683 | ?> |
| 684 | 684 | |
| 685 | 685 | </div> |
@@ -695,32 +695,32 @@ discard block |
||
| 695 | 695 | * |
| 696 | 696 | * @param int $payment_id Payment id. |
| 697 | 697 | */ |
| 698 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
| 698 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
| 699 | 699 | ?> |
| 700 | 700 | |
| 701 | 701 | <div id="give-payment-notes" class="postbox"> |
| 702 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
| 702 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
| 703 | 703 | |
| 704 | 704 | <div class="inside"> |
| 705 | 705 | <div id="give-payment-notes-inner"> |
| 706 | 706 | <?php |
| 707 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 708 | - if ( ! empty( $notes ) ) { |
|
| 707 | + $notes = give_get_payment_notes($payment_id); |
|
| 708 | + if ( ! empty($notes)) { |
|
| 709 | 709 | $no_notes_display = ' style="display:none;"'; |
| 710 | - foreach ( $notes as $note ) : |
|
| 710 | + foreach ($notes as $note) : |
|
| 711 | 711 | |
| 712 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
| 712 | + echo give_get_payment_note_html($note, $payment_id); |
|
| 713 | 713 | |
| 714 | 714 | endforeach; |
| 715 | 715 | } else { |
| 716 | 716 | $no_notes_display = ''; |
| 717 | 717 | } |
| 718 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
| 718 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
| 719 | 719 | </div> |
| 720 | 720 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 721 | 721 | |
| 722 | 722 | <div class="give-clearfix"> |
| 723 | - <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> |
|
| 723 | + <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> |
|
| 724 | 724 | </div> |
| 725 | 725 | |
| 726 | 726 | </div> |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | * |
| 737 | 737 | * @param int $payment_id Payment id. |
| 738 | 738 | */ |
| 739 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
| 739 | + do_action('give_view_order_details_main_after', $payment_id); |
|
| 740 | 740 | ?> |
| 741 | 741 | |
| 742 | 742 | </div> |
@@ -758,11 +758,11 @@ discard block |
||
| 758 | 758 | * |
| 759 | 759 | * @param int $payment_id Payment id. |
| 760 | 760 | */ |
| 761 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
| 761 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
| 762 | 762 | |
| 763 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
| 763 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
| 764 | 764 | ?> |
| 765 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
| 765 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
| 766 | 766 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 767 | 767 | </form> |
| 768 | 768 | <?php |
@@ -773,6 +773,6 @@ discard block |
||
| 773 | 773 | * |
| 774 | 774 | * @param int $payment_id Payment id. |
| 775 | 775 | */ |
| 776 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
| 776 | + do_action('give_view_order_details_after', $payment_id); |
|
| 777 | 777 | ?> |
| 778 | 778 | </div><!-- /.wrap --> |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; // Exit if accessed directly |
| 13 | 13 | } |
| 14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return bool|string |
| 24 | 24 | */ |
| 25 | -function give_is_field_callback_exist( $field ) { |
|
| 26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
| 25 | +function give_is_field_callback_exist($field) { |
|
| 26 | + return (give_get_field_callback($field) ? true : false); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return bool|string |
| 37 | 37 | */ |
| 38 | -function give_get_field_callback( $field ) { |
|
| 38 | +function give_get_field_callback($field) { |
|
| 39 | 39 | $func_name_prefix = 'give'; |
| 40 | 40 | $func_name = ''; |
| 41 | 41 | |
| 42 | 42 | // Set callback function on basis of cmb2 field name. |
| 43 | - switch ( $field['type'] ) { |
|
| 43 | + switch ($field['type']) { |
|
| 44 | 44 | case 'radio_inline': |
| 45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
| 46 | 46 | break; |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | default: |
| 77 | 77 | |
| 78 | 78 | if ( |
| 79 | - array_key_exists( 'callback', $field ) |
|
| 80 | - && ! empty( $field['callback'] ) |
|
| 79 | + array_key_exists('callback', $field) |
|
| 80 | + && ! empty($field['callback']) |
|
| 81 | 81 | ) { |
| 82 | 82 | $func_name = $field['callback']; |
| 83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @since 1.8 |
| 92 | 92 | */ |
| 93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
| 93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
| 94 | 94 | |
| 95 | 95 | // Exit if not any function exist. |
| 96 | 96 | // Check if render callback exist or not. |
| 97 | - if ( empty( $func_name ) ) { |
|
| 97 | + if (empty($func_name)) { |
|
| 98 | 98 | return false; |
| 99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
| 99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
| 100 | 100 | return false; |
| 101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
| 101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
| 102 | 102 | return false; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @return bool |
| 116 | 116 | */ |
| 117 | -function give_render_field( $field ) { |
|
| 117 | +function give_render_field($field) { |
|
| 118 | 118 | |
| 119 | 119 | // Check if render callback exist or not. |
| 120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
| 120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
| 125 | - if ( empty( $field['class'] ) ) { |
|
| 125 | + if (empty($field['class'])) { |
|
| 126 | 126 | $field['class'] = ''; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
| 129 | + if (empty($field['attributes']['class'])) { |
|
| 130 | 130 | $field['attributes']['class'] = ''; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
| 134 | - unset( $field['class'] ); |
|
| 133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
| 134 | + unset($field['class']); |
|
| 135 | 135 | |
| 136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
| 137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
| 137 | + if ( ! empty($field['row_classes'])) { |
|
| 138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
| 139 | - unset( $field['row_classes'] ); |
|
| 139 | + unset($field['row_classes']); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Set field params on basis of cmb2 field name. |
| 143 | - switch ( $field['type'] ) { |
|
| 143 | + switch ($field['type']) { |
|
| 144 | 144 | case 'radio_inline': |
| 145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
| 145 | + if (empty($field['wrapper_class'])) { |
|
| 146 | 146 | $field['wrapper_class'] = ''; |
| 147 | 147 | } |
| 148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | case 'text-small' : |
| 156 | 156 | case 'text_small' : |
| 157 | 157 | // CMB2 compatibility: Set field type to text. |
| 158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
| 158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
| 159 | 159 | |
| 160 | 160 | // CMB2 compatibility: Set data type to price. |
| 161 | 161 | if ( |
| 162 | - empty( $field['data_type'] ) |
|
| 163 | - && ! empty( $field['attributes']['class'] ) |
|
| 162 | + empty($field['data_type']) |
|
| 163 | + && ! empty($field['attributes']['class']) |
|
| 164 | 164 | && ( |
| 165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
| 166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
| 165 | + false !== strpos($field['attributes']['class'], 'money') |
|
| 166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
| 167 | 167 | ) |
| 168 | 168 | ) { |
| 169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
| 182 | 182 | case 'give_default_radio_inline': |
| 183 | 183 | $field['type'] = 'radio'; |
| 184 | 184 | $field['options'] = array( |
| 185 | - 'default' => __( 'Default' ), |
|
| 185 | + 'default' => __('Default'), |
|
| 186 | 186 | ); |
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
| 191 | 191 | // We encourage you to use description param. |
| 192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
| 192 | + $field['description'] = ( ! empty($field['description']) |
|
| 193 | 193 | ? $field['description'] |
| 194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
| 194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
| 195 | 195 | |
| 196 | 196 | // Call render function. |
| 197 | - if ( is_array( $func_name ) ) { |
|
| 198 | - $func_name[0]->{$func_name[1]}( $field ); |
|
| 197 | + if (is_array($func_name)) { |
|
| 198 | + $func_name[0]->{$func_name[1]}($field); |
|
| 199 | 199 | } else { |
| 200 | - $func_name( $field ); |
|
| 200 | + $func_name($field); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
| 227 | 227 | * } |
| 228 | 228 | * @return void |
| 229 | 229 | */ |
| 230 | -function give_text_input( $field ) { |
|
| 230 | +function give_text_input($field) { |
|
| 231 | 231 | global $thepostid, $post; |
| 232 | 232 | |
| 233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
| 233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
| 238 | 238 | $field['before_field'] = ''; |
| 239 | 239 | $field['after_field'] = ''; |
| 240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
| 240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
| 241 | 241 | |
| 242 | - switch ( $data_type ) { |
|
| 242 | + switch ($data_type) { |
|
| 243 | 243 | case 'price' : |
| 244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
| 244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
| 245 | 245 | |
| 246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
| 247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
| 246 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
| 247 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
| 248 | 248 | break; |
| 249 | 249 | |
| 250 | 250 | case 'decimal' : |
| 251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
| 252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
| 252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
| 253 | 253 | break; |
| 254 | 254 | |
| 255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | ?> |
| 260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 262 | 262 | <?php echo $field['before_field']; ?> |
| 263 | 263 | <input |
| 264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 266 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 269 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 270 | 270 | /> |
| 271 | 271 | <?php echo $field['after_field']; ?> |
| 272 | 272 | <?php |
| 273 | - echo give_get_field_description( $field ); |
|
| 273 | + echo give_get_field_description($field); |
|
| 274 | 274 | echo '</p>'; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
| 292 | 292 | * } |
| 293 | 293 | * @return void |
| 294 | 294 | */ |
| 295 | -function give_hidden_input( $field ) { |
|
| 295 | +function give_hidden_input($field) { |
|
| 296 | 296 | global $thepostid, $post; |
| 297 | 297 | |
| 298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 300 | 300 | |
| 301 | 301 | // Custom attribute handling |
| 302 | 302 | $custom_attributes = array(); |
| 303 | 303 | |
| 304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 305 | 305 | |
| 306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | ?> |
| 311 | 311 | |
| 312 | 312 | <input |
| 313 | 313 | type="hidden" |
| 314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 314 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
| 317 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 318 | 318 | /> |
| 319 | 319 | <?php |
| 320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
| 340 | 340 | * } |
| 341 | 341 | * @return void |
| 342 | 342 | */ |
| 343 | -function give_textarea_input( $field ) { |
|
| 343 | +function give_textarea_input($field) { |
|
| 344 | 344 | global $thepostid, $post; |
| 345 | 345 | |
| 346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 350 | 350 | |
| 351 | 351 | ?> |
| 352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 354 | 354 | <textarea |
| 355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 356 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 358 | 358 | rows="10" |
| 359 | 359 | cols="20" |
| 360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
| 360 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
| 362 | 362 | <?php |
| 363 | - echo give_get_field_description( $field ); |
|
| 363 | + echo give_get_field_description($field); |
|
| 364 | 364 | echo '</p>'; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
| 384 | 384 | * } |
| 385 | 385 | * @return void |
| 386 | 386 | */ |
| 387 | -function give_wysiwyg( $field ) { |
|
| 387 | +function give_wysiwyg($field) { |
|
| 388 | 388 | global $thepostid, $post; |
| 389 | 389 | |
| 390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 394 | 394 | |
| 395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
| 395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
| 396 | 396 | $editor_attributes = array( |
| 397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
| 397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
| 398 | 398 | 'textarea_rows' => '10', |
| 399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
| 399 | + 'editor_css' => esc_attr($field['style']), |
|
| 400 | 400 | 'editor_class' => $field['attributes']['class'], |
| 401 | 401 | ); |
| 402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
| 402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
| 403 | 403 | $field['value'], |
| 404 | 404 | $field['unique_field_id'], |
| 405 | 405 | $editor_attributes, |
| 406 | - ) ) ) . '"'; |
|
| 407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
| 406 | + ))).'"'; |
|
| 407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
| 408 | 408 | |
| 409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
| 409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
| 410 | 410 | |
| 411 | 411 | wp_editor( |
| 412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $editor_attributes |
| 415 | 415 | ); |
| 416 | 416 | |
| 417 | - echo give_get_field_description( $field ); |
|
| 417 | + echo give_get_field_description($field); |
|
| 418 | 418 | echo '</div>'; |
| 419 | 419 | } |
| 420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
| 439 | 439 | * } |
| 440 | 440 | * @return void |
| 441 | 441 | */ |
| 442 | -function give_checkbox( $field ) { |
|
| 442 | +function give_checkbox($field) { |
|
| 443 | 443 | global $thepostid, $post; |
| 444 | 444 | |
| 445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
| 450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
| 450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 451 | 451 | ?> |
| 452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 454 | 454 | <input |
| 455 | 455 | type="checkbox" |
| 456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
| 460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
| 461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 457 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
| 460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
| 461 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 462 | 462 | /> |
| 463 | 463 | <?php |
| 464 | - echo give_get_field_description( $field ); |
|
| 464 | + echo give_get_field_description($field); |
|
| 465 | 465 | echo '</p>'; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
| 487 | 487 | * } |
| 488 | 488 | * @return void |
| 489 | 489 | */ |
| 490 | -function give_select( $field ) { |
|
| 490 | +function give_select($field) { |
|
| 491 | 491 | global $thepostid, $post; |
| 492 | 492 | |
| 493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 498 | 498 | ?> |
| 499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 501 | 501 | <select |
| 502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
| 505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 503 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
| 505 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 506 | 506 | > |
| 507 | 507 | <?php |
| 508 | - foreach ( $field['options'] as $key => $value ) { |
|
| 509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
| 508 | + foreach ($field['options'] as $key => $value) { |
|
| 509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
| 510 | 510 | } |
| 511 | 511 | echo '</select>'; |
| 512 | - echo give_get_field_description( $field ); |
|
| 512 | + echo give_get_field_description($field); |
|
| 513 | 513 | echo '</p>'; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
| 536 | 536 | * } |
| 537 | 537 | * @return void |
| 538 | 538 | */ |
| 539 | -function give_radio( $field ) { |
|
| 539 | +function give_radio($field) { |
|
| 540 | 540 | global $thepostid, $post; |
| 541 | 541 | |
| 542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 547 | 547 | |
| 548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
| 548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
| 549 | 549 | |
| 550 | - foreach ( $field['options'] as $key => $value ) { |
|
| 550 | + foreach ($field['options'] as $key => $value) { |
|
| 551 | 551 | |
| 552 | 552 | echo '<li><label><input |
| 553 | - name="' . give_get_field_name( $field ) . '" |
|
| 554 | - value="' . esc_attr( $key ) . '" |
|
| 553 | + name="' . give_get_field_name($field).'" |
|
| 554 | + value="' . esc_attr($key).'" |
|
| 555 | 555 | type="radio" |
| 556 | - style="' . esc_attr( $field['style'] ) . '" |
|
| 557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
| 558 | - . give_get_custom_attributes( $field ) . ' |
|
| 559 | - /> ' . esc_html( $value ) . '</label> |
|
| 556 | + style="' . esc_attr($field['style']).'" |
|
| 557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
| 558 | + . give_get_custom_attributes($field).' |
|
| 559 | + /> ' . esc_html($value).'</label> |
|
| 560 | 560 | </li>'; |
| 561 | 561 | } |
| 562 | 562 | echo '</ul>'; |
| 563 | 563 | |
| 564 | - echo give_get_field_description( $field ); |
|
| 564 | + echo give_get_field_description($field); |
|
| 565 | 565 | echo '</fieldset>'; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
| 585 | 585 | * } |
| 586 | 586 | * @return void |
| 587 | 587 | */ |
| 588 | -function give_colorpicker( $field ) { |
|
| 588 | +function give_colorpicker($field) { |
|
| 589 | 589 | global $thepostid, $post; |
| 590 | 590 | |
| 591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 596 | 596 | $field['type'] = 'text'; |
| 597 | 597 | ?> |
| 598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 600 | 600 | <input |
| 601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
| 602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
| 605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
| 602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 603 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
| 605 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 606 | 606 | /> |
| 607 | 607 | <?php |
| 608 | - echo give_get_field_description( $field ); |
|
| 608 | + echo give_get_field_description($field); |
|
| 609 | 609 | echo '</p>'; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -617,33 +617,33 @@ discard block |
||
| 617 | 617 | * |
| 618 | 618 | * @param array $field |
| 619 | 619 | */ |
| 620 | -function give_media( $field ) { |
|
| 620 | +function give_media($field) { |
|
| 621 | 621 | global $thepostid, $post; |
| 622 | 622 | |
| 623 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
| 624 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
| 625 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
| 626 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
| 627 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
| 623 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
| 624 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
| 625 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
| 626 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
| 627 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
| 628 | 628 | $field['type'] = 'text'; |
| 629 | 629 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
| 630 | 630 | |
| 631 | 631 | // Allow developer to save attachment ID or attachment url as metadata. |
| 632 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
| 632 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
| 633 | 633 | ?> |
| 634 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
| 635 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
| 634 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
| 635 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
| 636 | 636 | <input |
| 637 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
| 638 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
| 637 | + name="<?php echo give_get_field_name($field); ?>" |
|
| 638 | + id="<?php echo esc_attr($field['id']); ?>" |
|
| 639 | 639 | type="text" |
| 640 | 640 | value="<?php echo $field['value']; ?>" |
| 641 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
| 641 | + style="<?php echo esc_attr($field['style']); ?>" |
|
| 642 | 642 | data-fvalue="<?php echo $field['fvalue']; ?>" |
| 643 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
| 643 | + <?php echo give_get_custom_attributes($field); ?> |
|
| 644 | 644 | /> <input class="give-media-upload button" type="button" |
| 645 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
| 646 | - <?php echo give_get_field_description( $field ); ?> |
|
| 645 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
| 646 | + <?php echo give_get_field_description($field); ?> |
|
| 647 | 647 | </p> |
| 648 | 648 | <?php |
| 649 | 649 | } |
@@ -657,27 +657,27 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @return void |
| 659 | 659 | */ |
| 660 | -function give_default_gateway( $field ) { |
|
| 660 | +function give_default_gateway($field) { |
|
| 661 | 661 | global $thepostid, $post; |
| 662 | 662 | |
| 663 | 663 | // get all active payment gateways. |
| 664 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
| 664 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
| 665 | 665 | $field['options'] = array(); |
| 666 | 666 | |
| 667 | 667 | // Set field option value. |
| 668 | - if ( ! empty( $gateways ) ) { |
|
| 669 | - foreach ( $gateways as $key => $option ) { |
|
| 670 | - $field['options'][ $key ] = $option['admin_label']; |
|
| 668 | + if ( ! empty($gateways)) { |
|
| 669 | + foreach ($gateways as $key => $option) { |
|
| 670 | + $field['options'][$key] = $option['admin_label']; |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | // Add a field to the Give Form admin single post view of this field |
| 675 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 676 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
| 675 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 676 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | // Render select field. |
| 680 | - give_select( $field ); |
|
| 680 | + give_select($field); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -699,13 +699,13 @@ discard block |
||
| 699 | 699 | * @return void |
| 700 | 700 | */ |
| 701 | 701 | |
| 702 | -function give_docs_link( $field ) { |
|
| 703 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 704 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
| 702 | +function give_docs_link($field) { |
|
| 703 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
| 704 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
| 705 | 705 | |
| 706 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
| 706 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
| 707 | 707 | . '" target="_blank">' |
| 708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $field['title'] ) |
|
| 708 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $field['title']) |
|
| 709 | 709 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 710 | 710 | } |
| 711 | 711 | |
@@ -721,13 +721,13 @@ discard block |
||
| 721 | 721 | * |
| 722 | 722 | * @return mixed |
| 723 | 723 | */ |
| 724 | -function give_get_field_value( $field, $postid ) { |
|
| 725 | - if ( isset( $field['attributes']['value'] ) ) { |
|
| 724 | +function give_get_field_value($field, $postid) { |
|
| 725 | + if (isset($field['attributes']['value'])) { |
|
| 726 | 726 | return $field['attributes']['value']; |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // Get value from db. |
| 730 | - $field_value = get_post_meta( $postid, $field['id'], true ); |
|
| 730 | + $field_value = get_post_meta($postid, $field['id'], true); |
|
| 731 | 731 | |
| 732 | 732 | /** |
| 733 | 733 | * Filter the field value before apply default value. |
@@ -736,10 +736,10 @@ discard block |
||
| 736 | 736 | * |
| 737 | 737 | * @param mixed $field_value Field value. |
| 738 | 738 | */ |
| 739 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
| 739 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
| 740 | 740 | |
| 741 | 741 | // Set default value if no any data saved to db. |
| 742 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
| 742 | + if ( ! $field_value && isset($field['default'])) { |
|
| 743 | 743 | $field_value = $field['default']; |
| 744 | 744 | } |
| 745 | 745 | |
@@ -756,10 +756,10 @@ discard block |
||
| 756 | 756 | * |
| 757 | 757 | * @return string |
| 758 | 758 | */ |
| 759 | -function give_get_field_description( $field ) { |
|
| 759 | +function give_get_field_description($field) { |
|
| 760 | 760 | $field_desc_html = ''; |
| 761 | - if ( ! empty( $field['description'] ) ) { |
|
| 762 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
| 761 | + if ( ! empty($field['description'])) { |
|
| 762 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | return $field_desc_html; |
@@ -775,18 +775,18 @@ discard block |
||
| 775 | 775 | * |
| 776 | 776 | * @return string |
| 777 | 777 | */ |
| 778 | -function give_get_custom_attributes( $field ) { |
|
| 778 | +function give_get_custom_attributes($field) { |
|
| 779 | 779 | // Custom attribute handling |
| 780 | 780 | $custom_attributes = array(); |
| 781 | 781 | |
| 782 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
| 782 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
| 783 | 783 | |
| 784 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
| 785 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
| 784 | + foreach ($field['attributes'] as $attribute => $value) { |
|
| 785 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | - return implode( ' ', $custom_attributes ); |
|
| 789 | + return implode(' ', $custom_attributes); |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /** |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | * |
| 803 | 803 | * @return string |
| 804 | 804 | */ |
| 805 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
| 806 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
| 805 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
| 806 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * Filter the specific repeater field value |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | * |
| 813 | 813 | * @param string $field_id |
| 814 | 814 | */ |
| 815 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
| 815 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
| 816 | 816 | |
| 817 | 817 | /** |
| 818 | 818 | * Filter the repeater field value |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * |
| 822 | 822 | * @param string $field_id |
| 823 | 823 | */ |
| 824 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
| 824 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
| 825 | 825 | |
| 826 | 826 | return $field_value; |
| 827 | 827 | } |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | * |
| 840 | 840 | * @return string |
| 841 | 841 | */ |
| 842 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
| 842 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
| 843 | 843 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 844 | 844 | |
| 845 | 845 | // Get field id. |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | * |
| 853 | 853 | * @param string $field_id |
| 854 | 854 | */ |
| 855 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
| 855 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | 858 | * Filter the repeater field id |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | * |
| 862 | 862 | * @param string $field_id |
| 863 | 863 | */ |
| 864 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
| 864 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
| 865 | 865 | |
| 866 | 866 | return $field_id; |
| 867 | 867 | } |
@@ -876,8 +876,8 @@ discard block |
||
| 876 | 876 | * |
| 877 | 877 | * @return string |
| 878 | 878 | */ |
| 879 | -function give_get_field_name( $field ) { |
|
| 880 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
| 879 | +function give_get_field_name($field) { |
|
| 880 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
| 881 | 881 | |
| 882 | 882 | /** |
| 883 | 883 | * Filter the field name. |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | * |
| 887 | 887 | * @param string $field_name |
| 888 | 888 | */ |
| 889 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
| 889 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
| 890 | 890 | |
| 891 | 891 | return $field_name; |
| 892 | 892 | } |
@@ -903,39 +903,39 @@ discard block |
||
| 903 | 903 | * |
| 904 | 904 | * @return void |
| 905 | 905 | */ |
| 906 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
| 906 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
| 907 | 907 | global $thepostid, $post; |
| 908 | 908 | |
| 909 | 909 | // Bailout. |
| 910 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
| 910 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
| 911 | 911 | return; |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 915 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 914 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
| 915 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
| 916 | 916 | ?> |
| 917 | 917 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
| 918 | 918 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
| 919 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
| 919 | + <?php if ( ! empty($fields['name'])) : ?> |
|
| 920 | 920 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
| 921 | 921 | <?php endif; ?> |
| 922 | 922 | |
| 923 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
| 923 | + <?php if ( ! empty($fields['description'])) : ?> |
|
| 924 | 924 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
| 925 | 925 | <?php endif; ?> |
| 926 | 926 | |
| 927 | 927 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
| 928 | 928 | <?php |
| 929 | - $repeater_field_values = get_post_meta( $thepostid, $fields['id'], true ); |
|
| 930 | - $header_title = isset( $fields['options']['header_title'] ) |
|
| 929 | + $repeater_field_values = get_post_meta($thepostid, $fields['id'], true); |
|
| 930 | + $header_title = isset($fields['options']['header_title']) |
|
| 931 | 931 | ? $fields['options']['header_title'] |
| 932 | - : esc_attr__( 'Group', 'give' ); |
|
| 932 | + : esc_attr__('Group', 'give'); |
|
| 933 | 933 | |
| 934 | 934 | $add_default_donation_field = false; |
| 935 | 935 | |
| 936 | 936 | // Check if level is not created or we have to add default level. |
| 937 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
| 938 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
| 937 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
| 938 | + $repeater_field_values = array_values($repeater_field_values); |
|
| 939 | 939 | } else { |
| 940 | 940 | $fields_count = 1; |
| 941 | 941 | $add_default_donation_field = true; |
@@ -948,59 +948,59 @@ discard block |
||
| 948 | 948 | <div class="give-row-head give-move"> |
| 949 | 949 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
| 950 | 950 | </button> |
| 951 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
| 951 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
| 952 | 952 | <h2> |
| 953 | 953 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 954 | 954 | </h2> |
| 955 | 955 | </div> |
| 956 | 956 | <div class="give-row-body"> |
| 957 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 958 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 957 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 958 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 959 | 959 | continue; |
| 960 | 960 | } ?> |
| 961 | 961 | <?php |
| 962 | 962 | $field['repeat'] = true; |
| 963 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
| 964 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 963 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
| 964 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 965 | 965 | '_', |
| 966 | 966 | '', |
| 967 | - ), $field['repeatable_field_id'] ); |
|
| 967 | + ), $field['repeatable_field_id']); |
|
| 968 | 968 | ?> |
| 969 | - <?php give_render_field( $field ); ?> |
|
| 969 | + <?php give_render_field($field); ?> |
|
| 970 | 970 | <?php endforeach; ?> |
| 971 | 971 | </div> |
| 972 | 972 | </td> |
| 973 | 973 | </tr> |
| 974 | 974 | |
| 975 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
| 975 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
| 976 | 976 | <!--Stored repeater field group--> |
| 977 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
| 977 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
| 978 | 978 | <tr class="give-row"> |
| 979 | 979 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 980 | 980 | <div class="give-row-head give-move"> |
| 981 | 981 | <button type="button" class="handlediv button-link"> |
| 982 | 982 | <span class="toggle-indicator"></span></button> |
| 983 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 983 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 984 | 984 | </sapn> |
| 985 | 985 | <h2> |
| 986 | 986 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
| 987 | 987 | </h2> |
| 988 | 988 | </div> |
| 989 | 989 | <div class="give-row-body"> |
| 990 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
| 991 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 990 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
| 991 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
| 992 | 992 | continue; |
| 993 | 993 | } ?> |
| 994 | 994 | <?php |
| 995 | 995 | $field['repeat'] = true; |
| 996 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
| 997 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
| 998 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 996 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
| 997 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
| 998 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 999 | 999 | '_', |
| 1000 | 1000 | '', |
| 1001 | - ), $field['repeatable_field_id'] ); |
|
| 1001 | + ), $field['repeatable_field_id']); |
|
| 1002 | 1002 | ?> |
| 1003 | - <?php give_render_field( $field ); ?> |
|
| 1003 | + <?php give_render_field($field); ?> |
|
| 1004 | 1004 | <?php endforeach; ?> |
| 1005 | 1005 | </div> |
| 1006 | 1006 | </td> |
@@ -1008,14 +1008,14 @@ discard block |
||
| 1008 | 1008 | <?php endforeach; |
| 1009 | 1009 | ; ?> |
| 1010 | 1010 | |
| 1011 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
| 1011 | + <?php elseif ($add_default_donation_field) : ?> |
|
| 1012 | 1012 | <!--Default repeater field group--> |
| 1013 | 1013 | <tr class="give-row"> |
| 1014 | 1014 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
| 1015 | 1015 | <div class="give-row-head give-move"> |
| 1016 | 1016 | <button type="button" class="handlediv button-link"> |
| 1017 | 1017 | <span class="toggle-indicator"></span></button> |
| 1018 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
| 1018 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
| 1019 | 1019 | </sapn> |
| 1020 | 1020 | <h2> |
| 1021 | 1021 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1023,19 +1023,19 @@ discard block |
||
| 1023 | 1023 | </div> |
| 1024 | 1024 | <div class="give-row-body"> |
| 1025 | 1025 | <?php |
| 1026 | - foreach ( $fields['fields'] as $field ) : |
|
| 1027 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
| 1026 | + foreach ($fields['fields'] as $field) : |
|
| 1027 | + if ( ! give_is_field_callback_exist($field)) { |
|
| 1028 | 1028 | continue; |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | $field['repeat'] = true; |
| 1032 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
| 1033 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
| 1034 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
| 1032 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
| 1033 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
| 1034 | + $field['id'] = str_replace(array('[', ']'), array( |
|
| 1035 | 1035 | '_', |
| 1036 | 1036 | '', |
| 1037 | - ), $field['repeatable_field_id'] ); |
|
| 1038 | - give_render_field( $field ); |
|
| 1037 | + ), $field['repeatable_field_id']); |
|
| 1038 | + give_render_field($field); |
|
| 1039 | 1039 | endforeach; |
| 1040 | 1040 | ?> |
| 1041 | 1041 | </div> |
@@ -1046,9 +1046,9 @@ discard block |
||
| 1046 | 1046 | <tfoot> |
| 1047 | 1047 | <tr> |
| 1048 | 1048 | <?php |
| 1049 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
| 1049 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
| 1050 | 1050 | ? $add_row_btn_title = $fields['options']['add_button'] |
| 1051 | - : esc_html__( 'Add Row', 'give' ); |
|
| 1051 | + : esc_html__('Add Row', 'give'); |
|
| 1052 | 1052 | ?> |
| 1053 | 1053 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
| 1054 | 1054 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1078,10 +1078,10 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @param string |
| 1080 | 1080 | */ |
| 1081 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
| 1081 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
| 1082 | 1082 | |
| 1083 | 1083 | // Get current tab. |
| 1084 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
| 1084 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
| 1085 | 1085 | |
| 1086 | 1086 | // Output. |
| 1087 | 1087 | return $current_tab; |
@@ -1105,10 +1105,10 @@ discard block |
||
| 1105 | 1105 | * |
| 1106 | 1106 | * @param string |
| 1107 | 1107 | */ |
| 1108 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
| 1108 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
| 1109 | 1109 | |
| 1110 | 1110 | // Get current section. |
| 1111 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
| 1111 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
| 1112 | 1112 | |
| 1113 | 1113 | // Output. |
| 1114 | 1114 | return $current_section; |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | */ |
| 1123 | 1123 | function give_get_current_setting_page() { |
| 1124 | 1124 | // Get current page. |
| 1125 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
| 1125 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
| 1126 | 1126 | |
| 1127 | 1127 | // Output. |
| 1128 | 1128 | return $setting_page; |
@@ -1142,13 +1142,13 @@ discard block |
||
| 1142 | 1142 | * |
| 1143 | 1143 | * @return string |
| 1144 | 1144 | */ |
| 1145 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
| 1146 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
| 1145 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
| 1146 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
| 1147 | 1147 | |
| 1148 | 1148 | if ( |
| 1149 | - ! get_post_meta( $postid, '_give_display_content', true ) |
|
| 1149 | + ! get_post_meta($postid, '_give_display_content', true) |
|
| 1150 | 1150 | && $show_content |
| 1151 | - && ( 'none' !== $show_content ) |
|
| 1151 | + && ('none' !== $show_content) |
|
| 1152 | 1152 | ) { |
| 1153 | 1153 | $field_value = 'enabled'; |
| 1154 | 1154 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | return $field_value; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
| 1159 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
| 1160 | 1160 | |
| 1161 | 1161 | |
| 1162 | 1162 | /** |
@@ -1173,12 +1173,12 @@ discard block |
||
| 1173 | 1173 | * |
| 1174 | 1174 | * @return string |
| 1175 | 1175 | */ |
| 1176 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
| 1177 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
| 1176 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
| 1177 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
| 1178 | 1178 | |
| 1179 | 1179 | if ( |
| 1180 | - ! get_post_meta( $postid, '_give_content_placement', true ) |
|
| 1181 | - && ( 'none' !== $show_content ) |
|
| 1180 | + ! get_post_meta($postid, '_give_content_placement', true) |
|
| 1181 | + && ('none' !== $show_content) |
|
| 1182 | 1182 | ) { |
| 1183 | 1183 | $field_value = $show_content; |
| 1184 | 1184 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | return $field_value; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
| 1189 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
| 1190 | 1190 | |
| 1191 | 1191 | |
| 1192 | 1192 | /** |
@@ -1202,17 +1202,17 @@ discard block |
||
| 1202 | 1202 | * |
| 1203 | 1203 | * @return string |
| 1204 | 1204 | */ |
| 1205 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
| 1206 | - $term_option = get_post_meta( $postid, '_give_terms_option', true ); |
|
| 1205 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
| 1206 | + $term_option = get_post_meta($postid, '_give_terms_option', true); |
|
| 1207 | 1207 | |
| 1208 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
| 1209 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
| 1208 | + if (in_array($term_option, array('none', 'yes'))) { |
|
| 1209 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | return $field_value; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
| 1215 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
| 1216 | 1216 | |
| 1217 | 1217 | |
| 1218 | 1218 | /** |
@@ -1229,17 +1229,17 @@ discard block |
||
| 1229 | 1229 | * |
| 1230 | 1230 | * @return string |
| 1231 | 1231 | */ |
| 1232 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
| 1233 | - $offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
| 1232 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
| 1233 | + $offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
| 1234 | 1234 | |
| 1235 | - if ( 'on' === $offline_donation ) { |
|
| 1235 | + if ('on' === $offline_donation) { |
|
| 1236 | 1236 | $field_value = 'enabled'; |
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | return $field_value; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
| 1242 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
| 1243 | 1243 | |
| 1244 | 1244 | |
| 1245 | 1245 | /** |
@@ -1255,17 +1255,17 @@ discard block |
||
| 1255 | 1255 | * |
| 1256 | 1256 | * @return string |
| 1257 | 1257 | */ |
| 1258 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
| 1259 | - $custom_amount = get_post_meta( $postid, '_give_custom_amount', true ); |
|
| 1258 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
| 1259 | + $custom_amount = get_post_meta($postid, '_give_custom_amount', true); |
|
| 1260 | 1260 | |
| 1261 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
| 1262 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
| 1261 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
| 1262 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | return $field_value; |
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
| 1268 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
| 1269 | 1269 | |
| 1270 | 1270 | |
| 1271 | 1271 | /** |
@@ -1281,17 +1281,17 @@ discard block |
||
| 1281 | 1281 | * |
| 1282 | 1282 | * @return string |
| 1283 | 1283 | */ |
| 1284 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
| 1285 | - $goal_option = get_post_meta( $postid, '_give_goal_option', true ); |
|
| 1284 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
| 1285 | + $goal_option = get_post_meta($postid, '_give_goal_option', true); |
|
| 1286 | 1286 | |
| 1287 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
| 1288 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
| 1287 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
| 1288 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | return $field_value; |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
| 1294 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
| 1295 | 1295 | |
| 1296 | 1296 | /** |
| 1297 | 1297 | * Set value for Donation Goal --> close Form. |
@@ -1307,17 +1307,17 @@ discard block |
||
| 1307 | 1307 | * |
| 1308 | 1308 | * @return string |
| 1309 | 1309 | */ |
| 1310 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
| 1311 | - $close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
| 1310 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
| 1311 | + $close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
| 1312 | 1312 | |
| 1313 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
| 1314 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
| 1313 | + if (in_array($close_form, array('yes', 'no'))) { |
|
| 1314 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | return $field_value; |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
| 1320 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
| 1321 | 1321 | |
| 1322 | 1322 | |
| 1323 | 1323 | /** |
@@ -1333,17 +1333,17 @@ discard block |
||
| 1333 | 1333 | * |
| 1334 | 1334 | * @return string |
| 1335 | 1335 | */ |
| 1336 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
| 1337 | - $guest_donation = get_post_meta( $postid, '_give_logged_in_only', true ); |
|
| 1336 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
| 1337 | + $guest_donation = get_post_meta($postid, '_give_logged_in_only', true); |
|
| 1338 | 1338 | |
| 1339 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
| 1340 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
| 1339 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
| 1340 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | 1343 | return $field_value; |
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
| 1346 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
| 1347 | 1347 | |
| 1348 | 1348 | /** |
| 1349 | 1349 | * Set value for Offline Donations --> Offline Donations. |
@@ -1359,17 +1359,17 @@ discard block |
||
| 1359 | 1359 | * |
| 1360 | 1360 | * @return string |
| 1361 | 1361 | */ |
| 1362 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
| 1363 | - $customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true ); |
|
| 1362 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
| 1363 | + $customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true); |
|
| 1364 | 1364 | |
| 1365 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
| 1366 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
| 1365 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
| 1366 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | return $field_value; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
| 1372 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
| 1373 | 1373 | |
| 1374 | 1374 | |
| 1375 | 1375 | /** |
@@ -1384,14 +1384,14 @@ discard block |
||
| 1384 | 1384 | * |
| 1385 | 1385 | * @return mixed |
| 1386 | 1386 | */ |
| 1387 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
| 1387 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
| 1388 | 1388 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
| 1389 | 1389 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
| 1390 | 1390 | |
| 1391 | 1391 | return $field_id; |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
| 1394 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
| 1395 | 1395 | |
| 1396 | 1396 | /** |
| 1397 | 1397 | * Set repeater field value for multi donation form. |
@@ -1405,13 +1405,13 @@ discard block |
||
| 1405 | 1405 | * |
| 1406 | 1406 | * @return mixed |
| 1407 | 1407 | */ |
| 1408 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
| 1409 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
| 1408 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
| 1409 | + $field_value = $field_group[$field['id']]['level_id']; |
|
| 1410 | 1410 | |
| 1411 | 1411 | return $field_value; |
| 1412 | 1412 | } |
| 1413 | 1413 | |
| 1414 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
| 1414 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
| 1415 | 1415 | |
| 1416 | 1416 | /** |
| 1417 | 1417 | * Set default value for _give_id field. |
@@ -1422,11 +1422,11 @@ discard block |
||
| 1422 | 1422 | * |
| 1423 | 1423 | * @return string |
| 1424 | 1424 | */ |
| 1425 | -function _give_set_field_give_id_default_value( $field ) { |
|
| 1425 | +function _give_set_field_give_id_default_value($field) { |
|
| 1426 | 1426 | return 0; |
| 1427 | 1427 | } |
| 1428 | 1428 | |
| 1429 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
| 1429 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
| 1430 | 1430 | |
| 1431 | 1431 | /** |
| 1432 | 1432 | * Set default value for _give_default field. |
@@ -1437,11 +1437,11 @@ discard block |
||
| 1437 | 1437 | * |
| 1438 | 1438 | * @return string |
| 1439 | 1439 | */ |
| 1440 | -function _give_set_field_give_default_default_value( $field ) { |
|
| 1440 | +function _give_set_field_give_default_default_value($field) { |
|
| 1441 | 1441 | return 'default'; |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
| 1444 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
| 1445 | 1445 | |
| 1446 | 1446 | /** |
| 1447 | 1447 | * Set repeater field editor id for field type wysiwyg. |
@@ -1453,12 +1453,12 @@ discard block |
||
| 1453 | 1453 | * |
| 1454 | 1454 | * @return string |
| 1455 | 1455 | */ |
| 1456 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
| 1457 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
| 1458 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
| 1456 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
| 1457 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
| 1458 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | return $field_name; |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
| 1464 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | 'default' => '', |
| 91 | 91 | 'type' => 'text' |
| 92 | 92 | ), |
| 93 | - array( |
|
| 94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
| 95 | - 'id' => 'access_control_docs_link', |
|
| 96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
| 97 | - 'title' => __( 'Access Control', 'give' ), |
|
| 98 | - 'type' => 'give_docs_link', |
|
| 99 | - ), |
|
| 93 | + array( |
|
| 94 | + 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
| 95 | + 'id' => 'access_control_docs_link', |
|
| 96 | + 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
| 97 | + 'title' => __( 'Access Control', 'give' ), |
|
| 98 | + 'type' => 'give_docs_link', |
|
| 99 | + ), |
|
| 100 | 100 | array( |
| 101 | 101 | 'id' => 'give_title_session_control_1', |
| 102 | 102 | 'type' => 'sectionend' |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | 'default' => 2, |
| 163 | 163 | 'css' => 'width:12em;', |
| 164 | 164 | ), |
| 165 | - array( |
|
| 166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
| 167 | - 'id' => 'currency_settings_docs_link', |
|
| 168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
| 169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
| 170 | - 'type' => 'give_docs_link', |
|
| 171 | - ), |
|
| 165 | + array( |
|
| 166 | + 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
| 167 | + 'id' => 'currency_settings_docs_link', |
|
| 168 | + 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
| 169 | + 'title' => __( 'Currency Settings', 'give' ), |
|
| 170 | + 'type' => 'give_docs_link', |
|
| 171 | + ), |
|
| 172 | 172 | array( |
| 173 | 173 | 'type' => 'sectionend', |
| 174 | 174 | 'id' => 'give_title_general_settings_2' |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | 'type' => 'select', |
| 229 | 229 | 'options' => give_get_country_list(), |
| 230 | 230 | ), |
| 231 | - array( |
|
| 232 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
| 233 | - 'id' => 'general_options_docs_link', |
|
| 234 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
| 235 | - 'title' => __( 'General Options', 'give' ), |
|
| 236 | - 'type' => 'give_docs_link', |
|
| 237 | - ), |
|
| 231 | + array( |
|
| 232 | + 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
| 233 | + 'id' => 'general_options_docs_link', |
|
| 234 | + 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
| 235 | + 'title' => __( 'General Options', 'give' ), |
|
| 236 | + 'type' => 'give_docs_link', |
|
| 237 | + ), |
|
| 238 | 238 | array( |
| 239 | 239 | 'type' => 'sectionend', |
| 240 | 240 | 'id' => 'give_title_general_settings_1' |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param array $settings Array of settings class object. |
| 74 | 74 | */ |
| 75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
| 75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
| 76 | 76 | |
| 77 | 77 | return self::$settings; |
| 78 | 78 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public static function save() { |
| 87 | 87 | $current_tab = give_get_current_setting_tab(); |
| 88 | 88 | |
| 89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
| 90 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
| 89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
| 90 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
| 91 | 91 | die(); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @since 1.8 |
| 102 | 102 | */ |
| 103 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
| 103 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
| 104 | 104 | |
| 105 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
| 105 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Trigger Action. |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @since 1.8 |
| 115 | 115 | */ |
| 116 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
| 116 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | - public static function add_message( $code, $message ) { |
|
| 130 | - self::$messages[ $code ] = $message; |
|
| 129 | + public static function add_message($code, $message) { |
|
| 130 | + self::$messages[$code] = $message; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | - public static function add_error( $code, $message ) { |
|
| 144 | - self::$errors[ $code ] = $message; |
|
| 143 | + public static function add_error($code, $message) { |
|
| 144 | + self::$errors[$code] = $message; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -154,18 +154,18 @@ discard block |
||
| 154 | 154 | $notice_html = ''; |
| 155 | 155 | $classes = 'give-notice settings-error notice is-dismissible'; |
| 156 | 156 | |
| 157 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
| 158 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
| 157 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
| 158 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
| 159 | 159 | |
| 160 | - if ( 0 < count( self::$errors ) ) { |
|
| 161 | - foreach ( self::$errors as $code => $message ) { |
|
| 162 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
| 160 | + if (0 < count(self::$errors)) { |
|
| 161 | + foreach (self::$errors as $code => $message) { |
|
| 162 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ( 0 < count( self::$messages ) ) { |
|
| 167 | - foreach ( self::$messages as $code => $message ) { |
|
| 168 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
| 166 | + if (0 < count(self::$messages)) { |
|
| 167 | + foreach (self::$messages as $code => $message) { |
|
| 168 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | self::$setting_filter_prefix = give_get_current_setting_page(); |
| 186 | 186 | |
| 187 | 187 | // Bailout: Exit if setting page is not defined. |
| 188 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
| 188 | + if (empty(self::$setting_filter_prefix)) { |
|
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @since 1.8 |
| 200 | 200 | */ |
| 201 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
| 201 | + do_action(self::$setting_filter_prefix.'_start'); |
|
| 202 | 202 | |
| 203 | 203 | $current_tab = give_get_current_setting_tab(); |
| 204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | self::get_settings_pages(); |
| 207 | 207 | |
| 208 | 208 | // Save settings if data has been posted. |
| 209 | - if ( ! empty( $_POST ) ) { |
|
| 209 | + if ( ! empty($_POST)) { |
|
| 210 | 210 | self::save(); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * |
| 220 | 220 | * @since 1.8 |
| 221 | 221 | */ |
| 222 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
| 222 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
| 223 | 223 | |
| 224 | 224 | include 'views/html-admin-settings.php'; |
| 225 | 225 | |
@@ -237,25 +237,25 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return string|bool |
| 239 | 239 | */ |
| 240 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
| 240 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
| 241 | 241 | // Bailout. |
| 242 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
| 242 | + if (empty($option_name) && empty($field_id)) { |
|
| 243 | 243 | return false; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
| 246 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
| 247 | 247 | // Get field value if any. |
| 248 | - $option_value = get_option( $option_name ); |
|
| 248 | + $option_value = get_option($option_name); |
|
| 249 | 249 | |
| 250 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
| 251 | - ? $option_value[ $field_id ] |
|
| 250 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
| 251 | + ? $option_value[$field_id] |
|
| 252 | 252 | : $default; |
| 253 | 253 | } else { |
| 254 | 254 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
| 255 | 255 | $option_name = ! $option_name ? $field_id : $option_name; |
| 256 | 256 | |
| 257 | 257 | // Get option value if any. |
| 258 | - $option_value = get_option( $option_name, $default ); |
|
| 258 | + $option_value = get_option($option_name, $default); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return $option_value; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @return void |
| 275 | 275 | */ |
| 276 | - public static function output_fields( $options, $option_name = '' ) { |
|
| 276 | + public static function output_fields($options, $option_name = '') { |
|
| 277 | 277 | $current_tab = give_get_current_setting_tab(); |
| 278 | 278 | |
| 279 | 279 | // Field Default values. |
@@ -286,52 +286,52 @@ discard block |
||
| 286 | 286 | 'table_html' => true, |
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | - foreach ( $options as $value ) { |
|
| 290 | - if ( ! isset( $value['type'] ) ) { |
|
| 289 | + foreach ($options as $value) { |
|
| 290 | + if ( ! isset($value['type'])) { |
|
| 291 | 291 | continue; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Set title. |
| 295 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
| 295 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
| 296 | 296 | |
| 297 | 297 | // Set default setting. |
| 298 | - $value = wp_parse_args( $value, $defaults ); |
|
| 298 | + $value = wp_parse_args($value, $defaults); |
|
| 299 | 299 | |
| 300 | 300 | // Colorpicker field. |
| 301 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
| 302 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
| 301 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
| 302 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | // Custom attribute handling. |
| 306 | 306 | $custom_attributes = array(); |
| 307 | 307 | |
| 308 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
| 309 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
| 310 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
| 308 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
| 309 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
| 310 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Description handling. |
| 315 | - $description = self::get_field_description( $value ); |
|
| 315 | + $description = self::get_field_description($value); |
|
| 316 | 316 | |
| 317 | 317 | // Switch based on type. |
| 318 | - switch ( $value['type'] ) { |
|
| 318 | + switch ($value['type']) { |
|
| 319 | 319 | |
| 320 | 320 | // Section Titles |
| 321 | 321 | case 'title': |
| 322 | - if ( ! empty( $value['title'] ) ) { |
|
| 323 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
| 322 | + if ( ! empty($value['title'])) { |
|
| 323 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if ( ! empty( $value['desc'] ) ) { |
|
| 327 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
| 326 | + if ( ! empty($value['desc'])) { |
|
| 327 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if ( $value['table_html'] ) { |
|
| 331 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
| 330 | + if ($value['table_html']) { |
|
| 331 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if ( ! empty( $value['id'] ) ) { |
|
| 334 | + if ( ! empty($value['id'])) { |
|
| 335 | 335 | |
| 336 | 336 | /** |
| 337 | 337 | * Trigger Action. |
@@ -340,14 +340,14 @@ discard block |
||
| 340 | 340 | * |
| 341 | 341 | * @since 1.8 |
| 342 | 342 | */ |
| 343 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
| 343 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | break; |
| 347 | 347 | |
| 348 | 348 | // Section Ends. |
| 349 | 349 | case 'sectionend': |
| 350 | - if ( ! empty( $value['id'] ) ) { |
|
| 350 | + if ( ! empty($value['id'])) { |
|
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | 353 | * Trigger Action. |
@@ -356,14 +356,14 @@ discard block |
||
| 356 | 356 | * |
| 357 | 357 | * @since 1.8 |
| 358 | 358 | */ |
| 359 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
| 359 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if ( $value['table_html'] ) { |
|
| 362 | + if ($value['table_html']) { |
|
| 363 | 363 | echo '</table>'; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if ( ! empty( $value['id'] ) ) { |
|
| 366 | + if ( ! empty($value['id'])) { |
|
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Trigger Action. |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * |
| 373 | 373 | * @since 1.8 |
| 374 | 374 | */ |
| 375 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
| 375 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | break; |
@@ -385,22 +385,22 @@ discard block |
||
| 385 | 385 | case 'password' : |
| 386 | 386 | |
| 387 | 387 | $type = $value['type']; |
| 388 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 388 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 389 | 389 | |
| 390 | 390 | ?> |
| 391 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 391 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 392 | 392 | <th scope="row" class="titledesc"> |
| 393 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 393 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 394 | 394 | </th> |
| 395 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 395 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 396 | 396 | <input |
| 397 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 398 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 399 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 400 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 401 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
| 402 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 403 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 397 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 398 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 399 | + type="<?php echo esc_attr($type); ?>" |
|
| 400 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 401 | + value="<?php echo esc_attr($option_value); ?>" |
|
| 402 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 403 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 404 | 404 | /> <?php echo $description; ?> |
| 405 | 405 | </td> |
| 406 | 406 | </tr><?php |
@@ -409,23 +409,23 @@ discard block |
||
| 409 | 409 | // Textarea. |
| 410 | 410 | case 'textarea': |
| 411 | 411 | |
| 412 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 412 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 413 | 413 | |
| 414 | 414 | ?> |
| 415 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 415 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 416 | 416 | <th scope="row" class="titledesc"> |
| 417 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 417 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 418 | 418 | </th> |
| 419 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 419 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 420 | 420 | <textarea |
| 421 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 422 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 423 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 424 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 421 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 422 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 423 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 424 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 425 | 425 | rows="10" |
| 426 | 426 | cols="60" |
| 427 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 428 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
| 427 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 428 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
| 429 | 429 | <?php echo $description; ?> |
| 430 | 430 | </td> |
| 431 | 431 | </tr><?php |
@@ -435,35 +435,35 @@ discard block |
||
| 435 | 435 | case 'select' : |
| 436 | 436 | case 'multiselect' : |
| 437 | 437 | |
| 438 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 438 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 439 | 439 | |
| 440 | 440 | ?> |
| 441 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 441 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 442 | 442 | <th scope="row" class="titledesc"> |
| 443 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 443 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 444 | 444 | </th> |
| 445 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 445 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 446 | 446 | <select |
| 447 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
| 447 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
| 448 | 448 | echo '[]'; |
| 449 | 449 | } ?>" |
| 450 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 451 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 452 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 453 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 454 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
| 450 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 451 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 452 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 453 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 454 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
| 455 | 455 | > |
| 456 | 456 | |
| 457 | 457 | <?php |
| 458 | - if ( ! empty( $value['options'] ) ) { |
|
| 459 | - foreach ( $value['options'] as $key => $val ) { |
|
| 458 | + if ( ! empty($value['options'])) { |
|
| 459 | + foreach ($value['options'] as $key => $val) { |
|
| 460 | 460 | ?> |
| 461 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
| 461 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
| 462 | 462 | |
| 463 | - if ( is_array( $option_value ) ) { |
|
| 464 | - selected( in_array( $key, $option_value ), true ); |
|
| 463 | + if (is_array($option_value)) { |
|
| 464 | + selected(in_array($key, $option_value), true); |
|
| 465 | 465 | } else { |
| 466 | - selected( $option_value, $key ); |
|
| 466 | + selected($option_value, $key); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | ?>><?php echo $val ?></option> |
@@ -479,28 +479,28 @@ discard block |
||
| 479 | 479 | |
| 480 | 480 | // Radio inputs. |
| 481 | 481 | case 'radio_inline' : |
| 482 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
| 482 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
| 483 | 483 | case 'radio' : |
| 484 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 484 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 485 | 485 | ?> |
| 486 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 486 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 487 | 487 | <th scope="row" class="titledesc"> |
| 488 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 488 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 489 | 489 | </th> |
| 490 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 490 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 491 | 491 | <fieldset> |
| 492 | 492 | <ul> |
| 493 | 493 | <?php |
| 494 | - foreach ( $value['options'] as $key => $val ) { |
|
| 494 | + foreach ($value['options'] as $key => $val) { |
|
| 495 | 495 | ?> |
| 496 | 496 | <li> |
| 497 | 497 | <label><input |
| 498 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 498 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 499 | 499 | value="<?php echo $key; ?>" |
| 500 | 500 | type="radio" |
| 501 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 502 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 503 | - <?php checked( $key, $option_value ); ?> |
|
| 501 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 502 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 503 | + <?php checked($key, $option_value); ?> |
|
| 504 | 504 | /> <?php echo $val ?></label> |
| 505 | 505 | </li> |
| 506 | 506 | <?php |
@@ -514,21 +514,21 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | // Checkbox input. |
| 516 | 516 | case 'checkbox' : |
| 517 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 517 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 518 | 518 | ?> |
| 519 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 519 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 520 | 520 | <th scope="row" class="titledesc"> |
| 521 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 521 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 522 | 522 | </th> |
| 523 | 523 | <td class="give-forminp"> |
| 524 | 524 | <input |
| 525 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 526 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 525 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 526 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 527 | 527 | type="checkbox" |
| 528 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
| 528 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
| 529 | 529 | value="1" |
| 530 | - <?php checked( $option_value, 'on' ); ?> |
|
| 531 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 530 | + <?php checked($option_value, 'on'); ?> |
|
| 531 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 532 | 532 | /> |
| 533 | 533 | <?php echo $description; ?> |
| 534 | 534 | </td> |
@@ -538,28 +538,28 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | // Multi Checkbox input. |
| 540 | 540 | case 'multicheck' : |
| 541 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 542 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
| 541 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 542 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
| 543 | 543 | ?> |
| 544 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 544 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 545 | 545 | <th scope="row" class="titledesc"> |
| 546 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 546 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 547 | 547 | </th> |
| 548 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 548 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 549 | 549 | <fieldset> |
| 550 | 550 | <ul> |
| 551 | 551 | <?php |
| 552 | - foreach ( $value['options'] as $key => $val ) { |
|
| 552 | + foreach ($value['options'] as $key => $val) { |
|
| 553 | 553 | ?> |
| 554 | 554 | <li> |
| 555 | 555 | <label> |
| 556 | 556 | <input |
| 557 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
| 557 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
| 558 | 558 | value="<?php echo $key; ?>" |
| 559 | 559 | type="checkbox" |
| 560 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 561 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 562 | - <?php if ( in_array( $key, $option_value ) ) { |
|
| 560 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 561 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 562 | + <?php if (in_array($key, $option_value)) { |
|
| 563 | 563 | echo 'checked="checked"'; |
| 564 | 564 | } ?> |
| 565 | 565 | /> <?php echo $val ?> |
@@ -577,25 +577,25 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | // File input field. |
| 579 | 579 | case 'file' : |
| 580 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 580 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 581 | 581 | ?> |
| 582 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 582 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 583 | 583 | <th scope="row" class="titledesc"> |
| 584 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 584 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 585 | 585 | </th> |
| 586 | 586 | <td class="give-forminp"> |
| 587 | 587 | <div class="give-field-wrap"> |
| 588 | 588 | <label for="<?php echo $value['id'] ?>"> |
| 589 | 589 | <input |
| 590 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 591 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 590 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 591 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 592 | 592 | type="text" |
| 593 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
| 593 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
| 594 | 594 | value="<?php echo $option_value; ?>" |
| 595 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 596 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 595 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 596 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 597 | 597 | /> <input class="give-upload-button button" type="button" |
| 598 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
| 598 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
| 599 | 599 | <?php echo $description ?> |
| 600 | 600 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
| 601 | 601 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -610,17 +610,17 @@ discard block |
||
| 610 | 610 | // WordPress Editor. |
| 611 | 611 | case 'wysiwyg' : |
| 612 | 612 | // Get option value. |
| 613 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 613 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 614 | 614 | |
| 615 | 615 | // Get editor settings. |
| 616 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
| 616 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
| 617 | 617 | ?> |
| 618 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 618 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 619 | 619 | <th scope="row" class="titledesc"> |
| 620 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 620 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 621 | 621 | </th> |
| 622 | 622 | <td class="give-forminp"> |
| 623 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
| 623 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
| 624 | 624 | <?php echo $description; ?> |
| 625 | 625 | </td> |
| 626 | 626 | </tr><?php |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | // Custom: System setting field. |
| 630 | 630 | case 'system_info' : |
| 631 | 631 | ?> |
| 632 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 632 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 633 | 633 | <th scope="row" class="titledesc"> |
| 634 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 634 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 635 | 635 | </th> |
| 636 | 636 | <td class="give-forminp"> |
| 637 | 637 | <?php give_system_info_callback(); ?> |
@@ -642,14 +642,14 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | // Custom: Default gateways setting field. |
| 644 | 644 | case 'default_gateway' : |
| 645 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 645 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 646 | 646 | ?> |
| 647 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 647 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 648 | 648 | <th scope="row" class="titledesc"> |
| 649 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 649 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 650 | 650 | </th> |
| 651 | 651 | <td class="give-forminp"> |
| 652 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
| 652 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
| 653 | 653 | <?php echo $description; ?> |
| 654 | 654 | </td> |
| 655 | 655 | </tr><?php |
@@ -657,14 +657,14 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | // Custom: Enable gateways setting field. |
| 659 | 659 | case 'enabled_gateways' : |
| 660 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 660 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 661 | 661 | ?> |
| 662 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 662 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 663 | 663 | <th scope="row" class="titledesc"> |
| 664 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 664 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 665 | 665 | </th> |
| 666 | 666 | <td class="give-forminp"> |
| 667 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
| 667 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
| 668 | 668 | <?php echo $description; ?> |
| 669 | 669 | </td> |
| 670 | 670 | </tr><?php |
@@ -673,9 +673,9 @@ discard block |
||
| 673 | 673 | // Custom: Email preview buttons field. |
| 674 | 674 | case 'email_preview_buttons' : |
| 675 | 675 | ?> |
| 676 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 676 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 677 | 677 | <th scope="row" class="titledesc"> |
| 678 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 678 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 679 | 679 | </th> |
| 680 | 680 | <td class="give-forminp"> |
| 681 | 681 | <?php give_email_preview_buttons_callback(); ?> |
@@ -692,22 +692,22 @@ discard block |
||
| 692 | 692 | |
| 693 | 693 | // Custom: Gateway API key. |
| 694 | 694 | case 'api_key' : |
| 695 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 696 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
| 695 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 696 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
| 697 | 697 | ?> |
| 698 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 698 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 699 | 699 | <th scope="row" class="titledesc"> |
| 700 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 700 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 701 | 701 | </th> |
| 702 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 702 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 703 | 703 | <input |
| 704 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 705 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 706 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 707 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 708 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
| 709 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 710 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 704 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 705 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 706 | + type="<?php echo esc_attr($type); ?>" |
|
| 707 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 708 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
| 709 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 710 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 711 | 711 | /> <?php echo $description; ?> |
| 712 | 712 | </td> |
| 713 | 713 | </tr><?php |
@@ -729,12 +729,12 @@ discard block |
||
| 729 | 729 | // Custom: Give Docs Link field type. |
| 730 | 730 | case 'give_docs_link' : |
| 731 | 731 | ?> |
| 732 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 732 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 733 | 733 | <td class="give-docs-link" colspan="2"> |
| 734 | 734 | <?php |
| 735 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
| 735 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
| 736 | 736 | . '" target="_blank">' |
| 737 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 737 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title']) |
|
| 738 | 738 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 739 | 739 | ?> |
| 740 | 740 | </td> |
@@ -745,8 +745,8 @@ discard block |
||
| 745 | 745 | // You can add or handle your custom field action. |
| 746 | 746 | default: |
| 747 | 747 | // Get option value. |
| 748 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 749 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
| 748 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 749 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
| 750 | 750 | break; |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -762,15 +762,15 @@ discard block |
||
| 762 | 762 | * |
| 763 | 763 | * @return string The HTML description of the field. |
| 764 | 764 | */ |
| 765 | - public static function get_field_description( $value ) { |
|
| 765 | + public static function get_field_description($value) { |
|
| 766 | 766 | $description = ''; |
| 767 | 767 | |
| 768 | 768 | // Support for both 'description' and 'desc' args. |
| 769 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
| 770 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
| 769 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
| 770 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
| 771 | 771 | |
| 772 | - if ( ! empty( $value ) ) { |
|
| 773 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
| 772 | + if ( ! empty($value)) { |
|
| 773 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | return $description; |
@@ -787,11 +787,11 @@ discard block |
||
| 787 | 787 | * |
| 788 | 788 | * @return array The description and tip as a 2 element array |
| 789 | 789 | */ |
| 790 | - public static function get_field_title( $value ) { |
|
| 791 | - $title = esc_html( $value['title'] ); |
|
| 790 | + public static function get_field_title($value) { |
|
| 791 | + $title = esc_html($value['title']); |
|
| 792 | 792 | |
| 793 | 793 | // If html tag detected then allow them to print. |
| 794 | - if ( strip_tags( $title ) ) { |
|
| 794 | + if (strip_tags($title)) { |
|
| 795 | 795 | $title = $value['title']; |
| 796 | 796 | } |
| 797 | 797 | |
@@ -810,8 +810,8 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @return bool |
| 812 | 812 | */ |
| 813 | - public static function save_fields( $options, $option_name = '' ) { |
|
| 814 | - if ( empty( $_POST ) ) { |
|
| 813 | + public static function save_fields($options, $option_name = '') { |
|
| 814 | + if (empty($_POST)) { |
|
| 815 | 815 | return false; |
| 816 | 816 | } |
| 817 | 817 | |
@@ -819,37 +819,37 @@ discard block |
||
| 819 | 819 | $update_options = array(); |
| 820 | 820 | |
| 821 | 821 | // Loop options and get values to save. |
| 822 | - foreach ( $options as $option ) { |
|
| 823 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
| 822 | + foreach ($options as $option) { |
|
| 823 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
| 824 | 824 | continue; |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | // Get posted value. |
| 828 | - if ( strstr( $option['id'], '[' ) ) { |
|
| 829 | - parse_str( $option['id'], $option_name_array ); |
|
| 830 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
| 831 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
| 832 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
| 828 | + if (strstr($option['id'], '[')) { |
|
| 829 | + parse_str($option['id'], $option_name_array); |
|
| 830 | + $field_option_name = current(array_keys($option_name_array)); |
|
| 831 | + $setting_name = key($option_name_array[$field_option_name]); |
|
| 832 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
| 833 | 833 | } else { |
| 834 | 834 | $field_option_name = $option['id']; |
| 835 | 835 | $setting_name = ''; |
| 836 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
| 836 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | // Format the value based on option type. |
| 840 | - switch ( $option['type'] ) { |
|
| 840 | + switch ($option['type']) { |
|
| 841 | 841 | case 'checkbox' : |
| 842 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
| 842 | + $value = is_null($raw_value) ? '' : 'on'; |
|
| 843 | 843 | break; |
| 844 | 844 | case 'wysiwyg' : |
| 845 | 845 | case 'textarea' : |
| 846 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
| 846 | + $value = wp_kses_post(trim($raw_value)); |
|
| 847 | 847 | break; |
| 848 | 848 | case 'multiselect' : |
| 849 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
| 849 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
| 850 | 850 | break; |
| 851 | 851 | default : |
| 852 | - $value = give_clean( $raw_value ); |
|
| 852 | + $value = give_clean($raw_value); |
|
| 853 | 853 | break; |
| 854 | 854 | } |
| 855 | 855 | |
@@ -858,37 +858,37 @@ discard block |
||
| 858 | 858 | * |
| 859 | 859 | * @since 1.8 |
| 860 | 860 | */ |
| 861 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
| 861 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
| 862 | 862 | |
| 863 | 863 | /** |
| 864 | 864 | * Sanitize the value of an option by option name. |
| 865 | 865 | * |
| 866 | 866 | * @since 1.8 |
| 867 | 867 | */ |
| 868 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
| 868 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
| 869 | 869 | |
| 870 | - if ( is_null( $value ) ) { |
|
| 870 | + if (is_null($value)) { |
|
| 871 | 871 | continue; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | // Check if option is an array and handle that differently to single values. |
| 875 | - if ( $field_option_name && $setting_name ) { |
|
| 876 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
| 877 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
| 875 | + if ($field_option_name && $setting_name) { |
|
| 876 | + if ( ! isset($update_options[$field_option_name])) { |
|
| 877 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
| 878 | 878 | } |
| 879 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
| 880 | - $update_options[ $field_option_name ] = array(); |
|
| 879 | + if ( ! is_array($update_options[$field_option_name])) { |
|
| 880 | + $update_options[$field_option_name] = array(); |
|
| 881 | 881 | } |
| 882 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
| 882 | + $update_options[$field_option_name][$setting_name] = $value; |
|
| 883 | 883 | } else { |
| 884 | - $update_options[ $field_option_name ] = $value; |
|
| 884 | + $update_options[$field_option_name] = $value; |
|
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | // Save all options in our array or there own option name i.e. option id. |
| 889 | - if ( empty( $option_name ) ) { |
|
| 890 | - foreach ( $update_options as $name => $value ) { |
|
| 891 | - update_option( $name, $value ); |
|
| 889 | + if (empty($option_name)) { |
|
| 890 | + foreach ($update_options as $name => $value) { |
|
| 891 | + update_option($name, $value); |
|
| 892 | 892 | |
| 893 | 893 | /** |
| 894 | 894 | * Trigger action. |
@@ -897,13 +897,13 @@ discard block |
||
| 897 | 897 | * |
| 898 | 898 | * @since 1.8 |
| 899 | 899 | */ |
| 900 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
| 900 | + do_action("give_save_option_{$name}", $value, $name); |
|
| 901 | 901 | } |
| 902 | 902 | } else { |
| 903 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
| 904 | - $update_options = array_merge( $old_options, $update_options ); |
|
| 903 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
| 904 | + $update_options = array_merge($old_options, $update_options); |
|
| 905 | 905 | |
| 906 | - update_option( $option_name, $update_options ); |
|
| 906 | + update_option($option_name, $update_options); |
|
| 907 | 907 | |
| 908 | 908 | /** |
| 909 | 909 | * Trigger action. |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | * |
| 913 | 913 | * @since 1.8 |
| 914 | 914 | */ |
| 915 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
| 915 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | return true; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Exit if accessed directly. |
| 19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 19 | +if ( ! defined('ABSPATH')) { |
|
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | function give_reports_page() { |
| 32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
| 33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
| 32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
| 33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
| 34 | 34 | $views = give_reports_default_views(); |
| 35 | 35 | ?> |
| 36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
| 39 | 39 | |
| 40 | 40 | <h2 class="nav-tab-wrapper"> |
| 41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
| 42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 41 | + <?php foreach ($views as $tab => $label) { ?> |
|
| 42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 43 | 43 | 'tab' => $tab, |
| 44 | 44 | 'settings-updated' => false, |
| 45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
| 45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
| 48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
| 47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
| 48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
| 49 | 49 | 'tab' => 'export', |
| 50 | 50 | 'settings-updated' => false, |
| 51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
| 51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
| 52 | 52 | <?php } |
| 53 | 53 | /** |
| 54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | - do_action( 'give_reports_tabs' ); |
|
| 60 | + do_action('give_reports_tabs'); |
|
| 61 | 61 | ?> |
| 62 | 62 | </h2> |
| 63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @since 1.0 |
| 69 | 69 | */ |
| 70 | - do_action( 'give_reports_page_top' ); |
|
| 70 | + do_action('give_reports_page_top'); |
|
| 71 | 71 | |
| 72 | 72 | // Set $active_tab prior to hook firing. |
| 73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
| 73 | + if (in_array($active_tab, array_keys($views))) { |
|
| 74 | 74 | $active_tab = 'reports'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0 |
| 81 | 81 | */ |
| 82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
| 82 | + do_action("give_reports_tab_{$active_tab}"); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Fires after the report page. |
| 86 | 86 | * |
| 87 | 87 | * @since 1.0 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_reports_page_bottom' ); |
|
| 89 | + do_action('give_reports_page_bottom'); |
|
| 90 | 90 | ?> |
| 91 | 91 | </div><!-- .wrap --> |
| 92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function give_reports_default_views() { |
| 102 | 102 | $views = array( |
| 103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
| 104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
| 105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
| 106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
| 103 | + 'earnings' => esc_html__('Income', 'give'), |
|
| 104 | + 'forms' => esc_html__('Forms', 'give'), |
|
| 105 | + 'donors' => esc_html__('Donors', 'give'), |
|
| 106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $views = apply_filters( 'give_report_views', $views ); |
|
| 109 | + $views = apply_filters('give_report_views', $views); |
|
| 110 | 110 | |
| 111 | 111 | return $views; |
| 112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | * @since 1.0 |
| 122 | 122 | * @return string $view Report View |
| 123 | 123 | */ |
| 124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
| 124 | +function give_get_reporting_view($default = 'earnings') { |
|
| 125 | 125 | |
| 126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
| 126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
| 127 | 127 | $view = $default; |
| 128 | 128 | } else { |
| 129 | 129 | $view = $_GET['view']; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
| 132 | + return apply_filters('give_get_reporting_view', $view); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $current_view = 'earnings'; |
| 143 | 143 | $views = give_reports_default_views(); |
| 144 | 144 | |
| 145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
| 145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
| 146 | 146 | $current_view = $_GET['tab']; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 1.0 |
| 153 | 153 | */ |
| 154 | - do_action( "give_reports_view_{$current_view}" ); |
|
| 154 | + do_action("give_reports_view_{$current_view}"); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
| 157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | function give_report_views() { |
| 166 | 166 | $views = give_reports_default_views(); |
| 167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
| 167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
| 168 | 168 | /** |
| 169 | 169 | * Fires before the report page actions form. |
| 170 | 170 | * |
| 171 | 171 | * @since 1.0 |
| 172 | 172 | */ |
| 173 | - do_action( 'give_report_view_actions_before' ); |
|
| 173 | + do_action('give_report_view_actions_before'); |
|
| 174 | 174 | ?> |
| 175 | 175 | <form id="give-reports-filter" method="get"> |
| 176 | 176 | <select id="give-reports-view" name="view"> |
| 177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
| 178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
| 179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
| 177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
| 178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
| 179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
| 180 | 180 | <?php endforeach; ?> |
| 181 | 181 | </select> |
| 182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @since 1.0 |
| 190 | 190 | */ |
| 191 | - do_action( 'give_report_view_actions' ); |
|
| 191 | + do_action('give_report_view_actions'); |
|
| 192 | 192 | ?> |
| 193 | 193 | |
| 194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
| 195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
| 196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
| 197 | 197 | </form> |
| 198 | 198 | <?php |
| 199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @since 1.0 |
| 203 | 203 | */ |
| 204 | - do_action( 'give_report_view_actions_after' ); |
|
| 204 | + do_action('give_report_view_actions_after'); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -214,18 +214,18 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | function give_reports_forms_table() { |
| 216 | 216 | |
| 217 | - if ( isset( $_GET['form-id'] ) ) { |
|
| 217 | + if (isset($_GET['form-id'])) { |
|
| 218 | 218 | return; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
| 221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
| 222 | 222 | |
| 223 | 223 | $give_table = new Give_Form_Reports_Table(); |
| 224 | 224 | $give_table->prepare_items(); |
| 225 | 225 | $give_table->display(); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
| 228 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * Renders the detailed report for a specific give form |
@@ -234,20 +234,20 @@ discard block |
||
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | 236 | function give_reports_form_details() { |
| 237 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
| 237 | + if ( ! isset($_GET['form-id'])) { |
|
| 238 | 238 | return; |
| 239 | 239 | } |
| 240 | 240 | ?> |
| 241 | 241 | <div class="tablenav top reports-forms-details-wrap"> |
| 242 | 242 | <div class="actions bulkactions"> |
| 243 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
| 243 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
| 244 | 244 | </div> |
| 245 | 245 | </div> |
| 246 | 246 | <?php |
| 247 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
| 247 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
| 250 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | 253 | * Renders the Reports Donors Table |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @return void |
| 259 | 259 | */ |
| 260 | 260 | function give_reports_donors_table() { |
| 261 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
| 261 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
| 262 | 262 | |
| 263 | 263 | $give_table = new Give_Donor_Reports_Table(); |
| 264 | 264 | $give_table->prepare_items(); |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @since 1.0 |
| 272 | 272 | */ |
| 273 | - do_action( 'give_logs_donors_table_top' ); |
|
| 273 | + do_action('give_logs_donors_table_top'); |
|
| 274 | 274 | ?> |
| 275 | 275 | <form id="give-donors-filter" method="get"> |
| 276 | 276 | <?php |
| 277 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
| 277 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
| 278 | 278 | $give_table->display(); |
| 279 | 279 | ?> |
| 280 | 280 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @since 1.0 |
| 289 | 289 | */ |
| 290 | - do_action( 'give_logs_donors_table_bottom' ); |
|
| 290 | + do_action('give_logs_donors_table_bottom'); |
|
| 291 | 291 | ?> |
| 292 | 292 | </div> |
| 293 | 293 | <?php |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
| 296 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
| 297 | 297 | |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | * @return void |
| 306 | 306 | */ |
| 307 | 307 | function give_reports_gateways_table() { |
| 308 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
| 308 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
| 309 | 309 | |
| 310 | 310 | $give_table = new Give_Gateawy_Reports_Table(); |
| 311 | 311 | $give_table->prepare_items(); |
| 312 | 312 | $give_table->display(); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
| 315 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
| 316 | 316 | |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -324,13 +324,13 @@ discard block |
||
| 324 | 324 | function give_reports_earnings() { |
| 325 | 325 | ?> |
| 326 | 326 | <div class="tablenav top reports-table-nav"> |
| 327 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
| 327 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
| 328 | 328 | </div> |
| 329 | 329 | <?php |
| 330 | 330 | give_reports_graph(); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
| 333 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -351,14 +351,14 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @since 1.0 |
| 353 | 353 | */ |
| 354 | - do_action( 'give_reports_tab_export_content_top' ); |
|
| 354 | + do_action('give_reports_tab_export_content_top'); |
|
| 355 | 355 | ?> |
| 356 | 356 | |
| 357 | 357 | <table class="widefat export-options-table give-table"> |
| 358 | 358 | <thead> |
| 359 | 359 | <tr> |
| 360 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
| 361 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
| 360 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
| 361 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
| 362 | 362 | </tr> |
| 363 | 363 | </thead> |
| 364 | 364 | <tbody> |
@@ -370,42 +370,42 @@ discard block |
||
| 370 | 370 | * |
| 371 | 371 | * @since 1.0 |
| 372 | 372 | */ |
| 373 | - do_action( 'give_reports_tab_export_table_top' ); |
|
| 373 | + do_action('give_reports_tab_export_table_top'); |
|
| 374 | 374 | ?> |
| 375 | 375 | <tr class="give-export-pdf-sales-earnings"> |
| 376 | 376 | <td scope="row" class="row-title"> |
| 377 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
| 377 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
| 378 | 378 | </h3> |
| 379 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
| 379 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
| 380 | 380 | </td> |
| 381 | 381 | <td> |
| 382 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
| 382 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
| 383 | 383 | </td> |
| 384 | 384 | </tr> |
| 385 | 385 | <tr class="alternate give-export-sales-earnings"> |
| 386 | 386 | <td scope="row" class="row-title"> |
| 387 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
| 388 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
| 387 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
| 388 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
| 389 | 389 | </td> |
| 390 | 390 | <td> |
| 391 | 391 | <form method="post"> |
| 392 | 392 | <?php |
| 393 | 393 | printf( |
| 394 | 394 | /* translators: 1: start date dropdown 2: end date dropdown */ |
| 395 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
| 396 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
| 397 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
| 395 | + esc_html__('%1$s to %2$s', 'give'), |
|
| 396 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
| 397 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
| 398 | 398 | ); |
| 399 | 399 | ?> |
| 400 | 400 | <input type="hidden" name="give-action" value="earnings_export"/> |
| 401 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 401 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 402 | 402 | </form> |
| 403 | 403 | </td> |
| 404 | 404 | </tr> |
| 405 | 405 | <tr class="give-export-payment-history"> |
| 406 | 406 | <td scope="row" class="row-title"> |
| 407 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
| 408 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
| 407 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
| 408 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
| 409 | 409 | </td> |
| 410 | 410 | <td> |
| 411 | 411 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -413,27 +413,27 @@ discard block |
||
| 413 | 413 | $args = array( |
| 414 | 414 | 'id' => 'give-payment-export-start', |
| 415 | 415 | 'name' => 'start', |
| 416 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
| 416 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
| 417 | 417 | ); |
| 418 | - echo Give()->html->date_field( $args ); ?> |
|
| 418 | + echo Give()->html->date_field($args); ?> |
|
| 419 | 419 | <?php |
| 420 | 420 | $args = array( |
| 421 | 421 | 'id' => 'give-payment-export-end', |
| 422 | 422 | 'name' => 'end', |
| 423 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
| 423 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
| 424 | 424 | ); |
| 425 | - echo Give()->html->date_field( $args ); ?> |
|
| 425 | + echo Give()->html->date_field($args); ?> |
|
| 426 | 426 | <select name="status"> |
| 427 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
| 427 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
| 428 | 428 | <?php |
| 429 | 429 | $statuses = give_get_payment_statuses(); |
| 430 | - foreach ( $statuses as $status => $label ) { |
|
| 431 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
| 430 | + foreach ($statuses as $status => $label) { |
|
| 431 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
| 432 | 432 | } |
| 433 | 433 | ?> |
| 434 | 434 | </select> |
| 435 | 435 | <?php |
| 436 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
| 436 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
| 437 | 437 | echo Give()->html->category_dropdown( |
| 438 | 438 | 'give_forms_categories[]', |
| 439 | 439 | 0, |
@@ -443,12 +443,12 @@ discard block |
||
| 443 | 443 | 'multiple' => true, |
| 444 | 444 | 'selected' => array(), |
| 445 | 445 | 'show_option_all' => false, |
| 446 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
| 446 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
| 447 | 447 | ) |
| 448 | 448 | ); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
| 451 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
| 452 | 452 | echo Give()->html->tags_dropdown( |
| 453 | 453 | 'give_forms_tags[]', |
| 454 | 454 | 0, |
@@ -458,16 +458,16 @@ discard block |
||
| 458 | 458 | 'multiple' => true, |
| 459 | 459 | 'selected' => array(), |
| 460 | 460 | 'show_option_all' => false, |
| 461 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
| 461 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
| 462 | 462 | ) |
| 463 | 463 | ); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
| 466 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
| 467 | 467 | ?> |
| 468 | 468 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
| 469 | 469 | <span> |
| 470 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 470 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 471 | 471 | <span class="spinner"></span> |
| 472 | 472 | </span> |
| 473 | 473 | </form> |
@@ -475,8 +475,8 @@ discard block |
||
| 475 | 475 | </tr> |
| 476 | 476 | <tr class="alternate give-export-donors"> |
| 477 | 477 | <td scope="row" class="row-title"> |
| 478 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
| 479 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
| 478 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
| 479 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
| 480 | 480 | </td> |
| 481 | 481 | <td> |
| 482 | 482 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -487,46 +487,46 @@ discard block |
||
| 487 | 487 | 'id' => 'give_customer_export_form', |
| 488 | 488 | 'chosen' => true, |
| 489 | 489 | ); |
| 490 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
| 490 | + echo Give()->html->forms_dropdown($args); ?> |
|
| 491 | 491 | |
| 492 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
| 492 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
| 493 | 493 | |
| 494 | 494 | <div id="export-donor-options-wrap" class="give-clearfix"> |
| 495 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
| 495 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
| 496 | 496 | <ul id="give-export-option-ul"> |
| 497 | 497 | <li> |
| 498 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
| 498 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
| 499 | 499 | </label> |
| 500 | 500 | </li> |
| 501 | 501 | <li> |
| 502 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
| 502 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
| 503 | 503 | </label> |
| 504 | 504 | </li> |
| 505 | 505 | <li> |
| 506 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
| 506 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
| 507 | 507 | </label> |
| 508 | 508 | </li> |
| 509 | 509 | <li> |
| 510 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
| 510 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
| 511 | 511 | </label> |
| 512 | 512 | </li> |
| 513 | 513 | <li> |
| 514 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
| 514 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
| 515 | 515 | </label> |
| 516 | 516 | </li> |
| 517 | 517 | <li> |
| 518 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
| 518 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
| 519 | 519 | </label> |
| 520 | 520 | </li> |
| 521 | 521 | <li> |
| 522 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
| 522 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
| 523 | 523 | </label> |
| 524 | 524 | </li> |
| 525 | 525 | </ul> |
| 526 | 526 | </div> |
| 527 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
| 527 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
| 528 | 528 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
| 529 | - <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
|
| 529 | + <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/> |
|
| 530 | 530 | </form> |
| 531 | 531 | </td> |
| 532 | 532 | </tr> |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | * |
| 539 | 539 | * @since 1.0 |
| 540 | 540 | */ |
| 541 | - do_action( 'give_reports_tab_export_table_bottom' ); |
|
| 541 | + do_action('give_reports_tab_export_table_bottom'); |
|
| 542 | 542 | ?> |
| 543 | 543 | </tbody> |
| 544 | 544 | </table> |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | * |
| 550 | 550 | * @since 1.0 |
| 551 | 551 | */ |
| 552 | - do_action( 'give_reports_tab_export_content_bottom' ); |
|
| 552 | + do_action('give_reports_tab_export_content_bottom'); |
|
| 553 | 553 | ?> |
| 554 | 554 | |
| 555 | 555 | </div> |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | <?php |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
| 563 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
| 564 | 564 | |
| 565 | 565 | /** |
| 566 | 566 | * Renders the Reports page |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | function give_reports_tab_logs() { |
| 572 | 572 | |
| 573 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
| 573 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
| 574 | 574 | |
| 575 | 575 | // Get current section. |
| 576 | 576 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @since 1.0 |
| 582 | 582 | */ |
| 583 | - do_action( "give_logs_view_{$current_section}" ); |
|
| 583 | + do_action("give_logs_view_{$current_section}"); |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | /** |
@@ -591,9 +591,9 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | function give_estimated_monthly_stats() { |
| 593 | 593 | |
| 594 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
| 594 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
| 595 | 595 | |
| 596 | - if ( false === $estimated ) { |
|
| 596 | + if (false === $estimated) { |
|
| 597 | 597 | |
| 598 | 598 | $estimated = array( |
| 599 | 599 | 'earnings' => 0, |
@@ -602,22 +602,22 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | $stats = new Give_Payment_Stats; |
| 604 | 604 | |
| 605 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
| 606 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
| 605 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
| 606 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
| 607 | 607 | |
| 608 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
| 609 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
| 610 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 611 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
| 608 | + $current_day = date('d', current_time('timestamp')); |
|
| 609 | + $current_month = date('n', current_time('timestamp')); |
|
| 610 | + $current_year = date('Y', current_time('timestamp')); |
|
| 611 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
| 612 | 612 | |
| 613 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
| 614 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
| 613 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
| 614 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
| 615 | 615 | |
| 616 | 616 | // Cache for one day |
| 617 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
| 617 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - return maybe_unserialize( $estimated ); |
|
| 620 | + return maybe_unserialize($estimated); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -62,26 +62,26 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @param array $request The Form Data passed into the batch processing |
| 64 | 64 | */ |
| 65 | - public function set_properties( $request ) { |
|
| 65 | + public function set_properties($request) { |
|
| 66 | 66 | |
| 67 | 67 | // Set data from form submission |
| 68 | - if ( isset( $_POST['form'] ) ) { |
|
| 69 | - parse_str( $_POST['form'], $this->data ); |
|
| 68 | + if (isset($_POST['form'])) { |
|
| 69 | + parse_str($_POST['form'], $this->data); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $this->form = $this->data['forms']; |
| 73 | 73 | |
| 74 | 74 | // Setup donor ids cache. |
| 75 | - if( ! empty( $this->form ) ) { |
|
| 75 | + if ( ! empty($this->form)) { |
|
| 76 | 76 | // Cache donor ids to output unique list of donor. |
| 77 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
| 78 | - if( ! ( $this->donor_ids = get_transient( $this->query_id ) ) ) { |
|
| 77 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
| 78 | + if ( ! ($this->donor_ids = get_transient($this->query_id))) { |
|
| 79 | 79 | $this->donor_ids = array(); |
| 80 | - set_transient( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS ); |
|
| 80 | + set_transient($this->query_id, $this->donor_ids, HOUR_IN_SECONDS); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
| 84 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function csv_cols() { |
| 96 | 96 | |
| 97 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
| 97 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
| 98 | 98 | |
| 99 | 99 | // We need columns. |
| 100 | - if ( empty( $columns ) ) { |
|
| 100 | + if (empty($columns)) { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $cols = $this->get_cols( $columns ); |
|
| 104 | + $cols = $this->get_cols($columns); |
|
| 105 | 105 | |
| 106 | 106 | return $cols; |
| 107 | 107 | } |
@@ -113,38 +113,38 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return array |
| 115 | 115 | */ |
| 116 | - private function get_cols( $columns ) { |
|
| 116 | + private function get_cols($columns) { |
|
| 117 | 117 | |
| 118 | 118 | $cols = array(); |
| 119 | 119 | |
| 120 | - foreach ( $columns as $key => $value ) { |
|
| 120 | + foreach ($columns as $key => $value) { |
|
| 121 | 121 | |
| 122 | - switch ( $key ) { |
|
| 122 | + switch ($key) { |
|
| 123 | 123 | case 'full_name' : |
| 124 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
| 124 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
| 125 | 125 | break; |
| 126 | 126 | case 'email' : |
| 127 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
| 127 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
| 128 | 128 | break; |
| 129 | 129 | case 'address' : |
| 130 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
| 131 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
| 132 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
| 133 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
| 134 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
| 135 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
| 130 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
| 131 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
| 132 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
| 133 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
| 134 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
| 135 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
| 136 | 136 | break; |
| 137 | 137 | case 'userid' : |
| 138 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
| 138 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
| 139 | 139 | break; |
| 140 | 140 | case 'date_first_donated' : |
| 141 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
| 141 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
| 142 | 142 | break; |
| 143 | 143 | case 'donations' : |
| 144 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
| 144 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
| 145 | 145 | break; |
| 146 | 146 | case 'donation_sum' : |
| 147 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
| 147 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -167,20 +167,20 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $i = 0; |
| 169 | 169 | |
| 170 | - if ( ! empty( $this->form ) ) { |
|
| 170 | + if ( ! empty($this->form)) { |
|
| 171 | 171 | |
| 172 | 172 | // Export donors of a specific product |
| 173 | 173 | global $give_logs; |
| 174 | 174 | |
| 175 | 175 | $args = array( |
| 176 | - 'post_parent' => absint( $this->form ), |
|
| 176 | + 'post_parent' => absint($this->form), |
|
| 177 | 177 | 'log_type' => 'sale', |
| 178 | 178 | 'posts_per_page' => 30, |
| 179 | 179 | 'paged' => $this->step, |
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | 182 | // Check for price option |
| 183 | - if ( null !== $this->price_id ) { |
|
| 183 | + if (null !== $this->price_id) { |
|
| 184 | 184 | $args['meta_query'] = array( |
| 185 | 185 | array( |
| 186 | 186 | 'key' => '_give_log_price_id', |
@@ -189,44 +189,44 @@ discard block |
||
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $logs = $give_logs->get_connected_logs( $args ); |
|
| 192 | + $logs = $give_logs->get_connected_logs($args); |
|
| 193 | 193 | |
| 194 | - if ( $logs ) { |
|
| 195 | - foreach ( $logs as $log ) { |
|
| 196 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
| 197 | - $payment = new Give_Payment( $payment_id ); |
|
| 194 | + if ($logs) { |
|
| 195 | + foreach ($logs as $log) { |
|
| 196 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
| 197 | + $payment = new Give_Payment($payment_id); |
|
| 198 | 198 | |
| 199 | 199 | // Continue if donor already included. |
| 200 | - if( in_array( $payment->customer_id , $this->donor_ids ) ) { |
|
| 200 | + if (in_array($payment->customer_id, $this->donor_ids)) { |
|
| 201 | 201 | continue; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $this->donor_ids[] = $payment->customer_id; |
| 205 | 205 | |
| 206 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
| 207 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 208 | - $i ++; |
|
| 206 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
| 207 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 208 | + $i++; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // Cache donor ids only if admin export donor for specific form. |
| 212 | - set_transient( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS ); |
|
| 212 | + set_transient($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS); |
|
| 213 | 213 | } |
| 214 | 214 | } else { |
| 215 | 215 | |
| 216 | 216 | // Export all donors. |
| 217 | - $offset = 30 * ( $this->step - 1 ); |
|
| 218 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
| 217 | + $offset = 30 * ($this->step - 1); |
|
| 218 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
| 219 | 219 | |
| 220 | - foreach ( $donors as $donor ) { |
|
| 220 | + foreach ($donors as $donor) { |
|
| 221 | 221 | |
| 222 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
| 223 | - $i ++; |
|
| 222 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
| 223 | + $i++; |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
| 228 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 229 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 228 | + $data = apply_filters('give_export_get_data', $data); |
|
| 229 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 230 | 230 | |
| 231 | 231 | return $data; |
| 232 | 232 | } |
@@ -242,18 +242,18 @@ discard block |
||
| 242 | 242 | $percentage = 0; |
| 243 | 243 | |
| 244 | 244 | // We can't count the number when getting them for a specific form |
| 245 | - if ( empty( $this->form ) ) { |
|
| 245 | + if (empty($this->form)) { |
|
| 246 | 246 | |
| 247 | 247 | $total = Give()->customers->count(); |
| 248 | 248 | |
| 249 | - if ( $total > 0 ) { |
|
| 249 | + if ($total > 0) { |
|
| 250 | 250 | |
| 251 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
| 251 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
| 252 | 252 | |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if ( $percentage > 100 ) { |
|
| 256 | + if ($percentage > 100) { |
|
| 257 | 257 | $percentage = 100; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -269,46 +269,46 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return mixed |
| 271 | 271 | */ |
| 272 | - private function set_donor_data( $i, $data, $donor ) { |
|
| 272 | + private function set_donor_data($i, $data, $donor) { |
|
| 273 | 273 | |
| 274 | 274 | $columns = $this->csv_cols(); |
| 275 | 275 | |
| 276 | 276 | // Set address variable |
| 277 | 277 | $address = ''; |
| 278 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
| 279 | - $address = give_get_donor_address( $donor->user_id ); |
|
| 278 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
| 279 | + $address = give_get_donor_address($donor->user_id); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | // Set columns |
| 283 | - if ( ! empty( $columns['full_name'] ) ) { |
|
| 284 | - $data[ $i ]['full_name'] = $donor->name; |
|
| 283 | + if ( ! empty($columns['full_name'])) { |
|
| 284 | + $data[$i]['full_name'] = $donor->name; |
|
| 285 | 285 | } |
| 286 | - if ( ! empty( $columns['email'] ) ) { |
|
| 287 | - $data[ $i ]['email'] = $donor->email; |
|
| 286 | + if ( ! empty($columns['email'])) { |
|
| 287 | + $data[$i]['email'] = $donor->email; |
|
| 288 | 288 | } |
| 289 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
| 290 | - |
|
| 291 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
| 292 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
| 293 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
| 294 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
| 295 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
| 296 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
| 289 | + if ( ! empty($columns['address_line1'])) { |
|
| 290 | + |
|
| 291 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
| 292 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
| 293 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
| 294 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
| 295 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
| 296 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
| 297 | 297 | } |
| 298 | - if ( ! empty( $columns['userid'] ) ) { |
|
| 299 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
| 298 | + if ( ! empty($columns['userid'])) { |
|
| 299 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
| 300 | 300 | } |
| 301 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
| 302 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
| 301 | + if ( ! empty($columns['date_first_donated'])) { |
|
| 302 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
| 303 | 303 | } |
| 304 | - if ( ! empty( $columns['donations'] ) ) { |
|
| 305 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
| 304 | + if ( ! empty($columns['donations'])) { |
|
| 305 | + $data[$i]['donations'] = $donor->purchase_count; |
|
| 306 | 306 | } |
| 307 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
| 308 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
| 307 | + if ( ! empty($columns['donation_sum'])) { |
|
| 308 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - return $data[ $i ]; |
|
| 311 | + return $data[$i]; |
|
| 312 | 312 | |
| 313 | 313 | } |
| 314 | 314 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | function give_process_batch_export_form() { |
| 24 | 24 | |
| 25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
| 26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
| 26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
| 29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Fires before batch export. |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param string $class Export class. |
| 37 | 37 | */ |
| 38 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
| 38 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
| 39 | 39 | |
| 40 | 40 | $export = new $_REQUEST['class']; |
| 41 | 41 | $export->export(); |
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
| 45 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Exports earnings for a specified time period |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | 55 | function give_export_earnings() { |
| 56 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
| 56 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
| 57 | 57 | |
| 58 | 58 | $earnings_export = new Give_Earnings_Export(); |
| 59 | 59 | |
| 60 | 60 | $earnings_export->export(); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
| 63 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return void |
| 71 | 71 | */ |
| 72 | 72 | function give_register_batch_exporters() { |
| 73 | - if ( is_admin() ) { |
|
| 73 | + if (is_admin()) { |
|
| 74 | 74 | /** |
| 75 | 75 | * Fires in the admin, while plugins loaded. |
| 76 | 76 | * |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param string $class Export class. |
| 82 | 82 | */ |
| 83 | - do_action( 'give_register_batch_exporter' ); |
|
| 83 | + do_action('give_register_batch_exporter'); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
| 87 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Register the payments batch exporter |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | * @since 1.5 |
| 93 | 93 | */ |
| 94 | 94 | function give_register_payments_batch_export() { |
| 95 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
| 95 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
| 98 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Loads the payments batch process if needed |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | -function give_include_payments_batch_processor( $class ) { |
|
| 109 | +function give_include_payments_batch_processor($class) { |
|
| 110 | 110 | |
| 111 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
| 112 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
| 111 | + if ('Give_Batch_Payments_Export' === $class) { |
|
| 112 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | } |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | * @since 1.5.2 |
| 121 | 121 | */ |
| 122 | 122 | function give_register_customers_batch_export() { |
| 123 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
| 123 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
| 126 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * Loads the customers batch process if needed |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | * |
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | -function give_include_customers_batch_processor( $class ) { |
|
| 137 | +function give_include_customers_batch_processor($class) { |
|
| 138 | 138 | |
| 139 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
| 140 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
| 139 | + if ('Give_Batch_Customers_Export' === $class) { |
|
| 140 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | * @since 1.5 |
| 149 | 149 | */ |
| 150 | 150 | function give_register_forms_batch_export() { |
| 151 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
| 151 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
| 154 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Loads the file downloads batch process if needed |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return void |
| 164 | 164 | */ |
| 165 | -function give_include_forms_batch_processor( $class ) { |
|
| 165 | +function give_include_forms_batch_processor($class) { |
|
| 166 | 166 | |
| 167 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
| 168 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
| 167 | + if ('Give_Batch_Forms_Export' === $class) { |
|
| 168 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | } |
@@ -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 | |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return object $payments Payments retrieved from the database |
| 45 | 45 | */ |
| 46 | -function give_get_payments( $args = array() ) { |
|
| 46 | +function give_get_payments($args = array()) { |
|
| 47 | 47 | |
| 48 | 48 | // Fallback to post objects to ensure backwards compatibility. |
| 49 | - if ( ! isset( $args['output'] ) ) { |
|
| 49 | + if ( ! isset($args['output'])) { |
|
| 50 | 50 | $args['output'] = 'posts'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $args = apply_filters( 'give_get_payments_args', $args ); |
|
| 54 | - $payments = new Give_Payments_Query( $args ); |
|
| 53 | + $args = apply_filters('give_get_payments_args', $args); |
|
| 54 | + $payments = new Give_Payments_Query($args); |
|
| 55 | 55 | |
| 56 | 56 | return $payments->get_payments(); |
| 57 | 57 | } |
@@ -66,48 +66,48 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | -function give_get_payment_by( $field = '', $value = '' ) { |
|
| 69 | +function give_get_payment_by($field = '', $value = '') { |
|
| 70 | 70 | |
| 71 | - if ( empty( $field ) || empty( $value ) ) { |
|
| 71 | + if (empty($field) || empty($value)) { |
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - switch ( strtolower( $field ) ) { |
|
| 75 | + switch (strtolower($field)) { |
|
| 76 | 76 | |
| 77 | 77 | case 'id': |
| 78 | - $payment = new Give_Payment( $value ); |
|
| 78 | + $payment = new Give_Payment($value); |
|
| 79 | 79 | $id = $payment->ID; |
| 80 | 80 | |
| 81 | - if ( empty( $id ) ) { |
|
| 81 | + if (empty($id)) { |
|
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | break; |
| 86 | 86 | |
| 87 | 87 | case 'key': |
| 88 | - $payment = give_get_payments( array( |
|
| 88 | + $payment = give_get_payments(array( |
|
| 89 | 89 | 'meta_key' => '_give_payment_purchase_key', |
| 90 | 90 | 'meta_value' => $value, |
| 91 | 91 | 'posts_per_page' => 1, |
| 92 | 92 | 'fields' => 'ids', |
| 93 | - ) ); |
|
| 93 | + )); |
|
| 94 | 94 | |
| 95 | - if ( $payment ) { |
|
| 96 | - $payment = new Give_Payment( $payment[0] ); |
|
| 95 | + if ($payment) { |
|
| 96 | + $payment = new Give_Payment($payment[0]); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | break; |
| 100 | 100 | |
| 101 | 101 | case 'payment_number': |
| 102 | - $payment = give_get_payments( array( |
|
| 102 | + $payment = give_get_payments(array( |
|
| 103 | 103 | 'meta_key' => '_give_payment_number', |
| 104 | 104 | 'meta_value' => $value, |
| 105 | 105 | 'posts_per_page' => 1, |
| 106 | 106 | 'fields' => 'ids', |
| 107 | - ) ); |
|
| 107 | + )); |
|
| 108 | 108 | |
| 109 | - if ( $payment ) { |
|
| 110 | - $payment = new Give_Payment( $payment[0] ); |
|
| 109 | + if ($payment) { |
|
| 110 | + $payment = new Give_Payment($payment[0]); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | break; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | return false; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if ( $payment ) { |
|
| 119 | + if ($payment) { |
|
| 120 | 120 | return $payment; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -132,23 +132,23 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @return int|bool Payment ID if payment is inserted, false otherwise. |
| 134 | 134 | */ |
| 135 | -function give_insert_payment( $payment_data = array() ) { |
|
| 135 | +function give_insert_payment($payment_data = array()) { |
|
| 136 | 136 | |
| 137 | - if ( empty( $payment_data ) ) { |
|
| 137 | + if (empty($payment_data)) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $payment = new Give_Payment(); |
| 142 | - $gateway = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : ''; |
|
| 143 | - $gateway = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway; |
|
| 144 | - $form_id = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0; |
|
| 145 | - $price_id = give_get_payment_meta_price_id( $payment_data ); |
|
| 146 | - $form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id ); |
|
| 142 | + $gateway = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : ''; |
|
| 143 | + $gateway = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway; |
|
| 144 | + $form_id = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0; |
|
| 145 | + $price_id = give_get_payment_meta_price_id($payment_data); |
|
| 146 | + $form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id); |
|
| 147 | 147 | |
| 148 | 148 | // Set properties. |
| 149 | 149 | $payment->total = $payment_data['price']; |
| 150 | - $payment->status = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending'; |
|
| 151 | - $payment->currency = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency(); |
|
| 150 | + $payment->status = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending'; |
|
| 151 | + $payment->currency = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency(); |
|
| 152 | 152 | $payment->user_info = $payment_data['user_info']; |
| 153 | 153 | $payment->gateway = $gateway; |
| 154 | 154 | $payment->form_title = $form_title; |
@@ -162,31 +162,31 @@ discard block |
||
| 162 | 162 | $payment->ip = give_get_ip(); |
| 163 | 163 | $payment->key = $payment_data['purchase_key']; |
| 164 | 164 | $payment->mode = give_is_test_mode() ? 'test' : 'live'; |
| 165 | - $payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : ''; |
|
| 165 | + $payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : ''; |
|
| 166 | 166 | |
| 167 | 167 | // Add the donation. |
| 168 | 168 | $args = array( |
| 169 | 169 | 'price' => $payment->total, |
| 170 | 170 | 'price_id' => $payment->price_id, |
| 171 | - 'fees' => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array(), |
|
| 171 | + 'fees' => isset($payment_data['fees']) ? $payment_data['fees'] : array(), |
|
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | - $payment->add_donation( $payment->form_id, $args ); |
|
| 174 | + $payment->add_donation($payment->form_id, $args); |
|
| 175 | 175 | |
| 176 | 176 | // Set date if present. |
| 177 | - if ( isset( $payment_data['post_date'] ) ) { |
|
| 177 | + if (isset($payment_data['post_date'])) { |
|
| 178 | 178 | $payment->date = $payment_data['post_date']; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Handle sequential payments. |
| 182 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 182 | + if (give_get_option('enable_sequential')) { |
|
| 183 | 183 | $number = give_get_next_payment_number(); |
| 184 | - $payment->number = give_format_payment_number( $number ); |
|
| 185 | - update_option( 'give_last_payment_number', $number ); |
|
| 184 | + $payment->number = give_format_payment_number($number); |
|
| 185 | + update_option('give_last_payment_number', $number); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Clear the user's donation cache. |
| 189 | - delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' ); |
|
| 189 | + delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases'); |
|
| 190 | 190 | |
| 191 | 191 | // Save payment. |
| 192 | 192 | $payment->save(); |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | * @param int $payment_id The payment ID. |
| 200 | 200 | * @param array $payment_data Arguments passed. |
| 201 | 201 | */ |
| 202 | - do_action( 'give_insert_payment', $payment->ID, $payment_data ); |
|
| 202 | + do_action('give_insert_payment', $payment->ID, $payment_data); |
|
| 203 | 203 | |
| 204 | 204 | // Return payment ID upon success. |
| 205 | - if ( ! empty( $payment->ID ) ) { |
|
| 205 | + if ( ! empty($payment->ID)) { |
|
| 206 | 206 | return $payment->ID; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @return bool|int |
| 220 | 220 | */ |
| 221 | -function give_create_payment( $payment_data ) { |
|
| 221 | +function give_create_payment($payment_data) { |
|
| 222 | 222 | |
| 223 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
| 224 | - $price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : ''; |
|
| 223 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
| 224 | + $price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : ''; |
|
| 225 | 225 | |
| 226 | 226 | // Collect payment data. |
| 227 | 227 | $insert_payment_data = array( |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @param array $insert_payment_data |
| 247 | 247 | */ |
| 248 | - $insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data ); |
|
| 248 | + $insert_payment_data = apply_filters('give_create_payment', $insert_payment_data); |
|
| 249 | 249 | |
| 250 | 250 | // Record the pending payment. |
| 251 | - return give_insert_payment( $insert_payment_data ); |
|
| 251 | + return give_insert_payment($insert_payment_data); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | * |
| 262 | 262 | * @return bool |
| 263 | 263 | */ |
| 264 | -function give_update_payment_status( $payment_id, $new_status = 'publish' ) { |
|
| 264 | +function give_update_payment_status($payment_id, $new_status = 'publish') { |
|
| 265 | 265 | |
| 266 | - $payment = new Give_Payment( $payment_id ); |
|
| 266 | + $payment = new Give_Payment($payment_id); |
|
| 267 | 267 | $payment->status = $new_status; |
| 268 | 268 | $updated = $payment->save(); |
| 269 | 269 | |
@@ -282,37 +282,37 @@ discard block |
||
| 282 | 282 | * |
| 283 | 283 | * @return void |
| 284 | 284 | */ |
| 285 | -function give_delete_purchase( $payment_id = 0, $update_customer = true ) { |
|
| 285 | +function give_delete_purchase($payment_id = 0, $update_customer = true) { |
|
| 286 | 286 | global $give_logs; |
| 287 | 287 | |
| 288 | - $payment = new Give_Payment( $payment_id ); |
|
| 289 | - $amount = give_get_payment_amount( $payment_id ); |
|
| 288 | + $payment = new Give_Payment($payment_id); |
|
| 289 | + $amount = give_get_payment_amount($payment_id); |
|
| 290 | 290 | $status = $payment->post_status; |
| 291 | - $customer_id = give_get_payment_customer_id( $payment_id ); |
|
| 292 | - $customer = new Give_Customer( $customer_id ); |
|
| 291 | + $customer_id = give_get_payment_customer_id($payment_id); |
|
| 292 | + $customer = new Give_Customer($customer_id); |
|
| 293 | 293 | |
| 294 | 294 | // Only undo donations that aren't these statuses. |
| 295 | - $dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array( |
|
| 295 | + $dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array( |
|
| 296 | 296 | 'pending', |
| 297 | 297 | 'cancelled', |
| 298 | - ) ); |
|
| 298 | + )); |
|
| 299 | 299 | |
| 300 | - if ( ! in_array( $status, $dont_undo_statuses ) ) { |
|
| 301 | - give_undo_purchase( false, $payment_id ); |
|
| 300 | + if ( ! in_array($status, $dont_undo_statuses)) { |
|
| 301 | + give_undo_purchase(false, $payment_id); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if ( $status == 'publish' ) { |
|
| 304 | + if ($status == 'publish') { |
|
| 305 | 305 | |
| 306 | 306 | // Only decrease earnings if they haven't already been decreased (or were never increased for this payment). |
| 307 | - give_decrease_total_earnings( $amount ); |
|
| 307 | + give_decrease_total_earnings($amount); |
|
| 308 | 308 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
| 309 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 309 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 310 | 310 | |
| 311 | - if ( $customer->id && $update_customer ) { |
|
| 311 | + if ($customer->id && $update_customer) { |
|
| 312 | 312 | |
| 313 | 313 | // Decrement the stats for the donor. |
| 314 | 314 | $customer->decrease_purchase_count(); |
| 315 | - $customer->decrease_value( $amount ); |
|
| 315 | + $customer->decrease_value($amount); |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -324,17 +324,17 @@ discard block |
||
| 324 | 324 | * |
| 325 | 325 | * @param int $payment_id Payment ID. |
| 326 | 326 | */ |
| 327 | - do_action( 'give_payment_delete', $payment_id ); |
|
| 327 | + do_action('give_payment_delete', $payment_id); |
|
| 328 | 328 | |
| 329 | - if ( $customer->id && $update_customer ) { |
|
| 329 | + if ($customer->id && $update_customer) { |
|
| 330 | 330 | |
| 331 | 331 | // Remove the payment ID from the donor. |
| 332 | - $customer->remove_payment( $payment_id ); |
|
| 332 | + $customer->remove_payment($payment_id); |
|
| 333 | 333 | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Remove the payment. |
| 337 | - wp_delete_post( $payment_id, true ); |
|
| 337 | + wp_delete_post($payment_id, true); |
|
| 338 | 338 | |
| 339 | 339 | // Remove related sale log entries. |
| 340 | 340 | $give_logs->delete_logs( |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @param int $payment_id Payment ID. |
| 357 | 357 | */ |
| 358 | - do_action( 'give_payment_deleted', $payment_id ); |
|
| 358 | + do_action('give_payment_deleted', $payment_id); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -371,25 +371,25 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @return void |
| 373 | 373 | */ |
| 374 | -function give_undo_purchase( $form_id = false, $payment_id ) { |
|
| 374 | +function give_undo_purchase($form_id = false, $payment_id) { |
|
| 375 | 375 | |
| 376 | - if ( ! empty( $form_id ) ) { |
|
| 376 | + if ( ! empty($form_id)) { |
|
| 377 | 377 | $form_id = false; |
| 378 | - _give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' ); |
|
| 378 | + _give_deprected_argument('form_id', 'give_undo_purchase', '1.5'); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $payment = new Give_Payment( $payment_id ); |
|
| 381 | + $payment = new Give_Payment($payment_id); |
|
| 382 | 382 | |
| 383 | - $maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id ); |
|
| 384 | - if ( true === $maybe_decrease_earnings ) { |
|
| 383 | + $maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id); |
|
| 384 | + if (true === $maybe_decrease_earnings) { |
|
| 385 | 385 | // Decrease earnings. |
| 386 | - give_decrease_earnings( $payment->form_id, $payment->total ); |
|
| 386 | + give_decrease_earnings($payment->form_id, $payment->total); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id ); |
|
| 390 | - if ( true === $maybe_decrease_sales ) { |
|
| 389 | + $maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id); |
|
| 390 | + if (true === $maybe_decrease_sales) { |
|
| 391 | 391 | // Decrease donation count. |
| 392 | - give_decrease_purchase_count( $payment->form_id ); |
|
| 392 | + give_decrease_purchase_count($payment->form_id); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * |
| 407 | 407 | * @return array $count Number of payments sorted by payment status. |
| 408 | 408 | */ |
| 409 | -function give_count_payments( $args = array() ) { |
|
| 409 | +function give_count_payments($args = array()) { |
|
| 410 | 410 | |
| 411 | 411 | global $wpdb; |
| 412 | 412 | |
@@ -418,18 +418,18 @@ discard block |
||
| 418 | 418 | 'form_id' => null, |
| 419 | 419 | ); |
| 420 | 420 | |
| 421 | - $args = wp_parse_args( $args, $defaults ); |
|
| 421 | + $args = wp_parse_args($args, $defaults); |
|
| 422 | 422 | |
| 423 | 423 | $select = 'SELECT p.post_status,count( * ) AS num_posts'; |
| 424 | 424 | $join = ''; |
| 425 | 425 | $where = "WHERE p.post_type = 'give_payment'"; |
| 426 | 426 | |
| 427 | 427 | // Count payments for a specific user. |
| 428 | - if ( ! empty( $args['user'] ) ) { |
|
| 428 | + if ( ! empty($args['user'])) { |
|
| 429 | 429 | |
| 430 | - if ( is_email( $args['user'] ) ) { |
|
| 430 | + if (is_email($args['user'])) { |
|
| 431 | 431 | $field = 'email'; |
| 432 | - } elseif ( is_numeric( $args['user'] ) ) { |
|
| 432 | + } elseif (is_numeric($args['user'])) { |
|
| 433 | 433 | $field = 'id'; |
| 434 | 434 | } else { |
| 435 | 435 | $field = ''; |
@@ -437,105 +437,105 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
| 439 | 439 | |
| 440 | - if ( ! empty( $field ) ) { |
|
| 440 | + if ( ! empty($field)) { |
|
| 441 | 441 | $where .= " |
| 442 | 442 | AND m.meta_key = '_give_payment_user_{$field}' |
| 443 | 443 | AND m.meta_value = '{$args['user']}'"; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | // Count payments for a search. |
| 447 | - } elseif ( ! empty( $args['s'] ) ) { |
|
| 447 | + } elseif ( ! empty($args['s'])) { |
|
| 448 | 448 | |
| 449 | - if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) { |
|
| 449 | + if (is_email($args['s']) || strlen($args['s']) == 32) { |
|
| 450 | 450 | |
| 451 | - if ( is_email( $args['s'] ) ) { |
|
| 451 | + if (is_email($args['s'])) { |
|
| 452 | 452 | $field = '_give_payment_user_email'; |
| 453 | 453 | } else { |
| 454 | 454 | $field = '_give_payment_purchase_key'; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 458 | - $where .= $wpdb->prepare( ' |
|
| 457 | + $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 458 | + $where .= $wpdb->prepare(' |
|
| 459 | 459 | AND m.meta_key = %s |
| 460 | 460 | AND m.meta_value = %s', |
| 461 | 461 | $field, |
| 462 | 462 | $args['s'] |
| 463 | 463 | ); |
| 464 | 464 | |
| 465 | - } elseif ( '#' == substr( $args['s'], 0, 1 ) ) { |
|
| 465 | + } elseif ('#' == substr($args['s'], 0, 1)) { |
|
| 466 | 466 | |
| 467 | - $search = str_replace( '#:', '', $args['s'] ); |
|
| 468 | - $search = str_replace( '#', '', $search ); |
|
| 467 | + $search = str_replace('#:', '', $args['s']); |
|
| 468 | + $search = str_replace('#', '', $search); |
|
| 469 | 469 | |
| 470 | 470 | $select = 'SELECT p2.post_status,count( * ) AS num_posts '; |
| 471 | 471 | $join = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID "; |
| 472 | 472 | $join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID "; |
| 473 | 473 | $where = "WHERE p.post_type = 'give_log' "; |
| 474 | - $where .= $wpdb->prepare( 'AND p.post_parent = %d} ', $search ); |
|
| 474 | + $where .= $wpdb->prepare('AND p.post_parent = %d} ', $search); |
|
| 475 | 475 | |
| 476 | - } elseif ( is_numeric( $args['s'] ) ) { |
|
| 476 | + } elseif (is_numeric($args['s'])) { |
|
| 477 | 477 | |
| 478 | - $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 479 | - $where .= $wpdb->prepare( " |
|
| 478 | + $join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)"; |
|
| 479 | + $where .= $wpdb->prepare(" |
|
| 480 | 480 | AND m.meta_key = '_give_payment_user_id' |
| 481 | 481 | AND m.meta_value = %d", |
| 482 | 482 | $args['s'] |
| 483 | 483 | ); |
| 484 | 484 | |
| 485 | 485 | } else { |
| 486 | - $search = $wpdb->esc_like( $args['s'] ); |
|
| 487 | - $search = '%' . $search . '%'; |
|
| 486 | + $search = $wpdb->esc_like($args['s']); |
|
| 487 | + $search = '%'.$search.'%'; |
|
| 488 | 488 | |
| 489 | - $where .= $wpdb->prepare( 'AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search ); |
|
| 489 | + $where .= $wpdb->prepare('AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search); |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) { |
|
| 493 | + if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) { |
|
| 494 | 494 | |
| 495 | - $where .= $wpdb->prepare( ' AND p.post_parent = %d', $args['form_id'] ); |
|
| 495 | + $where .= $wpdb->prepare(' AND p.post_parent = %d', $args['form_id']); |
|
| 496 | 496 | |
| 497 | 497 | } |
| 498 | 498 | // Limit payments count by date. |
| 499 | - if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) { |
|
| 499 | + if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) { |
|
| 500 | 500 | |
| 501 | - $date_parts = explode( '/', $args['start-date'] ); |
|
| 502 | - $month = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0; |
|
| 503 | - $day = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0; |
|
| 504 | - $year = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0; |
|
| 501 | + $date_parts = explode('/', $args['start-date']); |
|
| 502 | + $month = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0; |
|
| 503 | + $day = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0; |
|
| 504 | + $year = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0; |
|
| 505 | 505 | |
| 506 | - $is_date = checkdate( $month, $day, $year ); |
|
| 507 | - if ( false !== $is_date ) { |
|
| 506 | + $is_date = checkdate($month, $day, $year); |
|
| 507 | + if (false !== $is_date) { |
|
| 508 | 508 | |
| 509 | - $date = new DateTime( $args['start-date'] ); |
|
| 510 | - $where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) ); |
|
| 509 | + $date = new DateTime($args['start-date']); |
|
| 510 | + $where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d')); |
|
| 511 | 511 | |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | // Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class). |
| 515 | - if ( empty( $args['end-date'] ) ) { |
|
| 515 | + if (empty($args['end-date'])) { |
|
| 516 | 516 | $args['end-date'] = $args['start-date']; |
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if ( ! empty( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) { |
|
| 520 | + if ( ! empty($args['end-date']) && false !== strpos($args['end-date'], '/')) { |
|
| 521 | 521 | |
| 522 | - $date_parts = explode( '/', $args['end-date'] ); |
|
| 522 | + $date_parts = explode('/', $args['end-date']); |
|
| 523 | 523 | |
| 524 | - $month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0; |
|
| 525 | - $day = ! empty( $date_parts[1] ) ? $date_parts[1] : 0; |
|
| 526 | - $year = ! empty( $date_parts[2] ) ? $date_parts[2] : 0; |
|
| 524 | + $month = ! empty($date_parts[0]) ? $date_parts[0] : 0; |
|
| 525 | + $day = ! empty($date_parts[1]) ? $date_parts[1] : 0; |
|
| 526 | + $year = ! empty($date_parts[2]) ? $date_parts[2] : 0; |
|
| 527 | 527 | |
| 528 | - $is_date = checkdate( $month, $day, $year ); |
|
| 529 | - if ( false !== $is_date ) { |
|
| 528 | + $is_date = checkdate($month, $day, $year); |
|
| 529 | + if (false !== $is_date) { |
|
| 530 | 530 | |
| 531 | - $date = new DateTime( $args['end-date'] ); |
|
| 532 | - $where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) ); |
|
| 531 | + $date = new DateTime($args['end-date']); |
|
| 532 | + $where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d')); |
|
| 533 | 533 | |
| 534 | 534 | } |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - $where = apply_filters( 'give_count_payments_where', $where ); |
|
| 538 | - $join = apply_filters( 'give_count_payments_join', $join ); |
|
| 537 | + $where = apply_filters('give_count_payments_where', $where); |
|
| 538 | + $join = apply_filters('give_count_payments_join', $join); |
|
| 539 | 539 | |
| 540 | 540 | $query = "$select |
| 541 | 541 | FROM $wpdb->posts p |
@@ -544,36 +544,36 @@ discard block |
||
| 544 | 544 | GROUP BY p.post_status |
| 545 | 545 | "; |
| 546 | 546 | |
| 547 | - $cache_key = md5( $query ); |
|
| 547 | + $cache_key = md5($query); |
|
| 548 | 548 | |
| 549 | - $count = wp_cache_get( $cache_key, 'counts' ); |
|
| 550 | - if ( false !== $count ) { |
|
| 549 | + $count = wp_cache_get($cache_key, 'counts'); |
|
| 550 | + if (false !== $count) { |
|
| 551 | 551 | return $count; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - $count = $wpdb->get_results( $query, ARRAY_A ); |
|
| 554 | + $count = $wpdb->get_results($query, ARRAY_A); |
|
| 555 | 555 | |
| 556 | 556 | $stats = array(); |
| 557 | 557 | $statuses = get_post_stati(); |
| 558 | - if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) { |
|
| 559 | - unset( $statuses['private'] ); |
|
| 558 | + if (isset($statuses['private']) && empty($args['s'])) { |
|
| 559 | + unset($statuses['private']); |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - foreach ( $statuses as $state ) { |
|
| 563 | - $stats[ $state ] = 0; |
|
| 562 | + foreach ($statuses as $state) { |
|
| 563 | + $stats[$state] = 0; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - foreach ( (array) $count as $row ) { |
|
| 566 | + foreach ((array) $count as $row) { |
|
| 567 | 567 | |
| 568 | - if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) { |
|
| 568 | + if ('private' == $row['post_status'] && empty($args['s'])) { |
|
| 569 | 569 | continue; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - $stats[ $row['post_status'] ] = $row['num_posts']; |
|
| 572 | + $stats[$row['post_status']] = $row['num_posts']; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | $stats = (object) $stats; |
| 576 | - wp_cache_set( $cache_key, $stats, 'counts' ); |
|
| 576 | + wp_cache_set($cache_key, $stats, 'counts'); |
|
| 577 | 577 | |
| 578 | 578 | return $stats; |
| 579 | 579 | } |
@@ -588,11 +588,11 @@ discard block |
||
| 588 | 588 | * |
| 589 | 589 | * @return bool $exists True if payment exists, false otherwise. |
| 590 | 590 | */ |
| 591 | -function give_check_for_existing_payment( $payment_id ) { |
|
| 591 | +function give_check_for_existing_payment($payment_id) { |
|
| 592 | 592 | $exists = false; |
| 593 | - $payment = new Give_Payment( $payment_id ); |
|
| 593 | + $payment = new Give_Payment($payment_id); |
|
| 594 | 594 | |
| 595 | - if ( $payment_id === $payment->ID && 'publish' === $payment->status ) { |
|
| 595 | + if ($payment_id === $payment->ID && 'publish' === $payment->status) { |
|
| 596 | 596 | $exists = true; |
| 597 | 597 | } |
| 598 | 598 | |
@@ -610,31 +610,31 @@ discard block |
||
| 610 | 610 | * |
| 611 | 611 | * @return bool|mixed True if payment status exists, false otherwise. |
| 612 | 612 | */ |
| 613 | -function give_get_payment_status( $payment, $return_label = false ) { |
|
| 613 | +function give_get_payment_status($payment, $return_label = false) { |
|
| 614 | 614 | |
| 615 | - if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) { |
|
| 615 | + if ( ! is_object($payment) || ! isset($payment->post_status)) { |
|
| 616 | 616 | return false; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | $statuses = give_get_payment_statuses(); |
| 620 | 620 | |
| 621 | - if ( ! is_array( $statuses ) || empty( $statuses ) ) { |
|
| 621 | + if ( ! is_array($statuses) || empty($statuses)) { |
|
| 622 | 622 | return false; |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | // Get payment object if no already given. |
| 626 | - $payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID ); |
|
| 626 | + $payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID); |
|
| 627 | 627 | |
| 628 | - if ( array_key_exists( $payment->status, $statuses ) ) { |
|
| 629 | - if ( true === $return_label ) { |
|
| 628 | + if (array_key_exists($payment->status, $statuses)) { |
|
| 629 | + if (true === $return_label) { |
|
| 630 | 630 | // Return translated status label. |
| 631 | - return $statuses[ $payment->status ]; |
|
| 631 | + return $statuses[$payment->status]; |
|
| 632 | 632 | } else { |
| 633 | 633 | // Account that our 'publish' status is labeled 'Complete' |
| 634 | 634 | $post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status; |
| 635 | 635 | |
| 636 | 636 | // Make sure we're matching cases, since they matter |
| 637 | - return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) ); |
|
| 637 | + return array_search(strtolower($post_status), array_map('strtolower', $statuses)); |
|
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | |
@@ -650,17 +650,17 @@ discard block |
||
| 650 | 650 | */ |
| 651 | 651 | function give_get_payment_statuses() { |
| 652 | 652 | $payment_statuses = array( |
| 653 | - 'pending' => __( 'Pending', 'give' ), |
|
| 654 | - 'publish' => __( 'Complete', 'give' ), |
|
| 655 | - 'refunded' => __( 'Refunded', 'give' ), |
|
| 656 | - 'failed' => __( 'Failed', 'give' ), |
|
| 657 | - 'cancelled' => __( 'Cancelled', 'give' ), |
|
| 658 | - 'abandoned' => __( 'Abandoned', 'give' ), |
|
| 659 | - 'preapproval' => __( 'Pre-Approved', 'give' ), |
|
| 660 | - 'revoked' => __( 'Revoked', 'give' ), |
|
| 653 | + 'pending' => __('Pending', 'give'), |
|
| 654 | + 'publish' => __('Complete', 'give'), |
|
| 655 | + 'refunded' => __('Refunded', 'give'), |
|
| 656 | + 'failed' => __('Failed', 'give'), |
|
| 657 | + 'cancelled' => __('Cancelled', 'give'), |
|
| 658 | + 'abandoned' => __('Abandoned', 'give'), |
|
| 659 | + 'preapproval' => __('Pre-Approved', 'give'), |
|
| 660 | + 'revoked' => __('Revoked', 'give'), |
|
| 661 | 661 | ); |
| 662 | 662 | |
| 663 | - return apply_filters( 'give_payment_statuses', $payment_statuses ); |
|
| 663 | + return apply_filters('give_payment_statuses', $payment_statuses); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | /** |
@@ -673,10 +673,10 @@ discard block |
||
| 673 | 673 | * @return array $payment_status All the available payment statuses. |
| 674 | 674 | */ |
| 675 | 675 | function give_get_payment_status_keys() { |
| 676 | - $statuses = array_keys( give_get_payment_statuses() ); |
|
| 677 | - asort( $statuses ); |
|
| 676 | + $statuses = array_keys(give_get_payment_statuses()); |
|
| 677 | + asort($statuses); |
|
| 678 | 678 | |
| 679 | - return array_values( $statuses ); |
|
| 679 | + return array_values($statuses); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | * |
| 692 | 692 | * @return int $earnings Earnings |
| 693 | 693 | */ |
| 694 | -function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) { |
|
| 694 | +function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) { |
|
| 695 | 695 | |
| 696 | 696 | // This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead. |
| 697 | 697 | global $wpdb; |
@@ -701,41 +701,41 @@ discard block |
||
| 701 | 701 | 'nopaging' => true, |
| 702 | 702 | 'year' => $year, |
| 703 | 703 | 'monthnum' => $month_num, |
| 704 | - 'post_status' => array( 'publish' ), |
|
| 704 | + 'post_status' => array('publish'), |
|
| 705 | 705 | 'fields' => 'ids', |
| 706 | 706 | 'update_post_term_cache' => false, |
| 707 | 707 | ); |
| 708 | - if ( ! empty( $day ) ) { |
|
| 708 | + if ( ! empty($day)) { |
|
| 709 | 709 | $args['day'] = $day; |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - if ( ! empty( $hour ) ) { |
|
| 712 | + if ( ! empty($hour)) { |
|
| 713 | 713 | $args['hour'] = $hour; |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - $args = apply_filters( 'give_get_earnings_by_date_args', $args ); |
|
| 717 | - $key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 ); |
|
| 716 | + $args = apply_filters('give_get_earnings_by_date_args', $args); |
|
| 717 | + $key = 'give_stats_'.substr(md5(serialize($args)), 0, 15); |
|
| 718 | 718 | |
| 719 | - if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) { |
|
| 719 | + if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) { |
|
| 720 | 720 | $earnings = false; |
| 721 | 721 | } else { |
| 722 | - $earnings = get_transient( $key ); |
|
| 722 | + $earnings = get_transient($key); |
|
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - if ( false === $earnings ) { |
|
| 726 | - $sales = get_posts( $args ); |
|
| 725 | + if (false === $earnings) { |
|
| 726 | + $sales = get_posts($args); |
|
| 727 | 727 | $earnings = 0; |
| 728 | - if ( $sales ) { |
|
| 729 | - $sales = implode( ',', $sales ); |
|
| 728 | + if ($sales) { |
|
| 729 | + $sales = implode(',', $sales); |
|
| 730 | 730 | |
| 731 | - $earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" ); |
|
| 731 | + $earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})"); |
|
| 732 | 732 | |
| 733 | 733 | } |
| 734 | 734 | // Cache the results for one hour. |
| 735 | - set_transient( $key, $earnings, HOUR_IN_SECONDS ); |
|
| 735 | + set_transient($key, $earnings, HOUR_IN_SECONDS); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - return round( $earnings, 2 ); |
|
| 738 | + return round($earnings, 2); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | * |
| 751 | 751 | * @return int $count Sales |
| 752 | 752 | */ |
| 753 | -function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) { |
|
| 753 | +function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) { |
|
| 754 | 754 | |
| 755 | 755 | // This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead. |
| 756 | 756 | $args = array( |
@@ -758,14 +758,14 @@ discard block |
||
| 758 | 758 | 'nopaging' => true, |
| 759 | 759 | 'year' => $year, |
| 760 | 760 | 'fields' => 'ids', |
| 761 | - 'post_status' => array( 'publish' ), |
|
| 761 | + 'post_status' => array('publish'), |
|
| 762 | 762 | 'update_post_meta_cache' => false, |
| 763 | 763 | 'update_post_term_cache' => false, |
| 764 | 764 | ); |
| 765 | 765 | |
| 766 | - $show_free = apply_filters( 'give_sales_by_date_show_free', true, $args ); |
|
| 766 | + $show_free = apply_filters('give_sales_by_date_show_free', true, $args); |
|
| 767 | 767 | |
| 768 | - if ( false === $show_free ) { |
|
| 768 | + if (false === $show_free) { |
|
| 769 | 769 | $args['meta_query'] = array( |
| 770 | 770 | array( |
| 771 | 771 | 'key' => '_give_payment_total', |
@@ -776,33 +776,33 @@ discard block |
||
| 776 | 776 | ); |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | - if ( ! empty( $month_num ) ) { |
|
| 779 | + if ( ! empty($month_num)) { |
|
| 780 | 780 | $args['monthnum'] = $month_num; |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - if ( ! empty( $day ) ) { |
|
| 783 | + if ( ! empty($day)) { |
|
| 784 | 784 | $args['day'] = $day; |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | - if ( ! empty( $hour ) ) { |
|
| 787 | + if ( ! empty($hour)) { |
|
| 788 | 788 | $args['hour'] = $hour; |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - $args = apply_filters( 'give_get_sales_by_date_args', $args ); |
|
| 791 | + $args = apply_filters('give_get_sales_by_date_args', $args); |
|
| 792 | 792 | |
| 793 | - $key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 ); |
|
| 793 | + $key = 'give_stats_'.substr(md5(serialize($args)), 0, 15); |
|
| 794 | 794 | |
| 795 | - if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) { |
|
| 795 | + if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) { |
|
| 796 | 796 | $count = false; |
| 797 | 797 | } else { |
| 798 | - $count = get_transient( $key ); |
|
| 798 | + $count = get_transient($key); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - if ( false === $count ) { |
|
| 802 | - $sales = new WP_Query( $args ); |
|
| 801 | + if (false === $count) { |
|
| 802 | + $sales = new WP_Query($args); |
|
| 803 | 803 | $count = (int) $sales->post_count; |
| 804 | 804 | // Cache the results for one hour. |
| 805 | - set_transient( $key, $count, HOUR_IN_SECONDS ); |
|
| 805 | + set_transient($key, $count, HOUR_IN_SECONDS); |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | return $count; |
@@ -817,19 +817,19 @@ discard block |
||
| 817 | 817 | * |
| 818 | 818 | * @return bool $ret True if complete, false otherwise. |
| 819 | 819 | */ |
| 820 | -function give_is_payment_complete( $payment_id ) { |
|
| 821 | - $payment = new Give_Payment( $payment_id ); |
|
| 820 | +function give_is_payment_complete($payment_id) { |
|
| 821 | + $payment = new Give_Payment($payment_id); |
|
| 822 | 822 | |
| 823 | 823 | $ret = false; |
| 824 | 824 | |
| 825 | - if ( $payment->ID > 0 ) { |
|
| 825 | + if ($payment->ID > 0) { |
|
| 826 | 826 | |
| 827 | - if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) { |
|
| 827 | + if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) { |
|
| 828 | 828 | $ret = true; |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status ); |
|
| 832 | + return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status); |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | /** |
@@ -855,57 +855,57 @@ discard block |
||
| 855 | 855 | */ |
| 856 | 856 | function give_get_total_earnings() { |
| 857 | 857 | |
| 858 | - $total = get_option( 'give_earnings_total', false ); |
|
| 858 | + $total = get_option('give_earnings_total', false); |
|
| 859 | 859 | |
| 860 | 860 | // If no total stored in DB, use old method of calculating total earnings. |
| 861 | - if ( false === $total ) { |
|
| 861 | + if (false === $total) { |
|
| 862 | 862 | |
| 863 | 863 | global $wpdb; |
| 864 | 864 | |
| 865 | - $total = get_transient( 'give_earnings_total' ); |
|
| 865 | + $total = get_transient('give_earnings_total'); |
|
| 866 | 866 | |
| 867 | - if ( false === $total ) { |
|
| 867 | + if (false === $total) { |
|
| 868 | 868 | |
| 869 | 869 | $total = (float) 0; |
| 870 | 870 | |
| 871 | - $args = apply_filters( 'give_get_total_earnings_args', array( |
|
| 871 | + $args = apply_filters('give_get_total_earnings_args', array( |
|
| 872 | 872 | 'offset' => 0, |
| 873 | - 'number' => - 1, |
|
| 874 | - 'status' => array( 'publish' ), |
|
| 873 | + 'number' => -1, |
|
| 874 | + 'status' => array('publish'), |
|
| 875 | 875 | 'fields' => 'ids', |
| 876 | - ) ); |
|
| 876 | + )); |
|
| 877 | 877 | |
| 878 | - $payments = give_get_payments( $args ); |
|
| 879 | - if ( $payments ) { |
|
| 878 | + $payments = give_get_payments($args); |
|
| 879 | + if ($payments) { |
|
| 880 | 880 | |
| 881 | 881 | /** |
| 882 | 882 | * If performing a donation, we need to skip the very last payment in the database, |
| 883 | 883 | * since it calls give_increase_total_earnings() on completion, |
| 884 | 884 | * which results in duplicated earnings for the very first donation. |
| 885 | 885 | */ |
| 886 | - if ( did_action( 'give_update_payment_status' ) ) { |
|
| 887 | - array_pop( $payments ); |
|
| 886 | + if (did_action('give_update_payment_status')) { |
|
| 887 | + array_pop($payments); |
|
| 888 | 888 | } |
| 889 | 889 | |
| 890 | - if ( ! empty( $payments ) ) { |
|
| 891 | - $payments = implode( ',', $payments ); |
|
| 892 | - $total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" ); |
|
| 890 | + if ( ! empty($payments)) { |
|
| 891 | + $payments = implode(',', $payments); |
|
| 892 | + $total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})"); |
|
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | // Cache results for 1 day. This cache is cleared automatically when a payment is made. |
| 897 | - set_transient( 'give_earnings_total', $total, 86400 ); |
|
| 897 | + set_transient('give_earnings_total', $total, 86400); |
|
| 898 | 898 | |
| 899 | 899 | // Store the total for the first time. |
| 900 | - update_option( 'give_earnings_total', $total ); |
|
| 900 | + update_option('give_earnings_total', $total); |
|
| 901 | 901 | } |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | - if ( $total < 0 ) { |
|
| 904 | + if ($total < 0) { |
|
| 905 | 905 | $total = 0; // Don't ever show negative earnings. |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | - return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) ); |
|
| 908 | + return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter())); |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | /** |
@@ -918,10 +918,10 @@ discard block |
||
| 918 | 918 | * |
| 919 | 919 | * @return float $total Total earnings. |
| 920 | 920 | */ |
| 921 | -function give_increase_total_earnings( $amount = 0 ) { |
|
| 921 | +function give_increase_total_earnings($amount = 0) { |
|
| 922 | 922 | $total = give_get_total_earnings(); |
| 923 | 923 | $total += $amount; |
| 924 | - update_option( 'give_earnings_total', $total ); |
|
| 924 | + update_option('give_earnings_total', $total); |
|
| 925 | 925 | |
| 926 | 926 | return $total; |
| 927 | 927 | } |
@@ -935,13 +935,13 @@ discard block |
||
| 935 | 935 | * |
| 936 | 936 | * @return float $total Total earnings. |
| 937 | 937 | */ |
| 938 | -function give_decrease_total_earnings( $amount = 0 ) { |
|
| 938 | +function give_decrease_total_earnings($amount = 0) { |
|
| 939 | 939 | $total = give_get_total_earnings(); |
| 940 | 940 | $total -= $amount; |
| 941 | - if ( $total < 0 ) { |
|
| 941 | + if ($total < 0) { |
|
| 942 | 942 | $total = 0; |
| 943 | 943 | } |
| 944 | - update_option( 'give_earnings_total', $total ); |
|
| 944 | + update_option('give_earnings_total', $total); |
|
| 945 | 945 | |
| 946 | 946 | return $total; |
| 947 | 947 | } |
@@ -957,10 +957,10 @@ discard block |
||
| 957 | 957 | * |
| 958 | 958 | * @return mixed $meta Payment Meta. |
| 959 | 959 | */ |
| 960 | -function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) { |
|
| 961 | - $payment = new Give_Payment( $payment_id ); |
|
| 960 | +function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) { |
|
| 961 | + $payment = new Give_Payment($payment_id); |
|
| 962 | 962 | |
| 963 | - return $payment->get_meta( $meta_key, $single ); |
|
| 963 | + return $payment->get_meta($meta_key, $single); |
|
| 964 | 964 | } |
| 965 | 965 | |
| 966 | 966 | /** |
@@ -973,10 +973,10 @@ discard block |
||
| 973 | 973 | * |
| 974 | 974 | * @return mixed Meta ID if successful, false if unsuccessful. |
| 975 | 975 | */ |
| 976 | -function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
| 977 | - $payment = new Give_Payment( $payment_id ); |
|
| 976 | +function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') { |
|
| 977 | + $payment = new Give_Payment($payment_id); |
|
| 978 | 978 | |
| 979 | - return $payment->update_meta( $meta_key, $meta_value, $prev_value ); |
|
| 979 | + return $payment->update_meta($meta_key, $meta_value, $prev_value); |
|
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | /** |
@@ -988,8 +988,8 @@ discard block |
||
| 988 | 988 | * |
| 989 | 989 | * @return string $user_info User Info Meta Values. |
| 990 | 990 | */ |
| 991 | -function give_get_payment_meta_user_info( $payment_id ) { |
|
| 992 | - $payment = new Give_Payment( $payment_id ); |
|
| 991 | +function give_get_payment_meta_user_info($payment_id) { |
|
| 992 | + $payment = new Give_Payment($payment_id); |
|
| 993 | 993 | |
| 994 | 994 | return $payment->user_info; |
| 995 | 995 | } |
@@ -1005,8 +1005,8 @@ discard block |
||
| 1005 | 1005 | * |
| 1006 | 1006 | * @return int $form_id Form ID. |
| 1007 | 1007 | */ |
| 1008 | -function give_get_payment_form_id( $payment_id ) { |
|
| 1009 | - $payment = new Give_Payment( $payment_id ); |
|
| 1008 | +function give_get_payment_form_id($payment_id) { |
|
| 1009 | + $payment = new Give_Payment($payment_id); |
|
| 1010 | 1010 | |
| 1011 | 1011 | return $payment->form_id; |
| 1012 | 1012 | } |
@@ -1020,8 +1020,8 @@ discard block |
||
| 1020 | 1020 | * |
| 1021 | 1021 | * @return string $email User email. |
| 1022 | 1022 | */ |
| 1023 | -function give_get_payment_user_email( $payment_id ) { |
|
| 1024 | - $payment = new Give_Payment( $payment_id ); |
|
| 1023 | +function give_get_payment_user_email($payment_id) { |
|
| 1024 | + $payment = new Give_Payment($payment_id); |
|
| 1025 | 1025 | |
| 1026 | 1026 | return $payment->email; |
| 1027 | 1027 | } |
@@ -1035,11 +1035,11 @@ discard block |
||
| 1035 | 1035 | * |
| 1036 | 1036 | * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true) |
| 1037 | 1037 | */ |
| 1038 | -function give_is_guest_payment( $payment_id ) { |
|
| 1039 | - $payment_user_id = give_get_payment_user_id( $payment_id ); |
|
| 1040 | - $is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true; |
|
| 1038 | +function give_is_guest_payment($payment_id) { |
|
| 1039 | + $payment_user_id = give_get_payment_user_id($payment_id); |
|
| 1040 | + $is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true; |
|
| 1041 | 1041 | |
| 1042 | - return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id ); |
|
| 1042 | + return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | /** |
@@ -1051,8 +1051,8 @@ discard block |
||
| 1051 | 1051 | * |
| 1052 | 1052 | * @return int $user_id User ID. |
| 1053 | 1053 | */ |
| 1054 | -function give_get_payment_user_id( $payment_id ) { |
|
| 1055 | - $payment = new Give_Payment( $payment_id ); |
|
| 1054 | +function give_get_payment_user_id($payment_id) { |
|
| 1055 | + $payment = new Give_Payment($payment_id); |
|
| 1056 | 1056 | |
| 1057 | 1057 | return $payment->user_id; |
| 1058 | 1058 | } |
@@ -1066,8 +1066,8 @@ discard block |
||
| 1066 | 1066 | * |
| 1067 | 1067 | * @return int $customer_id Customer ID. |
| 1068 | 1068 | */ |
| 1069 | -function give_get_payment_customer_id( $payment_id ) { |
|
| 1070 | - $payment = new Give_Payment( $payment_id ); |
|
| 1069 | +function give_get_payment_customer_id($payment_id) { |
|
| 1070 | + $payment = new Give_Payment($payment_id); |
|
| 1071 | 1071 | |
| 1072 | 1072 | return $payment->customer_id; |
| 1073 | 1073 | } |
@@ -1081,8 +1081,8 @@ discard block |
||
| 1081 | 1081 | * |
| 1082 | 1082 | * @return string $ip User IP. |
| 1083 | 1083 | */ |
| 1084 | -function give_get_payment_user_ip( $payment_id ) { |
|
| 1085 | - $payment = new Give_Payment( $payment_id ); |
|
| 1084 | +function give_get_payment_user_ip($payment_id) { |
|
| 1085 | + $payment = new Give_Payment($payment_id); |
|
| 1086 | 1086 | |
| 1087 | 1087 | return $payment->ip; |
| 1088 | 1088 | } |
@@ -1096,8 +1096,8 @@ discard block |
||
| 1096 | 1096 | * |
| 1097 | 1097 | * @return string $date The date the payment was completed. |
| 1098 | 1098 | */ |
| 1099 | -function give_get_payment_completed_date( $payment_id = 0 ) { |
|
| 1100 | - $payment = new Give_Payment( $payment_id ); |
|
| 1099 | +function give_get_payment_completed_date($payment_id = 0) { |
|
| 1100 | + $payment = new Give_Payment($payment_id); |
|
| 1101 | 1101 | |
| 1102 | 1102 | return $payment->completed_date; |
| 1103 | 1103 | } |
@@ -1111,8 +1111,8 @@ discard block |
||
| 1111 | 1111 | * |
| 1112 | 1112 | * @return string $gateway Gateway. |
| 1113 | 1113 | */ |
| 1114 | -function give_get_payment_gateway( $payment_id ) { |
|
| 1115 | - $payment = new Give_Payment( $payment_id ); |
|
| 1114 | +function give_get_payment_gateway($payment_id) { |
|
| 1115 | + $payment = new Give_Payment($payment_id); |
|
| 1116 | 1116 | |
| 1117 | 1117 | return $payment->gateway; |
| 1118 | 1118 | } |
@@ -1126,8 +1126,8 @@ discard block |
||
| 1126 | 1126 | * |
| 1127 | 1127 | * @return string $currency The currency code. |
| 1128 | 1128 | */ |
| 1129 | -function give_get_payment_currency_code( $payment_id = 0 ) { |
|
| 1130 | - $payment = new Give_Payment( $payment_id ); |
|
| 1129 | +function give_get_payment_currency_code($payment_id = 0) { |
|
| 1130 | + $payment = new Give_Payment($payment_id); |
|
| 1131 | 1131 | |
| 1132 | 1132 | return $payment->currency; |
| 1133 | 1133 | } |
@@ -1141,10 +1141,10 @@ discard block |
||
| 1141 | 1141 | * |
| 1142 | 1142 | * @return string $currency The currency name. |
| 1143 | 1143 | */ |
| 1144 | -function give_get_payment_currency( $payment_id = 0 ) { |
|
| 1145 | - $currency = give_get_payment_currency_code( $payment_id ); |
|
| 1144 | +function give_get_payment_currency($payment_id = 0) { |
|
| 1145 | + $currency = give_get_payment_currency_code($payment_id); |
|
| 1146 | 1146 | |
| 1147 | - return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id ); |
|
| 1147 | + return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id); |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
@@ -1156,8 +1156,8 @@ discard block |
||
| 1156 | 1156 | * |
| 1157 | 1157 | * @return string $key Donation key. |
| 1158 | 1158 | */ |
| 1159 | -function give_get_payment_key( $payment_id = 0 ) { |
|
| 1160 | - $payment = new Give_Payment( $payment_id ); |
|
| 1159 | +function give_get_payment_key($payment_id = 0) { |
|
| 1160 | + $payment = new Give_Payment($payment_id); |
|
| 1161 | 1161 | |
| 1162 | 1162 | return $payment->key; |
| 1163 | 1163 | } |
@@ -1173,8 +1173,8 @@ discard block |
||
| 1173 | 1173 | * |
| 1174 | 1174 | * @return string $number Payment order number. |
| 1175 | 1175 | */ |
| 1176 | -function give_get_payment_number( $payment_id = 0 ) { |
|
| 1177 | - $payment = new Give_Payment( $payment_id ); |
|
| 1176 | +function give_get_payment_number($payment_id = 0) { |
|
| 1177 | + $payment = new Give_Payment($payment_id); |
|
| 1178 | 1178 | |
| 1179 | 1179 | return $payment->number; |
| 1180 | 1180 | } |
@@ -1188,23 +1188,23 @@ discard block |
||
| 1188 | 1188 | * |
| 1189 | 1189 | * @return string The formatted payment number. |
| 1190 | 1190 | */ |
| 1191 | -function give_format_payment_number( $number ) { |
|
| 1191 | +function give_format_payment_number($number) { |
|
| 1192 | 1192 | |
| 1193 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 1193 | + if ( ! give_get_option('enable_sequential')) { |
|
| 1194 | 1194 | return $number; |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | - if ( ! is_numeric( $number ) ) { |
|
| 1197 | + if ( ! is_numeric($number)) { |
|
| 1198 | 1198 | return $number; |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | - $prefix = give_get_option( 'sequential_prefix' ); |
|
| 1202 | - $number = absint( $number ); |
|
| 1203 | - $postfix = give_get_option( 'sequential_postfix' ); |
|
| 1201 | + $prefix = give_get_option('sequential_prefix'); |
|
| 1202 | + $number = absint($number); |
|
| 1203 | + $postfix = give_get_option('sequential_postfix'); |
|
| 1204 | 1204 | |
| 1205 | - $formatted_number = $prefix . $number . $postfix; |
|
| 1205 | + $formatted_number = $prefix.$number.$postfix; |
|
| 1206 | 1206 | |
| 1207 | - return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix ); |
|
| 1207 | + return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix); |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
@@ -1217,17 +1217,17 @@ discard block |
||
| 1217 | 1217 | */ |
| 1218 | 1218 | function give_get_next_payment_number() { |
| 1219 | 1219 | |
| 1220 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
| 1220 | + if ( ! give_get_option('enable_sequential')) { |
|
| 1221 | 1221 | return false; |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - $number = get_option( 'give_last_payment_number' ); |
|
| 1225 | - $start = give_get_option( 'sequential_start', 1 ); |
|
| 1224 | + $number = get_option('give_last_payment_number'); |
|
| 1225 | + $start = give_get_option('sequential_start', 1); |
|
| 1226 | 1226 | $increment_number = true; |
| 1227 | 1227 | |
| 1228 | - if ( false !== $number ) { |
|
| 1228 | + if (false !== $number) { |
|
| 1229 | 1229 | |
| 1230 | - if ( empty( $number ) ) { |
|
| 1230 | + if (empty($number)) { |
|
| 1231 | 1231 | |
| 1232 | 1232 | $number = $start; |
| 1233 | 1233 | $increment_number = false; |
@@ -1236,24 +1236,24 @@ discard block |
||
| 1236 | 1236 | } else { |
| 1237 | 1237 | |
| 1238 | 1238 | // This case handles the first addition of the new option, as well as if it get's deleted for any reason. |
| 1239 | - $payments = new Give_Payments_Query( array( |
|
| 1239 | + $payments = new Give_Payments_Query(array( |
|
| 1240 | 1240 | 'number' => 1, |
| 1241 | 1241 | 'order' => 'DESC', |
| 1242 | 1242 | 'orderby' => 'ID', |
| 1243 | 1243 | 'output' => 'posts', |
| 1244 | 1244 | 'fields' => 'ids', |
| 1245 | - ) ); |
|
| 1245 | + )); |
|
| 1246 | 1246 | $last_payment = $payments->get_payments(); |
| 1247 | 1247 | |
| 1248 | - if ( ! empty( $last_payment ) ) { |
|
| 1248 | + if ( ! empty($last_payment)) { |
|
| 1249 | 1249 | |
| 1250 | - $number = give_get_payment_number( $last_payment[0] ); |
|
| 1250 | + $number = give_get_payment_number($last_payment[0]); |
|
| 1251 | 1251 | |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | - if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) { |
|
| 1254 | + if ( ! empty($number) && $number !== (int) $last_payment[0]) { |
|
| 1255 | 1255 | |
| 1256 | - $number = give_remove_payment_prefix_postfix( $number ); |
|
| 1256 | + $number = give_remove_payment_prefix_postfix($number); |
|
| 1257 | 1257 | |
| 1258 | 1258 | } else { |
| 1259 | 1259 | |
@@ -1262,13 +1262,13 @@ discard block |
||
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | - $increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number ); |
|
| 1265 | + $increment_number = apply_filters('give_increment_payment_number', $increment_number, $number); |
|
| 1266 | 1266 | |
| 1267 | - if ( $increment_number ) { |
|
| 1268 | - $number ++; |
|
| 1267 | + if ($increment_number) { |
|
| 1268 | + $number++; |
|
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | - return apply_filters( 'give_get_next_payment_number', $number ); |
|
| 1271 | + return apply_filters('give_get_next_payment_number', $number); |
|
| 1272 | 1272 | } |
| 1273 | 1273 | |
| 1274 | 1274 | /** |
@@ -1280,25 +1280,25 @@ discard block |
||
| 1280 | 1280 | * |
| 1281 | 1281 | * @return string The new Payment number without prefix and postfix. |
| 1282 | 1282 | */ |
| 1283 | -function give_remove_payment_prefix_postfix( $number ) { |
|
| 1283 | +function give_remove_payment_prefix_postfix($number) { |
|
| 1284 | 1284 | |
| 1285 | - $prefix = give_get_option( 'sequential_prefix' ); |
|
| 1286 | - $postfix = give_get_option( 'sequential_postfix' ); |
|
| 1285 | + $prefix = give_get_option('sequential_prefix'); |
|
| 1286 | + $postfix = give_get_option('sequential_postfix'); |
|
| 1287 | 1287 | |
| 1288 | 1288 | // Remove prefix. |
| 1289 | - $number = preg_replace( '/' . $prefix . '/', '', $number, 1 ); |
|
| 1289 | + $number = preg_replace('/'.$prefix.'/', '', $number, 1); |
|
| 1290 | 1290 | |
| 1291 | 1291 | // Remove the postfix. |
| 1292 | - $length = strlen( $number ); |
|
| 1293 | - $postfix_pos = strrpos( $number, $postfix ); |
|
| 1294 | - if ( false !== $postfix_pos ) { |
|
| 1295 | - $number = substr_replace( $number, '', $postfix_pos, $length ); |
|
| 1292 | + $length = strlen($number); |
|
| 1293 | + $postfix_pos = strrpos($number, $postfix); |
|
| 1294 | + if (false !== $postfix_pos) { |
|
| 1295 | + $number = substr_replace($number, '', $postfix_pos, $length); |
|
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | 1298 | // Ensure it's a whole number. |
| 1299 | - $number = intval( $number ); |
|
| 1299 | + $number = intval($number); |
|
| 1300 | 1300 | |
| 1301 | - return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix ); |
|
| 1301 | + return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix); |
|
| 1302 | 1302 | |
| 1303 | 1303 | } |
| 1304 | 1304 | |
@@ -1315,10 +1315,10 @@ discard block |
||
| 1315 | 1315 | * |
| 1316 | 1316 | * @return string $amount Fully formatted payment amount. |
| 1317 | 1317 | */ |
| 1318 | -function give_payment_amount( $payment_id = 0 ) { |
|
| 1319 | - $amount = give_get_payment_amount( $payment_id ); |
|
| 1318 | +function give_payment_amount($payment_id = 0) { |
|
| 1319 | + $amount = give_get_payment_amount($payment_id); |
|
| 1320 | 1320 | |
| 1321 | - return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) ); |
|
| 1321 | + return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id)); |
|
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | /** |
@@ -1331,11 +1331,11 @@ discard block |
||
| 1331 | 1331 | * |
| 1332 | 1332 | * @return mixed|void |
| 1333 | 1333 | */ |
| 1334 | -function give_get_payment_amount( $payment_id ) { |
|
| 1334 | +function give_get_payment_amount($payment_id) { |
|
| 1335 | 1335 | |
| 1336 | - $payment = new Give_Payment( $payment_id ); |
|
| 1336 | + $payment = new Give_Payment($payment_id); |
|
| 1337 | 1337 | |
| 1338 | - return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id ); |
|
| 1338 | + return apply_filters('give_payment_amount', floatval($payment->total), $payment_id); |
|
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | /** |
@@ -1352,10 +1352,10 @@ discard block |
||
| 1352 | 1352 | * |
| 1353 | 1353 | * @return array Fully formatted payment subtotal. |
| 1354 | 1354 | */ |
| 1355 | -function give_payment_subtotal( $payment_id = 0 ) { |
|
| 1356 | - $subtotal = give_get_payment_subtotal( $payment_id ); |
|
| 1355 | +function give_payment_subtotal($payment_id = 0) { |
|
| 1356 | + $subtotal = give_get_payment_subtotal($payment_id); |
|
| 1357 | 1357 | |
| 1358 | - return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) ); |
|
| 1358 | + return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id)); |
|
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | /** |
@@ -1369,8 +1369,8 @@ discard block |
||
| 1369 | 1369 | * |
| 1370 | 1370 | * @return float $subtotal Subtotal for payment (non formatted). |
| 1371 | 1371 | */ |
| 1372 | -function give_get_payment_subtotal( $payment_id = 0 ) { |
|
| 1373 | - $payment = new G_Payment( $payment_id ); |
|
| 1372 | +function give_get_payment_subtotal($payment_id = 0) { |
|
| 1373 | + $payment = new G_Payment($payment_id); |
|
| 1374 | 1374 | |
| 1375 | 1375 | return $payment->subtotal; |
| 1376 | 1376 | } |
@@ -1385,10 +1385,10 @@ discard block |
||
| 1385 | 1385 | * |
| 1386 | 1386 | * @return mixed array if payment fees found, false otherwise. |
| 1387 | 1387 | */ |
| 1388 | -function give_get_payment_fees( $payment_id = 0, $type = 'all' ) { |
|
| 1389 | - $payment = new Give_Payment( $payment_id ); |
|
| 1388 | +function give_get_payment_fees($payment_id = 0, $type = 'all') { |
|
| 1389 | + $payment = new Give_Payment($payment_id); |
|
| 1390 | 1390 | |
| 1391 | - return $payment->get_fees( $type ); |
|
| 1391 | + return $payment->get_fees($type); |
|
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | /** |
@@ -1400,8 +1400,8 @@ discard block |
||
| 1400 | 1400 | * |
| 1401 | 1401 | * @return string The donation ID. |
| 1402 | 1402 | */ |
| 1403 | -function give_get_payment_transaction_id( $payment_id = 0 ) { |
|
| 1404 | - $payment = new Give_Payment( $payment_id ); |
|
| 1403 | +function give_get_payment_transaction_id($payment_id = 0) { |
|
| 1404 | + $payment = new Give_Payment($payment_id); |
|
| 1405 | 1405 | |
| 1406 | 1406 | return $payment->transaction_id; |
| 1407 | 1407 | } |
@@ -1416,15 +1416,15 @@ discard block |
||
| 1416 | 1416 | * |
| 1417 | 1417 | * @return bool|mixed |
| 1418 | 1418 | */ |
| 1419 | -function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) { |
|
| 1419 | +function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') { |
|
| 1420 | 1420 | |
| 1421 | - if ( empty( $payment_id ) || empty( $transaction_id ) ) { |
|
| 1421 | + if (empty($payment_id) || empty($transaction_id)) { |
|
| 1422 | 1422 | return false; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | - $transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
| 1425 | + $transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id); |
|
| 1426 | 1426 | |
| 1427 | - return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id ); |
|
| 1427 | + return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id); |
|
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | /** |
@@ -1437,12 +1437,12 @@ discard block |
||
| 1437 | 1437 | * |
| 1438 | 1438 | * @return int $purchase Donation ID. |
| 1439 | 1439 | */ |
| 1440 | -function give_get_purchase_id_by_key( $key ) { |
|
| 1440 | +function give_get_purchase_id_by_key($key) { |
|
| 1441 | 1441 | global $wpdb; |
| 1442 | 1442 | |
| 1443 | - $purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) ); |
|
| 1443 | + $purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key)); |
|
| 1444 | 1444 | |
| 1445 | - if ( $purchase != null ) { |
|
| 1445 | + if ($purchase != null) { |
|
| 1446 | 1446 | return $purchase; |
| 1447 | 1447 | } |
| 1448 | 1448 | |
@@ -1460,12 +1460,12 @@ discard block |
||
| 1460 | 1460 | * |
| 1461 | 1461 | * @return int $purchase Donation ID. |
| 1462 | 1462 | */ |
| 1463 | -function give_get_purchase_id_by_transaction_id( $key ) { |
|
| 1463 | +function give_get_purchase_id_by_transaction_id($key) { |
|
| 1464 | 1464 | global $wpdb; |
| 1465 | 1465 | |
| 1466 | - $purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) ); |
|
| 1466 | + $purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key)); |
|
| 1467 | 1467 | |
| 1468 | - if ( $purchase != null ) { |
|
| 1468 | + if ($purchase != null) { |
|
| 1469 | 1469 | return $purchase; |
| 1470 | 1470 | } |
| 1471 | 1471 | |
@@ -1482,19 +1482,19 @@ discard block |
||
| 1482 | 1482 | * |
| 1483 | 1483 | * @return array $notes Donation Notes |
| 1484 | 1484 | */ |
| 1485 | -function give_get_payment_notes( $payment_id = 0, $search = '' ) { |
|
| 1485 | +function give_get_payment_notes($payment_id = 0, $search = '') { |
|
| 1486 | 1486 | |
| 1487 | - if ( empty( $payment_id ) && empty( $search ) ) { |
|
| 1487 | + if (empty($payment_id) && empty($search)) { |
|
| 1488 | 1488 | return false; |
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | - remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
| 1492 | - remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 ); |
|
| 1491 | + remove_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
| 1492 | + remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10); |
|
| 1493 | 1493 | |
| 1494 | - $notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) ); |
|
| 1494 | + $notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search)); |
|
| 1495 | 1495 | |
| 1496 | - add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
| 1497 | - add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 ); |
|
| 1496 | + add_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
| 1497 | + add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2); |
|
| 1498 | 1498 | |
| 1499 | 1499 | return $notes; |
| 1500 | 1500 | } |
@@ -1510,8 +1510,8 @@ discard block |
||
| 1510 | 1510 | * |
| 1511 | 1511 | * @return int The new note ID |
| 1512 | 1512 | */ |
| 1513 | -function give_insert_payment_note( $payment_id = 0, $note = '' ) { |
|
| 1514 | - if ( empty( $payment_id ) ) { |
|
| 1513 | +function give_insert_payment_note($payment_id = 0, $note = '') { |
|
| 1514 | + if (empty($payment_id)) { |
|
| 1515 | 1515 | return false; |
| 1516 | 1516 | } |
| 1517 | 1517 | |
@@ -1523,14 +1523,14 @@ discard block |
||
| 1523 | 1523 | * @param int $payment_id Payment ID. |
| 1524 | 1524 | * @param string $note The note. |
| 1525 | 1525 | */ |
| 1526 | - do_action( 'give_pre_insert_payment_note', $payment_id, $note ); |
|
| 1526 | + do_action('give_pre_insert_payment_note', $payment_id, $note); |
|
| 1527 | 1527 | |
| 1528 | - $note_id = wp_insert_comment( wp_filter_comment( array( |
|
| 1528 | + $note_id = wp_insert_comment(wp_filter_comment(array( |
|
| 1529 | 1529 | 'comment_post_ID' => $payment_id, |
| 1530 | 1530 | 'comment_content' => $note, |
| 1531 | 1531 | 'user_id' => is_admin() ? get_current_user_id() : 0, |
| 1532 | - 'comment_date' => current_time( 'mysql' ), |
|
| 1533 | - 'comment_date_gmt' => current_time( 'mysql', 1 ), |
|
| 1532 | + 'comment_date' => current_time('mysql'), |
|
| 1533 | + 'comment_date_gmt' => current_time('mysql', 1), |
|
| 1534 | 1534 | 'comment_approved' => 1, |
| 1535 | 1535 | 'comment_parent' => 0, |
| 1536 | 1536 | 'comment_author' => '', |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | 'comment_author_email' => '', |
| 1540 | 1540 | 'comment_type' => 'give_payment_note', |
| 1541 | 1541 | |
| 1542 | - ) ) ); |
|
| 1542 | + ))); |
|
| 1543 | 1543 | |
| 1544 | 1544 | /** |
| 1545 | 1545 | * Fires after payment note inserted. |
@@ -1550,7 +1550,7 @@ discard block |
||
| 1550 | 1550 | * @param int $payment_id Payment ID. |
| 1551 | 1551 | * @param string $note The note. |
| 1552 | 1552 | */ |
| 1553 | - do_action( 'give_insert_payment_note', $note_id, $payment_id, $note ); |
|
| 1553 | + do_action('give_insert_payment_note', $note_id, $payment_id, $note); |
|
| 1554 | 1554 | |
| 1555 | 1555 | return $note_id; |
| 1556 | 1556 | } |
@@ -1565,8 +1565,8 @@ discard block |
||
| 1565 | 1565 | * |
| 1566 | 1566 | * @return bool True on success, false otherwise. |
| 1567 | 1567 | */ |
| 1568 | -function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) { |
|
| 1569 | - if ( empty( $comment_id ) ) { |
|
| 1568 | +function give_delete_payment_note($comment_id = 0, $payment_id = 0) { |
|
| 1569 | + if (empty($comment_id)) { |
|
| 1570 | 1570 | return false; |
| 1571 | 1571 | } |
| 1572 | 1572 | |
@@ -1578,9 +1578,9 @@ discard block |
||
| 1578 | 1578 | * @param int $comment_id Note ID. |
| 1579 | 1579 | * @param int $payment_id Payment ID. |
| 1580 | 1580 | */ |
| 1581 | - do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id ); |
|
| 1581 | + do_action('give_pre_delete_payment_note', $comment_id, $payment_id); |
|
| 1582 | 1582 | |
| 1583 | - $ret = wp_delete_comment( $comment_id, true ); |
|
| 1583 | + $ret = wp_delete_comment($comment_id, true); |
|
| 1584 | 1584 | |
| 1585 | 1585 | /** |
| 1586 | 1586 | * Fires after donation note deleted. |
@@ -1590,7 +1590,7 @@ discard block |
||
| 1590 | 1590 | * @param int $comment_id Note ID. |
| 1591 | 1591 | * @param int $payment_id Payment ID. |
| 1592 | 1592 | */ |
| 1593 | - do_action( 'give_post_delete_payment_note', $comment_id, $payment_id ); |
|
| 1593 | + do_action('give_post_delete_payment_note', $comment_id, $payment_id); |
|
| 1594 | 1594 | |
| 1595 | 1595 | return $ret; |
| 1596 | 1596 | } |
@@ -1605,34 +1605,34 @@ discard block |
||
| 1605 | 1605 | * |
| 1606 | 1606 | * @return string |
| 1607 | 1607 | */ |
| 1608 | -function give_get_payment_note_html( $note, $payment_id = 0 ) { |
|
| 1608 | +function give_get_payment_note_html($note, $payment_id = 0) { |
|
| 1609 | 1609 | |
| 1610 | - if ( is_numeric( $note ) ) { |
|
| 1611 | - $note = get_comment( $note ); |
|
| 1610 | + if (is_numeric($note)) { |
|
| 1611 | + $note = get_comment($note); |
|
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | - if ( ! empty( $note->user_id ) ) { |
|
| 1615 | - $user = get_userdata( $note->user_id ); |
|
| 1614 | + if ( ! empty($note->user_id)) { |
|
| 1615 | + $user = get_userdata($note->user_id); |
|
| 1616 | 1616 | $user = $user->display_name; |
| 1617 | 1617 | } else { |
| 1618 | - $user = esc_html__( 'System', 'give' ); |
|
| 1618 | + $user = esc_html__('System', 'give'); |
|
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | - $date_format = give_date_format() . ', ' . get_option( 'time_format' ); |
|
| 1621 | + $date_format = give_date_format().', '.get_option('time_format'); |
|
| 1622 | 1622 | |
| 1623 | - $delete_note_url = wp_nonce_url( add_query_arg( array( |
|
| 1623 | + $delete_note_url = wp_nonce_url(add_query_arg(array( |
|
| 1624 | 1624 | 'give-action' => 'delete_payment_note', |
| 1625 | 1625 | 'note_id' => $note->comment_ID, |
| 1626 | 1626 | 'payment_id' => $payment_id, |
| 1627 | - ) ), |
|
| 1628 | - 'give_delete_payment_note_' . $note->comment_ID |
|
| 1627 | + )), |
|
| 1628 | + 'give_delete_payment_note_'.$note->comment_ID |
|
| 1629 | 1629 | ); |
| 1630 | 1630 | |
| 1631 | - $note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">'; |
|
| 1631 | + $note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">'; |
|
| 1632 | 1632 | $note_html .= '<p>'; |
| 1633 | - $note_html .= '<strong>' . $user . '</strong> – <span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>'; |
|
| 1633 | + $note_html .= '<strong>'.$user.'</strong> – <span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>'; |
|
| 1634 | 1634 | $note_html .= $note->comment_content; |
| 1635 | - $note_html .= ' – <a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . esc_attr__( 'Delete this donation note.', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
| 1635 | + $note_html .= ' – <a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.esc_attr__('Delete this donation note.', 'give').'">'.esc_html__('Delete', 'give').'</a>'; |
|
| 1636 | 1636 | $note_html .= '</p>'; |
| 1637 | 1637 | $note_html .= '</div>'; |
| 1638 | 1638 | |
@@ -1650,18 +1650,18 @@ discard block |
||
| 1650 | 1650 | * |
| 1651 | 1651 | * @return void |
| 1652 | 1652 | */ |
| 1653 | -function give_hide_payment_notes( $query ) { |
|
| 1654 | - if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) { |
|
| 1655 | - $types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array(); |
|
| 1656 | - if ( ! is_array( $types ) ) { |
|
| 1657 | - $types = array( $types ); |
|
| 1653 | +function give_hide_payment_notes($query) { |
|
| 1654 | + if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) { |
|
| 1655 | + $types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array(); |
|
| 1656 | + if ( ! is_array($types)) { |
|
| 1657 | + $types = array($types); |
|
| 1658 | 1658 | } |
| 1659 | 1659 | $types[] = 'give_payment_note'; |
| 1660 | 1660 | $query->query_vars['type__not_in'] = $types; |
| 1661 | 1661 | } |
| 1662 | 1662 | } |
| 1663 | 1663 | |
| 1664 | -add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 ); |
|
| 1664 | +add_action('pre_get_comments', 'give_hide_payment_notes', 10); |
|
| 1665 | 1665 | |
| 1666 | 1666 | /** |
| 1667 | 1667 | * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets |
@@ -1673,15 +1673,15 @@ discard block |
||
| 1673 | 1673 | * |
| 1674 | 1674 | * @return array $clauses Updated comment clauses. |
| 1675 | 1675 | */ |
| 1676 | -function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) { |
|
| 1677 | - if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) { |
|
| 1676 | +function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) { |
|
| 1677 | + if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) { |
|
| 1678 | 1678 | $clauses['where'] .= ' AND comment_type != "give_payment_note"'; |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | 1681 | return $clauses; |
| 1682 | 1682 | } |
| 1683 | 1683 | |
| 1684 | -add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 ); |
|
| 1684 | +add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2); |
|
| 1685 | 1685 | |
| 1686 | 1686 | |
| 1687 | 1687 | /** |
@@ -1694,15 +1694,15 @@ discard block |
||
| 1694 | 1694 | * |
| 1695 | 1695 | * @return string $where |
| 1696 | 1696 | */ |
| 1697 | -function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) { |
|
| 1697 | +function give_hide_payment_notes_from_feeds($where, $wp_comment_query) { |
|
| 1698 | 1698 | global $wpdb; |
| 1699 | 1699 | |
| 1700 | - $where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' ); |
|
| 1700 | + $where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note'); |
|
| 1701 | 1701 | |
| 1702 | 1702 | return $where; |
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | -add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 ); |
|
| 1705 | +add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2); |
|
| 1706 | 1706 | |
| 1707 | 1707 | |
| 1708 | 1708 | /** |
@@ -1716,32 +1716,32 @@ discard block |
||
| 1716 | 1716 | * |
| 1717 | 1717 | * @return array Array of comment counts. |
| 1718 | 1718 | */ |
| 1719 | -function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) { |
|
| 1719 | +function give_remove_payment_notes_in_comment_counts($stats, $post_id) { |
|
| 1720 | 1720 | global $wpdb, $pagenow; |
| 1721 | 1721 | |
| 1722 | - if ( 'index.php' != $pagenow ) { |
|
| 1722 | + if ('index.php' != $pagenow) { |
|
| 1723 | 1723 | return $stats; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | 1726 | $post_id = (int) $post_id; |
| 1727 | 1727 | |
| 1728 | - if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) { |
|
| 1728 | + if (apply_filters('give_count_payment_notes_in_comments', false)) { |
|
| 1729 | 1729 | return $stats; |
| 1730 | 1730 | } |
| 1731 | 1731 | |
| 1732 | - $stats = wp_cache_get( "comments-{$post_id}", 'counts' ); |
|
| 1732 | + $stats = wp_cache_get("comments-{$post_id}", 'counts'); |
|
| 1733 | 1733 | |
| 1734 | - if ( false !== $stats ) { |
|
| 1734 | + if (false !== $stats) { |
|
| 1735 | 1735 | return $stats; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | 1738 | $where = 'WHERE comment_type != "give_payment_note"'; |
| 1739 | 1739 | |
| 1740 | - if ( $post_id > 0 ) { |
|
| 1741 | - $where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id ); |
|
| 1740 | + if ($post_id > 0) { |
|
| 1741 | + $where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id); |
|
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | - $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); |
|
| 1744 | + $count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A); |
|
| 1745 | 1745 | |
| 1746 | 1746 | $total = 0; |
| 1747 | 1747 | $approved = array( |
@@ -1751,30 +1751,30 @@ discard block |
||
| 1751 | 1751 | 'trash' => 'trash', |
| 1752 | 1752 | 'post-trashed' => 'post-trashed', |
| 1753 | 1753 | ); |
| 1754 | - foreach ( (array) $count as $row ) { |
|
| 1754 | + foreach ((array) $count as $row) { |
|
| 1755 | 1755 | // Don't count post-trashed toward totals. |
| 1756 | - if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) { |
|
| 1756 | + if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) { |
|
| 1757 | 1757 | $total += $row['num_comments']; |
| 1758 | 1758 | } |
| 1759 | - if ( isset( $approved[ $row['comment_approved'] ] ) ) { |
|
| 1760 | - $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; |
|
| 1759 | + if (isset($approved[$row['comment_approved']])) { |
|
| 1760 | + $stats[$approved[$row['comment_approved']]] = $row['num_comments']; |
|
| 1761 | 1761 | } |
| 1762 | 1762 | } |
| 1763 | 1763 | |
| 1764 | 1764 | $stats['total_comments'] = $total; |
| 1765 | - foreach ( $approved as $key ) { |
|
| 1766 | - if ( empty( $stats[ $key ] ) ) { |
|
| 1767 | - $stats[ $key ] = 0; |
|
| 1765 | + foreach ($approved as $key) { |
|
| 1766 | + if (empty($stats[$key])) { |
|
| 1767 | + $stats[$key] = 0; |
|
| 1768 | 1768 | } |
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | 1771 | $stats = (object) $stats; |
| 1772 | - wp_cache_set( "comments-{$post_id}", $stats, 'counts' ); |
|
| 1772 | + wp_cache_set("comments-{$post_id}", $stats, 'counts'); |
|
| 1773 | 1773 | |
| 1774 | 1774 | return $stats; |
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | -add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 ); |
|
| 1777 | +add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2); |
|
| 1778 | 1778 | |
| 1779 | 1779 | |
| 1780 | 1780 | /** |
@@ -1787,9 +1787,9 @@ discard block |
||
| 1787 | 1787 | * |
| 1788 | 1788 | * @return string $where Modified where clause. |
| 1789 | 1789 | */ |
| 1790 | -function give_filter_where_older_than_week( $where = '' ) { |
|
| 1790 | +function give_filter_where_older_than_week($where = '') { |
|
| 1791 | 1791 | // Payments older than one week. |
| 1792 | - $start = date( 'Y-m-d', strtotime( '-7 days' ) ); |
|
| 1792 | + $start = date('Y-m-d', strtotime('-7 days')); |
|
| 1793 | 1793 | $where .= " AND post_date <= '{$start}'"; |
| 1794 | 1794 | |
| 1795 | 1795 | return $where; |
@@ -1809,38 +1809,38 @@ discard block |
||
| 1809 | 1809 | * |
| 1810 | 1810 | * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title. |
| 1811 | 1811 | */ |
| 1812 | -function give_get_payment_form_title( $payment_meta, $only_level = false, $separator = '' ) { |
|
| 1812 | +function give_get_payment_form_title($payment_meta, $only_level = false, $separator = '') { |
|
| 1813 | 1813 | |
| 1814 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
| 1815 | - $price_id = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null; |
|
| 1816 | - $form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : ''; |
|
| 1814 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
| 1815 | + $price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null; |
|
| 1816 | + $form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : ''; |
|
| 1817 | 1817 | |
| 1818 | - if ( $only_level == true ) { |
|
| 1818 | + if ($only_level == true) { |
|
| 1819 | 1819 | $form_title = ''; |
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | //If multi-level, append to the form title. |
| 1823 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 1823 | + if (give_has_variable_prices($form_id)) { |
|
| 1824 | 1824 | |
| 1825 | 1825 | //Only add separator if there is a form title. |
| 1826 | - if ( ! empty( $form_title ) ) { |
|
| 1827 | - $form_title .= ' ' . $separator . ' '; |
|
| 1826 | + if ( ! empty($form_title)) { |
|
| 1827 | + $form_title .= ' '.$separator.' '; |
|
| 1828 | 1828 | } |
| 1829 | 1829 | |
| 1830 | 1830 | $form_title .= '<span class="donation-level-text-wrap">'; |
| 1831 | 1831 | |
| 1832 | - if ( $price_id == 'custom' ) { |
|
| 1833 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 1834 | - $form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' ); |
|
| 1832 | + if ($price_id == 'custom') { |
|
| 1833 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 1834 | + $form_title .= ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give'); |
|
| 1835 | 1835 | } else { |
| 1836 | - $form_title .= give_get_price_option_name( $form_id, $price_id ); |
|
| 1836 | + $form_title .= give_get_price_option_name($form_id, $price_id); |
|
| 1837 | 1837 | } |
| 1838 | 1838 | |
| 1839 | 1839 | $form_title .= '</span>'; |
| 1840 | 1840 | |
| 1841 | 1841 | } |
| 1842 | 1842 | |
| 1843 | - return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta ); |
|
| 1843 | + return apply_filters('give_get_payment_form_title', $form_title, $payment_meta); |
|
| 1844 | 1844 | |
| 1845 | 1845 | } |
| 1846 | 1846 | |
@@ -1854,20 +1854,20 @@ discard block |
||
| 1854 | 1854 | * |
| 1855 | 1855 | * @return string $price_id |
| 1856 | 1856 | */ |
| 1857 | -function give_get_price_id( $form_id, $price ) { |
|
| 1857 | +function give_get_price_id($form_id, $price) { |
|
| 1858 | 1858 | |
| 1859 | 1859 | $price_id = 0; |
| 1860 | 1860 | |
| 1861 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 1861 | + if (give_has_variable_prices($form_id)) { |
|
| 1862 | 1862 | |
| 1863 | - $levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) ); |
|
| 1863 | + $levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true)); |
|
| 1864 | 1864 | |
| 1865 | - foreach ( $levels as $level ) { |
|
| 1865 | + foreach ($levels as $level) { |
|
| 1866 | 1866 | |
| 1867 | - $level_amount = (float) give_sanitize_amount( $level['_give_amount'] ); |
|
| 1867 | + $level_amount = (float) give_sanitize_amount($level['_give_amount']); |
|
| 1868 | 1868 | |
| 1869 | 1869 | // Check that this indeed the recurring price. |
| 1870 | - if ( $level_amount == $price ) { |
|
| 1870 | + if ($level_amount == $price) { |
|
| 1871 | 1871 | |
| 1872 | 1872 | $price_id = $level['_give_id']['level_id']; |
| 1873 | 1873 | |
@@ -1892,10 +1892,10 @@ discard block |
||
| 1892 | 1892 | * |
| 1893 | 1893 | * @return string|void |
| 1894 | 1894 | */ |
| 1895 | -function give_get_form_dropdown( $args = array(), $echo = false ) { |
|
| 1896 | - $form_dropdown_html = Give()->html->forms_dropdown( $args ); |
|
| 1895 | +function give_get_form_dropdown($args = array(), $echo = false) { |
|
| 1896 | + $form_dropdown_html = Give()->html->forms_dropdown($args); |
|
| 1897 | 1897 | |
| 1898 | - if ( ! $echo ) { |
|
| 1898 | + if ( ! $echo) { |
|
| 1899 | 1899 | return $form_dropdown_html; |
| 1900 | 1900 | } |
| 1901 | 1901 | |
@@ -1912,17 +1912,17 @@ discard block |
||
| 1912 | 1912 | * |
| 1913 | 1913 | * @return string|bool |
| 1914 | 1914 | */ |
| 1915 | -function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) { |
|
| 1915 | +function give_get_form_variable_price_dropdown($args = array(), $echo = false) { |
|
| 1916 | 1916 | |
| 1917 | 1917 | // Check for give form id. |
| 1918 | - if ( empty( $args['id'] ) ) { |
|
| 1918 | + if (empty($args['id'])) { |
|
| 1919 | 1919 | return false; |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| 1922 | - $form = new Give_Donate_Form( $args['id'] ); |
|
| 1922 | + $form = new Give_Donate_Form($args['id']); |
|
| 1923 | 1923 | |
| 1924 | 1924 | // Check if form has variable prices or not. |
| 1925 | - if ( ! $form->ID || ! $form->has_variable_prices() ) { |
|
| 1925 | + if ( ! $form->ID || ! $form->has_variable_prices()) { |
|
| 1926 | 1926 | return false; |
| 1927 | 1927 | } |
| 1928 | 1928 | |
@@ -1930,22 +1930,22 @@ discard block |
||
| 1930 | 1930 | $variable_price_options = array(); |
| 1931 | 1931 | |
| 1932 | 1932 | // Check if multi donation form support custom donation or not. |
| 1933 | - if ( $form->is_custom_price_mode() ) { |
|
| 1934 | - $variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' ); |
|
| 1933 | + if ($form->is_custom_price_mode()) { |
|
| 1934 | + $variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give'); |
|
| 1935 | 1935 | } |
| 1936 | 1936 | |
| 1937 | 1937 | // Get variable price and ID from variable price array. |
| 1938 | - foreach ( $variable_prices as $variable_price ) { |
|
| 1939 | - $variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'] ) ); |
|
| 1938 | + foreach ($variable_prices as $variable_price) { |
|
| 1939 | + $variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'])); |
|
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | 1942 | // Update options. |
| 1943 | - $args = array_merge( $args, array( 'options' => $variable_price_options ) ); |
|
| 1943 | + $args = array_merge($args, array('options' => $variable_price_options)); |
|
| 1944 | 1944 | |
| 1945 | 1945 | // Generate select html. |
| 1946 | - $form_dropdown_html = Give()->html->select( $args ); |
|
| 1946 | + $form_dropdown_html = Give()->html->select($args); |
|
| 1947 | 1947 | |
| 1948 | - if ( ! $echo ) { |
|
| 1948 | + if ( ! $echo) { |
|
| 1949 | 1949 | return $form_dropdown_html; |
| 1950 | 1950 | } |
| 1951 | 1951 | |
@@ -1964,14 +1964,14 @@ discard block |
||
| 1964 | 1964 | * |
| 1965 | 1965 | * @return string |
| 1966 | 1966 | */ |
| 1967 | -function give_get_payment_meta_price_id( $payment_meta ) { |
|
| 1967 | +function give_get_payment_meta_price_id($payment_meta) { |
|
| 1968 | 1968 | |
| 1969 | - if(isset($payment_meta['give_price_id'])) { |
|
| 1970 | - $price_id = $payment_meta['give_price_id']; |
|
| 1971 | - } elseif(isset($payment_meta['price_id'])) { |
|
| 1972 | - $price_id = $payment_meta['price_id']; |
|
| 1969 | + if (isset($payment_meta['give_price_id'])) { |
|
| 1970 | + $price_id = $payment_meta['give_price_id']; |
|
| 1971 | + } elseif (isset($payment_meta['price_id'])) { |
|
| 1972 | + $price_id = $payment_meta['price_id']; |
|
| 1973 | 1973 | } else { |
| 1974 | - $price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] ); |
|
| 1974 | + $price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']); |
|
| 1975 | 1975 | } |
| 1976 | 1976 | |
| 1977 | 1977 | return apply_filters('give_get_payment_meta_price_id', $price_id); |
@@ -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 | |
@@ -394,13 +394,13 @@ discard block |
||
| 394 | 394 | * |
| 395 | 395 | * @return mixed void|false |
| 396 | 396 | */ |
| 397 | - public function __construct( $payment_id = false ) { |
|
| 397 | + public function __construct($payment_id = false) { |
|
| 398 | 398 | |
| 399 | - if ( empty( $payment_id ) ) { |
|
| 399 | + if (empty($payment_id)) { |
|
| 400 | 400 | return false; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - $this->setup_payment( $payment_id ); |
|
| 403 | + $this->setup_payment($payment_id); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -413,11 +413,11 @@ discard block |
||
| 413 | 413 | * |
| 414 | 414 | * @return mixed The value. |
| 415 | 415 | */ |
| 416 | - public function __get( $key ) { |
|
| 416 | + public function __get($key) { |
|
| 417 | 417 | |
| 418 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
| 418 | + if (method_exists($this, 'get_'.$key)) { |
|
| 419 | 419 | |
| 420 | - $value = call_user_func( array( $this, 'get_' . $key ) ); |
|
| 420 | + $value = call_user_func(array($this, 'get_'.$key)); |
|
| 421 | 421 | |
| 422 | 422 | } else { |
| 423 | 423 | |
@@ -439,18 +439,18 @@ discard block |
||
| 439 | 439 | * @param string $key The property name |
| 440 | 440 | * @param mixed $value The value of the property |
| 441 | 441 | */ |
| 442 | - public function __set( $key, $value ) { |
|
| 443 | - $ignore = array( '_ID' ); |
|
| 442 | + public function __set($key, $value) { |
|
| 443 | + $ignore = array('_ID'); |
|
| 444 | 444 | |
| 445 | - if ( $key === 'status' ) { |
|
| 445 | + if ($key === 'status') { |
|
| 446 | 446 | $this->old_status = $this->status; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - if ( ! in_array( $key, $ignore ) ) { |
|
| 450 | - $this->pending[ $key ] = $value; |
|
| 449 | + if ( ! in_array($key, $ignore)) { |
|
| 450 | + $this->pending[$key] = $value; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - if ( '_ID' !== $key ) { |
|
| 453 | + if ('_ID' !== $key) { |
|
| 454 | 454 | $this->$key = $value; |
| 455 | 455 | } |
| 456 | 456 | } |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | * |
| 466 | 466 | * @return boolean If the item is set or not |
| 467 | 467 | */ |
| 468 | - public function __isset( $name ) { |
|
| 469 | - if ( property_exists( $this, $name ) ) { |
|
| 470 | - return false === empty( $this->$name ); |
|
| 468 | + public function __isset($name) { |
|
| 469 | + if (property_exists($this, $name)) { |
|
| 470 | + return false === empty($this->$name); |
|
| 471 | 471 | } else { |
| 472 | 472 | return null; |
| 473 | 473 | } |
@@ -483,20 +483,20 @@ discard block |
||
| 483 | 483 | * |
| 484 | 484 | * @return bool If the setup was successful or not |
| 485 | 485 | */ |
| 486 | - private function setup_payment( $payment_id ) { |
|
| 486 | + private function setup_payment($payment_id) { |
|
| 487 | 487 | $this->pending = array(); |
| 488 | 488 | |
| 489 | - if ( empty( $payment_id ) ) { |
|
| 489 | + if (empty($payment_id)) { |
|
| 490 | 490 | return false; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - $payment = get_post( $payment_id ); |
|
| 493 | + $payment = get_post($payment_id); |
|
| 494 | 494 | |
| 495 | - if ( ! $payment || is_wp_error( $payment ) ) { |
|
| 495 | + if ( ! $payment || is_wp_error($payment)) { |
|
| 496 | 496 | return false; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - if ( 'give_payment' !== $payment->post_type ) { |
|
| 499 | + if ('give_payment' !== $payment->post_type) { |
|
| 500 | 500 | return false; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -510,13 +510,13 @@ discard block |
||
| 510 | 510 | * @param Give_Payment $this Payment object. |
| 511 | 511 | * @param int $payment_id The ID of the payment. |
| 512 | 512 | */ |
| 513 | - do_action( 'give_pre_setup_payment', $this, $payment_id ); |
|
| 513 | + do_action('give_pre_setup_payment', $this, $payment_id); |
|
| 514 | 514 | |
| 515 | 515 | // Primary Identifier. |
| 516 | - $this->ID = absint( $payment_id ); |
|
| 516 | + $this->ID = absint($payment_id); |
|
| 517 | 517 | |
| 518 | 518 | // Protected ID that can never be changed. |
| 519 | - $this->_ID = absint( $payment_id ); |
|
| 519 | + $this->_ID = absint($payment_id); |
|
| 520 | 520 | |
| 521 | 521 | // We have a payment, get the generic payment_meta item to reduce calls to it. |
| 522 | 522 | $this->payment_meta = $this->get_meta(); |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | $this->parent_payment = $payment->post_parent; |
| 532 | 532 | |
| 533 | 533 | $all_payment_statuses = give_get_payment_statuses(); |
| 534 | - $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); |
|
| 534 | + $this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status); |
|
| 535 | 535 | |
| 536 | 536 | // Items. |
| 537 | 537 | $this->fees = $this->setup_fees(); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | * @param Give_Payment $this Payment object. |
| 574 | 574 | * @param int $payment_id The ID of the payment. |
| 575 | 575 | */ |
| 576 | - do_action( 'give_setup_payment', $this, $payment_id ); |
|
| 576 | + do_action('give_setup_payment', $this, $payment_id); |
|
| 577 | 577 | |
| 578 | 578 | return true; |
| 579 | 579 | } |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | * |
| 592 | 592 | * @return void |
| 593 | 593 | */ |
| 594 | - public function update_payment_setup( $payment_id ) { |
|
| 595 | - $this->setup_payment( $payment_id ); |
|
| 594 | + public function update_payment_setup($payment_id) { |
|
| 595 | + $this->setup_payment($payment_id); |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | /** |
@@ -607,24 +607,24 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | // Construct the payment title. |
| 609 | 609 | $payment_title = ''; |
| 610 | - if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { |
|
| 611 | - $payment_title = $this->first_name . ' ' . $this->last_name; |
|
| 612 | - } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { |
|
| 610 | + if ( ! empty($this->first_name) && ! empty($this->last_name)) { |
|
| 611 | + $payment_title = $this->first_name.' '.$this->last_name; |
|
| 612 | + } elseif ( ! empty($this->first_name) && empty($this->last_name)) { |
|
| 613 | 613 | $payment_title = $this->first_name; |
| 614 | - } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { |
|
| 614 | + } elseif ( ! empty($this->email) && is_email($this->email)) { |
|
| 615 | 615 | $payment_title = $this->email; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // Set Key. |
| 619 | - if ( empty( $this->key ) ) { |
|
| 619 | + if (empty($this->key)) { |
|
| 620 | 620 | |
| 621 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
| 622 | - $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key |
|
| 621 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
| 622 | + $this->key = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key |
|
| 623 | 623 | $this->pending['key'] = $this->key; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | // Set IP. |
| 627 | - if ( empty( $this->ip ) ) { |
|
| 627 | + if (empty($this->ip)) { |
|
| 628 | 628 | |
| 629 | 629 | $this->ip = give_get_ip(); |
| 630 | 630 | $this->pending['ip'] = $this->ip; |
@@ -651,63 +651,63 @@ discard block |
||
| 651 | 651 | 'fees' => $this->fees, |
| 652 | 652 | ); |
| 653 | 653 | |
| 654 | - $args = apply_filters( 'give_insert_payment_args', array( |
|
| 654 | + $args = apply_filters('give_insert_payment_args', array( |
|
| 655 | 655 | 'post_title' => $payment_title, |
| 656 | 656 | 'post_status' => $this->status, |
| 657 | 657 | 'post_type' => 'give_payment', |
| 658 | - 'post_date' => ! empty( $this->date ) ? $this->date : null, |
|
| 659 | - 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, |
|
| 658 | + 'post_date' => ! empty($this->date) ? $this->date : null, |
|
| 659 | + 'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null, |
|
| 660 | 660 | 'post_parent' => $this->parent_payment, |
| 661 | - ), $payment_data ); |
|
| 661 | + ), $payment_data); |
|
| 662 | 662 | |
| 663 | 663 | // Create a blank payment |
| 664 | - $payment_id = wp_insert_post( $args ); |
|
| 664 | + $payment_id = wp_insert_post($args); |
|
| 665 | 665 | |
| 666 | - if ( ! empty( $payment_id ) ) { |
|
| 666 | + if ( ! empty($payment_id)) { |
|
| 667 | 667 | |
| 668 | 668 | $this->ID = $payment_id; |
| 669 | 669 | $this->_ID = $payment_id; |
| 670 | 670 | |
| 671 | 671 | $customer = new stdClass; |
| 672 | 672 | |
| 673 | - if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { |
|
| 674 | - $customer = new Give_Customer( get_current_user_id(), true ); |
|
| 673 | + if (did_action('give_pre_process_donation') && is_user_logged_in()) { |
|
| 674 | + $customer = new Give_Customer(get_current_user_id(), true); |
|
| 675 | 675 | |
| 676 | 676 | // Customer is logged in but used a different email to purchase with so assign to their customer record |
| 677 | - if ( ! empty( $customer->id ) && $this->email != $customer->email ) { |
|
| 678 | - $customer->add_email( $this->email ); |
|
| 677 | + if ( ! empty($customer->id) && $this->email != $customer->email) { |
|
| 678 | + $customer->add_email($this->email); |
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - if ( empty( $customer->id ) ) { |
|
| 683 | - $customer = new Give_Customer( $this->email ); |
|
| 682 | + if (empty($customer->id)) { |
|
| 683 | + $customer = new Give_Customer($this->email); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | - if ( empty( $customer->id ) ) { |
|
| 686 | + if (empty($customer->id)) { |
|
| 687 | 687 | |
| 688 | 688 | $customer_data = array( |
| 689 | - 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', |
|
| 689 | + 'name' => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '', |
|
| 690 | 690 | 'email' => $this->email, |
| 691 | 691 | 'user_id' => $this->user_id, |
| 692 | 692 | ); |
| 693 | 693 | |
| 694 | - $customer->create( $customer_data ); |
|
| 694 | + $customer->create($customer_data); |
|
| 695 | 695 | |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | $this->customer_id = $customer->id; |
| 699 | 699 | $this->pending['customer_id'] = $this->customer_id; |
| 700 | - $customer->attach_payment( $this->ID, false ); |
|
| 700 | + $customer->attach_payment($this->ID, false); |
|
| 701 | 701 | |
| 702 | - $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); |
|
| 703 | - if ( ! empty( $this->payment_meta['fees'] ) ) { |
|
| 704 | - $this->fees = array_merge( $this->fees, $this->payment_meta['fees'] ); |
|
| 705 | - foreach ( $this->fees as $fee ) { |
|
| 706 | - $this->increase_fees( $fee['amount'] ); |
|
| 702 | + $this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data); |
|
| 703 | + if ( ! empty($this->payment_meta['fees'])) { |
|
| 704 | + $this->fees = array_merge($this->fees, $this->payment_meta['fees']); |
|
| 705 | + foreach ($this->fees as $fee) { |
|
| 706 | + $this->increase_fees($fee['amount']); |
|
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $this->update_meta( '_give_payment_meta', $this->payment_meta ); |
|
| 710 | + $this->update_meta('_give_payment_meta', $this->payment_meta); |
|
| 711 | 711 | $this->new = true; |
| 712 | 712 | } |
| 713 | 713 | |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | $saved = false; |
| 730 | 730 | |
| 731 | 731 | // Must have an ID. |
| 732 | - if ( empty( $this->ID ) ) { |
|
| 732 | + if (empty($this->ID)) { |
|
| 733 | 733 | |
| 734 | 734 | $payment_id = $this->insert_payment(); |
| 735 | 735 | |
| 736 | - if ( false === $payment_id ) { |
|
| 736 | + if (false === $payment_id) { |
|
| 737 | 737 | $saved = false; |
| 738 | 738 | } else { |
| 739 | 739 | $this->ID = $payment_id; |
@@ -741,48 +741,48 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // Set ID if not matching. |
| 744 | - if ( $this->ID !== $this->_ID ) { |
|
| 744 | + if ($this->ID !== $this->_ID) { |
|
| 745 | 745 | $this->ID = $this->_ID; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | // If we have something pending, let's save it. |
| 749 | - if ( ! empty( $this->pending ) ) { |
|
| 749 | + if ( ! empty($this->pending)) { |
|
| 750 | 750 | |
| 751 | 751 | $total_increase = 0; |
| 752 | 752 | $total_decrease = 0; |
| 753 | 753 | |
| 754 | - foreach ( $this->pending as $key => $value ) { |
|
| 754 | + foreach ($this->pending as $key => $value) { |
|
| 755 | 755 | |
| 756 | - switch ( $key ) { |
|
| 756 | + switch ($key) { |
|
| 757 | 757 | |
| 758 | 758 | case 'donations': |
| 759 | 759 | // Update totals for pending donations. |
| 760 | - foreach ( $this->pending[ $key ] as $item ) { |
|
| 760 | + foreach ($this->pending[$key] as $item) { |
|
| 761 | 761 | |
| 762 | - $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; |
|
| 763 | - $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; |
|
| 762 | + $quantity = isset($item['quantity']) ? $item['quantity'] : 1; |
|
| 763 | + $price_id = isset($item['price_id']) ? $item['price_id'] : 0; |
|
| 764 | 764 | |
| 765 | - switch ( $item['action'] ) { |
|
| 765 | + switch ($item['action']) { |
|
| 766 | 766 | |
| 767 | 767 | case 'add': |
| 768 | 768 | |
| 769 | 769 | $price = $item['price']; |
| 770 | 770 | |
| 771 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
| 771 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
| 772 | 772 | |
| 773 | 773 | // Add sales logs. |
| 774 | - $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); |
|
| 774 | + $log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp')); |
|
| 775 | 775 | |
| 776 | 776 | $y = 0; |
| 777 | - while ( $y < $quantity ) { |
|
| 777 | + while ($y < $quantity) { |
|
| 778 | 778 | |
| 779 | - give_record_sale_in_log( $item['id'], $this->ID, $price_id, $log_date ); |
|
| 780 | - $y ++; |
|
| 779 | + give_record_sale_in_log($item['id'], $this->ID, $price_id, $log_date); |
|
| 780 | + $y++; |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - $form = new Give_Donate_Form( $item['id'] ); |
|
| 784 | - $form->increase_sales( $quantity ); |
|
| 785 | - $form->increase_earnings( $price ); |
|
| 783 | + $form = new Give_Donate_Form($item['id']); |
|
| 784 | + $form->increase_sales($quantity); |
|
| 785 | + $form->increase_earnings($price); |
|
| 786 | 786 | |
| 787 | 787 | $total_increase += $price; |
| 788 | 788 | } |
@@ -807,15 +807,15 @@ discard block |
||
| 807 | 807 | ), |
| 808 | 808 | ); |
| 809 | 809 | |
| 810 | - $found_logs = get_posts( $log_args ); |
|
| 811 | - foreach ( $found_logs as $log ) { |
|
| 812 | - wp_delete_post( $log->ID, true ); |
|
| 810 | + $found_logs = get_posts($log_args); |
|
| 811 | + foreach ($found_logs as $log) { |
|
| 812 | + wp_delete_post($log->ID, true); |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
| 816 | - $form = new Give_Donate_Form( $item['id'] ); |
|
| 817 | - $form->decrease_sales( $quantity ); |
|
| 818 | - $form->decrease_earnings( $item['amount'] ); |
|
| 815 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
| 816 | + $form = new Give_Donate_Form($item['id']); |
|
| 817 | + $form->decrease_sales($quantity); |
|
| 818 | + $form->decrease_earnings($item['amount']); |
|
| 819 | 819 | |
| 820 | 820 | $total_decrease += $item['amount']; |
| 821 | 821 | } |
@@ -827,17 +827,17 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | case 'fees': |
| 829 | 829 | |
| 830 | - if ( 'publish' !== $this->status && 'complete' !== $this->status ) { |
|
| 830 | + if ('publish' !== $this->status && 'complete' !== $this->status) { |
|
| 831 | 831 | break; |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | - if ( empty( $this->pending[ $key ] ) ) { |
|
| 834 | + if (empty($this->pending[$key])) { |
|
| 835 | 835 | break; |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - foreach ( $this->pending[ $key ] as $fee ) { |
|
| 838 | + foreach ($this->pending[$key] as $fee) { |
|
| 839 | 839 | |
| 840 | - switch ( $fee['action'] ) { |
|
| 840 | + switch ($fee['action']) { |
|
| 841 | 841 | |
| 842 | 842 | case 'add': |
| 843 | 843 | $total_increase += $fee['amount']; |
@@ -853,43 +853,43 @@ discard block |
||
| 853 | 853 | break; |
| 854 | 854 | |
| 855 | 855 | case 'status': |
| 856 | - $this->update_status( $this->status ); |
|
| 856 | + $this->update_status($this->status); |
|
| 857 | 857 | break; |
| 858 | 858 | |
| 859 | 859 | case 'gateway': |
| 860 | - $this->update_meta( '_give_payment_gateway', $this->gateway ); |
|
| 860 | + $this->update_meta('_give_payment_gateway', $this->gateway); |
|
| 861 | 861 | break; |
| 862 | 862 | |
| 863 | 863 | case 'mode': |
| 864 | - $this->update_meta( '_give_payment_mode', $this->mode ); |
|
| 864 | + $this->update_meta('_give_payment_mode', $this->mode); |
|
| 865 | 865 | break; |
| 866 | 866 | |
| 867 | 867 | case 'transaction_id': |
| 868 | - $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); |
|
| 868 | + $this->update_meta('_give_payment_transaction_id', $this->transaction_id); |
|
| 869 | 869 | break; |
| 870 | 870 | |
| 871 | 871 | case 'ip': |
| 872 | - $this->update_meta( '_give_payment_user_ip', $this->ip ); |
|
| 872 | + $this->update_meta('_give_payment_user_ip', $this->ip); |
|
| 873 | 873 | break; |
| 874 | 874 | |
| 875 | 875 | case 'customer_id': |
| 876 | - $this->update_meta( '_give_payment_customer_id', $this->customer_id ); |
|
| 876 | + $this->update_meta('_give_payment_customer_id', $this->customer_id); |
|
| 877 | 877 | break; |
| 878 | 878 | |
| 879 | 879 | case 'user_id': |
| 880 | - $this->update_meta( '_give_payment_user_id', $this->user_id ); |
|
| 880 | + $this->update_meta('_give_payment_user_id', $this->user_id); |
|
| 881 | 881 | break; |
| 882 | 882 | |
| 883 | 883 | case 'form_title': |
| 884 | - $this->update_meta( '_give_payment_form_title', $this->form_title ); |
|
| 884 | + $this->update_meta('_give_payment_form_title', $this->form_title); |
|
| 885 | 885 | break; |
| 886 | 886 | |
| 887 | 887 | case 'form_id': |
| 888 | - $this->update_meta( '_give_payment_form_id', $this->form_id ); |
|
| 888 | + $this->update_meta('_give_payment_form_id', $this->form_id); |
|
| 889 | 889 | break; |
| 890 | 890 | |
| 891 | 891 | case 'price_id': |
| 892 | - $this->update_meta( '_give_payment_price_id', $this->price_id ); |
|
| 892 | + $this->update_meta('_give_payment_price_id', $this->price_id); |
|
| 893 | 893 | break; |
| 894 | 894 | |
| 895 | 895 | case 'first_name': |
@@ -905,15 +905,15 @@ discard block |
||
| 905 | 905 | break; |
| 906 | 906 | |
| 907 | 907 | case 'email': |
| 908 | - $this->update_meta( '_give_payment_user_email', $this->email ); |
|
| 908 | + $this->update_meta('_give_payment_user_email', $this->email); |
|
| 909 | 909 | break; |
| 910 | 910 | |
| 911 | 911 | case 'key': |
| 912 | - $this->update_meta( '_give_payment_purchase_key', $this->key ); |
|
| 912 | + $this->update_meta('_give_payment_purchase_key', $this->key); |
|
| 913 | 913 | break; |
| 914 | 914 | |
| 915 | 915 | case 'number': |
| 916 | - $this->update_meta( '_give_payment_number', $this->number ); |
|
| 916 | + $this->update_meta('_give_payment_number', $this->number); |
|
| 917 | 917 | break; |
| 918 | 918 | |
| 919 | 919 | case 'date': |
@@ -923,11 +923,11 @@ discard block |
||
| 923 | 923 | 'edit_date' => true, |
| 924 | 924 | ); |
| 925 | 925 | |
| 926 | - wp_update_post( $args ); |
|
| 926 | + wp_update_post($args); |
|
| 927 | 927 | break; |
| 928 | 928 | |
| 929 | 929 | case 'completed_date': |
| 930 | - $this->update_meta( '_give_completed_date', $this->completed_date ); |
|
| 930 | + $this->update_meta('_give_completed_date', $this->completed_date); |
|
| 931 | 931 | break; |
| 932 | 932 | |
| 933 | 933 | case 'parent_payment': |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | 'post_parent' => $this->parent_payment, |
| 937 | 937 | ); |
| 938 | 938 | |
| 939 | - wp_update_post( $args ); |
|
| 939 | + wp_update_post($args); |
|
| 940 | 940 | break; |
| 941 | 941 | |
| 942 | 942 | default: |
@@ -947,33 +947,33 @@ discard block |
||
| 947 | 947 | * |
| 948 | 948 | * @param Give_Payment $this Payment object. |
| 949 | 949 | */ |
| 950 | - do_action( 'give_payment_save', $this, $key ); |
|
| 950 | + do_action('give_payment_save', $this, $key); |
|
| 951 | 951 | break; |
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | - if ( 'pending' !== $this->status ) { |
|
| 955 | + if ('pending' !== $this->status) { |
|
| 956 | 956 | |
| 957 | - $customer = new Give_Customer( $this->customer_id ); |
|
| 957 | + $customer = new Give_Customer($this->customer_id); |
|
| 958 | 958 | |
| 959 | 959 | $total_change = $total_increase - $total_decrease; |
| 960 | - if ( $total_change < 0 ) { |
|
| 960 | + if ($total_change < 0) { |
|
| 961 | 961 | |
| 962 | - $total_change = - ( $total_change ); |
|
| 962 | + $total_change = - ($total_change); |
|
| 963 | 963 | // Decrease the customer's donation stats. |
| 964 | - $customer->decrease_value( $total_change ); |
|
| 965 | - give_decrease_total_earnings( $total_change ); |
|
| 964 | + $customer->decrease_value($total_change); |
|
| 965 | + give_decrease_total_earnings($total_change); |
|
| 966 | 966 | |
| 967 | - } elseif ( $total_change > 0 ) { |
|
| 967 | + } elseif ($total_change > 0) { |
|
| 968 | 968 | |
| 969 | 969 | // Increase the customer's donation stats. |
| 970 | - $customer->increase_value( $total_change ); |
|
| 971 | - give_increase_total_earnings( $total_change ); |
|
| 970 | + $customer->increase_value($total_change); |
|
| 971 | + give_increase_total_earnings($total_change); |
|
| 972 | 972 | |
| 973 | 973 | } |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | - $this->update_meta( '_give_payment_total', $this->total ); |
|
| 976 | + $this->update_meta('_give_payment_total', $this->total); |
|
| 977 | 977 | |
| 978 | 978 | $new_meta = array( |
| 979 | 979 | 'form_title' => $this->form_title, |
@@ -985,12 +985,12 @@ discard block |
||
| 985 | 985 | ); |
| 986 | 986 | |
| 987 | 987 | $meta = $this->get_meta(); |
| 988 | - $merged_meta = array_merge( $meta, $new_meta ); |
|
| 988 | + $merged_meta = array_merge($meta, $new_meta); |
|
| 989 | 989 | |
| 990 | 990 | // Only save the payment meta if it's changed. |
| 991 | - if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) { |
|
| 992 | - $updated = $this->update_meta( '_give_payment_meta', $merged_meta ); |
|
| 993 | - if ( false !== $updated ) { |
|
| 991 | + if (md5(serialize($meta)) !== md5(serialize($merged_meta))) { |
|
| 992 | + $updated = $this->update_meta('_give_payment_meta', $merged_meta); |
|
| 993 | + if (false !== $updated) { |
|
| 994 | 994 | $saved = true; |
| 995 | 995 | } |
| 996 | 996 | } |
@@ -999,8 +999,8 @@ discard block |
||
| 999 | 999 | $saved = true; |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | - if ( true === $saved ) { |
|
| 1003 | - $this->setup_payment( $this->ID ); |
|
| 1002 | + if (true === $saved) { |
|
| 1003 | + $this->setup_payment($this->ID); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | return $saved; |
@@ -1018,12 +1018,12 @@ discard block |
||
| 1018 | 1018 | * |
| 1019 | 1019 | * @return bool True when successful, false otherwise |
| 1020 | 1020 | */ |
| 1021 | - public function add_donation( $form_id = 0, $args = array(), $options = array() ) { |
|
| 1021 | + public function add_donation($form_id = 0, $args = array(), $options = array()) { |
|
| 1022 | 1022 | |
| 1023 | - $donation = new Give_Donate_Form( $form_id ); |
|
| 1023 | + $donation = new Give_Donate_Form($form_id); |
|
| 1024 | 1024 | |
| 1025 | 1025 | // Bail if this post isn't a give donation form. |
| 1026 | - if ( ! $donation || $donation->post_type !== 'give_forms' ) { |
|
| 1026 | + if ( ! $donation || $donation->post_type !== 'give_forms') { |
|
| 1027 | 1027 | return false; |
| 1028 | 1028 | } |
| 1029 | 1029 | |
@@ -1034,59 +1034,59 @@ discard block |
||
| 1034 | 1034 | 'fees' => array(), |
| 1035 | 1035 | ); |
| 1036 | 1036 | |
| 1037 | - $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); |
|
| 1037 | + $args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults); |
|
| 1038 | 1038 | |
| 1039 | 1039 | // Allow overriding the price. |
| 1040 | - if ( false !== $args['price'] ) { |
|
| 1040 | + if (false !== $args['price']) { |
|
| 1041 | 1041 | $item_price = $args['price']; |
| 1042 | 1042 | } else { |
| 1043 | 1043 | |
| 1044 | 1044 | // Deal with variable pricing. |
| 1045 | - if ( give_has_variable_prices( $donation->ID ) ) { |
|
| 1046 | - $prices = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) ); |
|
| 1045 | + if (give_has_variable_prices($donation->ID)) { |
|
| 1046 | + $prices = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true)); |
|
| 1047 | 1047 | $item_price = ''; |
| 1048 | 1048 | // Loop through prices. |
| 1049 | - foreach ( $prices as $price ) { |
|
| 1049 | + foreach ($prices as $price) { |
|
| 1050 | 1050 | // Find a match between price_id and level_id. |
| 1051 | 1051 | // First verify array keys exists THEN make the match. |
| 1052 | - if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
|
| 1052 | + if ((isset($args['price_id']) && isset($price['_give_id']['level_id'])) |
|
| 1053 | 1053 | && $args['price_id'] == $price['_give_id']['level_id'] |
| 1054 | 1054 | ) { |
| 1055 | 1055 | $item_price = $price['_give_amount']; |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| 1058 | 1058 | // Fallback to the lowest price point. |
| 1059 | - if ( $item_price == '' ) { |
|
| 1060 | - $item_price = give_get_lowest_price_option( $donation->ID ); |
|
| 1061 | - $args['price_id'] = give_get_lowest_price_id( $donation->ID ); |
|
| 1059 | + if ($item_price == '') { |
|
| 1060 | + $item_price = give_get_lowest_price_option($donation->ID); |
|
| 1061 | + $args['price_id'] = give_get_lowest_price_id($donation->ID); |
|
| 1062 | 1062 | } |
| 1063 | 1063 | } else { |
| 1064 | 1064 | // Simple form price. |
| 1065 | - $item_price = give_get_form_price( $donation->ID ); |
|
| 1065 | + $item_price = give_get_form_price($donation->ID); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | // Sanitizing the price here so we don't have a dozen calls later. |
| 1070 | - $item_price = give_sanitize_amount( $item_price ); |
|
| 1071 | - $total = round( $item_price, give_currency_decimal_filter() ); |
|
| 1070 | + $item_price = give_sanitize_amount($item_price); |
|
| 1071 | + $total = round($item_price, give_currency_decimal_filter()); |
|
| 1072 | 1072 | |
| 1073 | 1073 | // Add Options. |
| 1074 | 1074 | $default_options = array(); |
| 1075 | - if ( false !== $args['price_id'] ) { |
|
| 1075 | + if (false !== $args['price_id']) { |
|
| 1076 | 1076 | $default_options['price_id'] = (int) $args['price_id']; |
| 1077 | 1077 | } |
| 1078 | - $options = wp_parse_args( $options, $default_options ); |
|
| 1078 | + $options = wp_parse_args($options, $default_options); |
|
| 1079 | 1079 | |
| 1080 | 1080 | // Do not allow totals to go negative. |
| 1081 | - if ( $total < 0 ) { |
|
| 1081 | + if ($total < 0) { |
|
| 1082 | 1082 | $total = 0; |
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | $donation = array( |
| 1086 | 1086 | 'name' => $donation->post_title, |
| 1087 | 1087 | 'id' => $donation->ID, |
| 1088 | - 'price' => round( $total, give_currency_decimal_filter() ), |
|
| 1089 | - 'subtotal' => round( $total, give_currency_decimal_filter() ), |
|
| 1088 | + 'price' => round($total, give_currency_decimal_filter()), |
|
| 1089 | + 'subtotal' => round($total, give_currency_decimal_filter()), |
|
| 1090 | 1090 | 'fees' => $args['fees'], |
| 1091 | 1091 | 'price_id' => $args['price_id'], |
| 1092 | 1092 | 'action' => 'add', |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | |
| 1096 | 1096 | $this->pending['donations'][] = $donation; |
| 1097 | 1097 | |
| 1098 | - $this->increase_subtotal( $total ); |
|
| 1098 | + $this->increase_subtotal($total); |
|
| 1099 | 1099 | |
| 1100 | 1100 | return true; |
| 1101 | 1101 | |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | * |
| 1113 | 1113 | * @return bool If the item was removed or not |
| 1114 | 1114 | */ |
| 1115 | - public function remove_donation( $form_id, $args = array() ) { |
|
| 1115 | + public function remove_donation($form_id, $args = array()) { |
|
| 1116 | 1116 | |
| 1117 | 1117 | // Set some defaults. |
| 1118 | 1118 | $defaults = array( |
@@ -1120,12 +1120,12 @@ discard block |
||
| 1120 | 1120 | 'price' => false, |
| 1121 | 1121 | 'price_id' => false, |
| 1122 | 1122 | ); |
| 1123 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1123 | + $args = wp_parse_args($args, $defaults); |
|
| 1124 | 1124 | |
| 1125 | - $form = new Give_Donate_Form( $form_id ); |
|
| 1125 | + $form = new Give_Donate_Form($form_id); |
|
| 1126 | 1126 | |
| 1127 | 1127 | // Bail if this post isn't a valid give donation form. |
| 1128 | - if ( ! $form || $form->post_type !== 'give_forms' ) { |
|
| 1128 | + if ( ! $form || $form->post_type !== 'give_forms') { |
|
| 1129 | 1129 | return false; |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | |
| 1139 | 1139 | $this->pending['donations'][] = $pending_args; |
| 1140 | 1140 | |
| 1141 | - $this->decrease_subtotal( $this->total ); |
|
| 1141 | + $this->decrease_subtotal($this->total); |
|
| 1142 | 1142 | |
| 1143 | 1143 | return true; |
| 1144 | 1144 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | * |
| 1155 | 1155 | * @return bool If the fee was added |
| 1156 | 1156 | */ |
| 1157 | - public function add_fee( $args, $global = true ) { |
|
| 1157 | + public function add_fee($args, $global = true) { |
|
| 1158 | 1158 | |
| 1159 | 1159 | $default_args = array( |
| 1160 | 1160 | 'label' => '', |
@@ -1164,15 +1164,15 @@ discard block |
||
| 1164 | 1164 | 'price_id' => 0, |
| 1165 | 1165 | ); |
| 1166 | 1166 | |
| 1167 | - $fee = wp_parse_args( $args, $default_args ); |
|
| 1167 | + $fee = wp_parse_args($args, $default_args); |
|
| 1168 | 1168 | $this->fees[] = $fee; |
| 1169 | 1169 | |
| 1170 | 1170 | $added_fee = $fee; |
| 1171 | 1171 | $added_fee['action'] = 'add'; |
| 1172 | 1172 | $this->pending['fees'][] = $added_fee; |
| 1173 | - reset( $this->fees ); |
|
| 1173 | + reset($this->fees); |
|
| 1174 | 1174 | |
| 1175 | - $this->increase_fees( $fee['amount'] ); |
|
| 1175 | + $this->increase_fees($fee['amount']); |
|
| 1176 | 1176 | |
| 1177 | 1177 | return true; |
| 1178 | 1178 | } |
@@ -1187,11 +1187,11 @@ discard block |
||
| 1187 | 1187 | * |
| 1188 | 1188 | * @return bool If the fee was removed successfully |
| 1189 | 1189 | */ |
| 1190 | - public function remove_fee( $key ) { |
|
| 1190 | + public function remove_fee($key) { |
|
| 1191 | 1191 | $removed = false; |
| 1192 | 1192 | |
| 1193 | - if ( is_numeric( $key ) ) { |
|
| 1194 | - $removed = $this->remove_fee_by( 'index', $key ); |
|
| 1193 | + if (is_numeric($key)) { |
|
| 1194 | + $removed = $this->remove_fee_by('index', $key); |
|
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | return $removed; |
@@ -1210,55 +1210,55 @@ discard block |
||
| 1210 | 1210 | * |
| 1211 | 1211 | * @return boolean If the item is removed |
| 1212 | 1212 | */ |
| 1213 | - public function remove_fee_by( $key, $value, $global = false ) { |
|
| 1213 | + public function remove_fee_by($key, $value, $global = false) { |
|
| 1214 | 1214 | |
| 1215 | - $allowed_fee_keys = apply_filters( 'give_payment_fee_keys', array( |
|
| 1215 | + $allowed_fee_keys = apply_filters('give_payment_fee_keys', array( |
|
| 1216 | 1216 | 'index', |
| 1217 | 1217 | 'label', |
| 1218 | 1218 | 'amount', |
| 1219 | 1219 | 'type', |
| 1220 | - ) ); |
|
| 1220 | + )); |
|
| 1221 | 1221 | |
| 1222 | - if ( ! in_array( $key, $allowed_fee_keys ) ) { |
|
| 1222 | + if ( ! in_array($key, $allowed_fee_keys)) { |
|
| 1223 | 1223 | return false; |
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | $removed = false; |
| 1227 | - if ( 'index' === $key && array_key_exists( $value, $this->fees ) ) { |
|
| 1227 | + if ('index' === $key && array_key_exists($value, $this->fees)) { |
|
| 1228 | 1228 | |
| 1229 | - $removed_fee = $this->fees[ $value ]; |
|
| 1229 | + $removed_fee = $this->fees[$value]; |
|
| 1230 | 1230 | $removed_fee['action'] = 'remove'; |
| 1231 | 1231 | $this->pending['fees'][] = $removed_fee; |
| 1232 | 1232 | |
| 1233 | - $this->decrease_fees( $removed_fee['amount'] ); |
|
| 1233 | + $this->decrease_fees($removed_fee['amount']); |
|
| 1234 | 1234 | |
| 1235 | - unset( $this->fees[ $value ] ); |
|
| 1235 | + unset($this->fees[$value]); |
|
| 1236 | 1236 | $removed = true; |
| 1237 | 1237 | |
| 1238 | - } elseif ( 'index' !== $key ) { |
|
| 1238 | + } elseif ('index' !== $key) { |
|
| 1239 | 1239 | |
| 1240 | - foreach ( $this->fees as $index => $fee ) { |
|
| 1240 | + foreach ($this->fees as $index => $fee) { |
|
| 1241 | 1241 | |
| 1242 | - if ( isset( $fee[ $key ] ) && $fee[ $key ] == $value ) { |
|
| 1242 | + if (isset($fee[$key]) && $fee[$key] == $value) { |
|
| 1243 | 1243 | |
| 1244 | 1244 | $removed_fee = $fee; |
| 1245 | 1245 | $removed_fee['action'] = 'remove'; |
| 1246 | 1246 | $this->pending['fees'][] = $removed_fee; |
| 1247 | 1247 | |
| 1248 | - $this->decrease_fees( $removed_fee['amount'] ); |
|
| 1248 | + $this->decrease_fees($removed_fee['amount']); |
|
| 1249 | 1249 | |
| 1250 | - unset( $this->fees[ $index ] ); |
|
| 1250 | + unset($this->fees[$index]); |
|
| 1251 | 1251 | $removed = true; |
| 1252 | 1252 | |
| 1253 | - if ( false === $global ) { |
|
| 1253 | + if (false === $global) { |
|
| 1254 | 1254 | break; |
| 1255 | 1255 | } |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | - if ( true === $removed ) { |
|
| 1261 | - $this->fees = array_values( $this->fees ); |
|
| 1260 | + if (true === $removed) { |
|
| 1261 | + $this->fees = array_values($this->fees); |
|
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | return $removed; |
@@ -1274,14 +1274,14 @@ discard block |
||
| 1274 | 1274 | * |
| 1275 | 1275 | * @return array The Fees for the type specified |
| 1276 | 1276 | */ |
| 1277 | - public function get_fees( $type = 'all' ) { |
|
| 1277 | + public function get_fees($type = 'all') { |
|
| 1278 | 1278 | $fees = array(); |
| 1279 | 1279 | |
| 1280 | - if ( ! empty( $this->fees ) && is_array( $this->fees ) ) { |
|
| 1280 | + if ( ! empty($this->fees) && is_array($this->fees)) { |
|
| 1281 | 1281 | |
| 1282 | - foreach ( $this->fees as $fee_id => $fee ) { |
|
| 1282 | + foreach ($this->fees as $fee_id => $fee) { |
|
| 1283 | 1283 | |
| 1284 | - if ( 'all' != $type && ! empty( $fee['type'] ) && $type != $fee['type'] ) { |
|
| 1284 | + if ('all' != $type && ! empty($fee['type']) && $type != $fee['type']) { |
|
| 1285 | 1285 | continue; |
| 1286 | 1286 | } |
| 1287 | 1287 | |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | } |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | - return apply_filters( 'give_get_payment_fees', $fees, $this->ID, $this ); |
|
| 1294 | + return apply_filters('give_get_payment_fees', $fees, $this->ID, $this); |
|
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
@@ -1304,13 +1304,13 @@ discard block |
||
| 1304 | 1304 | * |
| 1305 | 1305 | * @return void |
| 1306 | 1306 | */ |
| 1307 | - public function add_note( $note = false ) { |
|
| 1307 | + public function add_note($note = false) { |
|
| 1308 | 1308 | // Bail if no note specified. |
| 1309 | - if ( ! $note ) { |
|
| 1309 | + if ( ! $note) { |
|
| 1310 | 1310 | return false; |
| 1311 | 1311 | } |
| 1312 | 1312 | |
| 1313 | - give_insert_payment_note( $this->ID, $note ); |
|
| 1313 | + give_insert_payment_note($this->ID, $note); |
|
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | /** |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | * |
| 1324 | 1324 | * @return void |
| 1325 | 1325 | */ |
| 1326 | - private function increase_subtotal( $amount = 0.00 ) { |
|
| 1326 | + private function increase_subtotal($amount = 0.00) { |
|
| 1327 | 1327 | $amount = (float) $amount; |
| 1328 | 1328 | $this->subtotal += $amount; |
| 1329 | 1329 | |
@@ -1340,11 +1340,11 @@ discard block |
||
| 1340 | 1340 | * |
| 1341 | 1341 | * @return void |
| 1342 | 1342 | */ |
| 1343 | - private function decrease_subtotal( $amount = 0.00 ) { |
|
| 1343 | + private function decrease_subtotal($amount = 0.00) { |
|
| 1344 | 1344 | $amount = (float) $amount; |
| 1345 | 1345 | $this->subtotal -= $amount; |
| 1346 | 1346 | |
| 1347 | - if ( $this->subtotal < 0 ) { |
|
| 1347 | + if ($this->subtotal < 0) { |
|
| 1348 | 1348 | $this->subtotal = 0; |
| 1349 | 1349 | } |
| 1350 | 1350 | |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | * |
| 1362 | 1362 | * @return void |
| 1363 | 1363 | */ |
| 1364 | - private function increase_fees( $amount = 0.00 ) { |
|
| 1364 | + private function increase_fees($amount = 0.00) { |
|
| 1365 | 1365 | $amount = (float) $amount; |
| 1366 | 1366 | $this->fees_total += $amount; |
| 1367 | 1367 | |
@@ -1378,11 +1378,11 @@ discard block |
||
| 1378 | 1378 | * |
| 1379 | 1379 | * @return void |
| 1380 | 1380 | */ |
| 1381 | - private function decrease_fees( $amount = 0.00 ) { |
|
| 1381 | + private function decrease_fees($amount = 0.00) { |
|
| 1382 | 1382 | $amount = (float) $amount; |
| 1383 | 1383 | $this->fees_total -= $amount; |
| 1384 | 1384 | |
| 1385 | - if ( $this->fees_total < 0 ) { |
|
| 1385 | + if ($this->fees_total < 0) { |
|
| 1386 | 1386 | $this->fees_total = 0; |
| 1387 | 1387 | } |
| 1388 | 1388 | |
@@ -1411,24 +1411,24 @@ discard block |
||
| 1411 | 1411 | * |
| 1412 | 1412 | * @return bool $updated Returns if the status was successfully updated. |
| 1413 | 1413 | */ |
| 1414 | - public function update_status( $status = false ) { |
|
| 1414 | + public function update_status($status = false) { |
|
| 1415 | 1415 | |
| 1416 | 1416 | // standardize the 'complete(d)' status. |
| 1417 | - if ( $status == 'completed' || $status == 'complete' ) { |
|
| 1417 | + if ($status == 'completed' || $status == 'complete') { |
|
| 1418 | 1418 | $status = 'publish'; |
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | - $old_status = ! empty( $this->old_status ) ? $this->old_status : false; |
|
| 1421 | + $old_status = ! empty($this->old_status) ? $this->old_status : false; |
|
| 1422 | 1422 | |
| 1423 | - if ( $old_status === $status ) { |
|
| 1423 | + if ($old_status === $status) { |
|
| 1424 | 1424 | return false; // Don't permit status changes that aren't changes. |
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | - $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); |
|
| 1427 | + $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status); |
|
| 1428 | 1428 | |
| 1429 | 1429 | $updated = false; |
| 1430 | 1430 | |
| 1431 | - if ( $do_change ) { |
|
| 1431 | + if ($do_change) { |
|
| 1432 | 1432 | |
| 1433 | 1433 | /** |
| 1434 | 1434 | * Fires before changing payment status. |
@@ -1439,21 +1439,21 @@ discard block |
||
| 1439 | 1439 | * @param string $status The new status. |
| 1440 | 1440 | * @param string $old_status The old status. |
| 1441 | 1441 | */ |
| 1442 | - do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); |
|
| 1442 | + do_action('give_before_payment_status_change', $this->ID, $status, $old_status); |
|
| 1443 | 1443 | |
| 1444 | 1444 | $update_fields = array( |
| 1445 | 1445 | 'ID' => $this->ID, |
| 1446 | 1446 | 'post_status' => $status, |
| 1447 | - 'edit_date' => current_time( 'mysql' ), |
|
| 1447 | + 'edit_date' => current_time('mysql'), |
|
| 1448 | 1448 | ); |
| 1449 | 1449 | |
| 1450 | - $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); |
|
| 1450 | + $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields)); |
|
| 1451 | 1451 | |
| 1452 | 1452 | $all_payment_statuses = give_get_payment_statuses(); |
| 1453 | - $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); |
|
| 1453 | + $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status); |
|
| 1454 | 1454 | |
| 1455 | 1455 | // Process any specific status functions. |
| 1456 | - switch ( $status ) { |
|
| 1456 | + switch ($status) { |
|
| 1457 | 1457 | case 'refunded': |
| 1458 | 1458 | $this->process_refund(); |
| 1459 | 1459 | break; |
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | * @param string $status The new status. |
| 1481 | 1481 | * @param string $old_status The old status. |
| 1482 | 1482 | */ |
| 1483 | - do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); |
|
| 1483 | + do_action('give_update_payment_status', $this->ID, $status, $old_status); |
|
| 1484 | 1484 | |
| 1485 | 1485 | } |
| 1486 | 1486 | |
@@ -1515,33 +1515,33 @@ discard block |
||
| 1515 | 1515 | * |
| 1516 | 1516 | * @return mixed The value from the post meta |
| 1517 | 1517 | */ |
| 1518 | - public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { |
|
| 1518 | + public function get_meta($meta_key = '_give_payment_meta', $single = true) { |
|
| 1519 | 1519 | |
| 1520 | - $meta = get_post_meta( $this->ID, $meta_key, $single ); |
|
| 1520 | + $meta = get_post_meta($this->ID, $meta_key, $single); |
|
| 1521 | 1521 | |
| 1522 | - if ( $meta_key === '_give_payment_meta' ) { |
|
| 1522 | + if ($meta_key === '_give_payment_meta') { |
|
| 1523 | 1523 | $meta = (array) $meta; |
| 1524 | 1524 | |
| 1525 | - if ( empty( $meta['key'] ) ) { |
|
| 1525 | + if (empty($meta['key'])) { |
|
| 1526 | 1526 | $meta['key'] = $this->setup_payment_key(); |
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | - if ( empty( $meta['form_title'] ) ) { |
|
| 1529 | + if (empty($meta['form_title'])) { |
|
| 1530 | 1530 | $meta['form_title'] = $this->setup_form_title(); |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | - if ( empty( $meta['email'] ) ) { |
|
| 1533 | + if (empty($meta['email'])) { |
|
| 1534 | 1534 | $meta['email'] = $this->setup_email(); |
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | - if ( empty( $meta['date'] ) ) { |
|
| 1538 | - $meta['date'] = get_post_field( 'post_date', $this->ID ); |
|
| 1537 | + if (empty($meta['date'])) { |
|
| 1538 | + $meta['date'] = get_post_field('post_date', $this->ID); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | - $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); |
|
| 1542 | + $meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID); |
|
| 1543 | 1543 | |
| 1544 | - return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); |
|
| 1544 | + return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key); |
|
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | 1547 | /** |
@@ -1556,23 +1556,23 @@ discard block |
||
| 1556 | 1556 | * |
| 1557 | 1557 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure |
| 1558 | 1558 | */ |
| 1559 | - public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
| 1560 | - if ( empty( $meta_key ) ) { |
|
| 1559 | + public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') { |
|
| 1560 | + if (empty($meta_key)) { |
|
| 1561 | 1561 | return false; |
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | - if ( $meta_key == 'key' || $meta_key == 'date' ) { |
|
| 1564 | + if ($meta_key == 'key' || $meta_key == 'date') { |
|
| 1565 | 1565 | |
| 1566 | 1566 | $current_meta = $this->get_meta(); |
| 1567 | - $current_meta[ $meta_key ] = $meta_value; |
|
| 1567 | + $current_meta[$meta_key] = $meta_value; |
|
| 1568 | 1568 | |
| 1569 | 1569 | $meta_key = '_give_payment_meta'; |
| 1570 | 1570 | $meta_value = $current_meta; |
| 1571 | 1571 | |
| 1572 | - } elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) { |
|
| 1572 | + } elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') { |
|
| 1573 | 1573 | |
| 1574 | - $meta_value = apply_filters( "give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
| 1575 | - update_post_meta( $this->ID, '_give_payment_user_email', $meta_value ); |
|
| 1574 | + $meta_value = apply_filters("give_give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
| 1575 | + update_post_meta($this->ID, '_give_payment_user_email', $meta_value); |
|
| 1576 | 1576 | |
| 1577 | 1577 | $current_meta = $this->get_meta(); |
| 1578 | 1578 | $current_meta['user_info']['email'] = $meta_value; |
@@ -1582,9 +1582,9 @@ discard block |
||
| 1582 | 1582 | |
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
| 1585 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
| 1586 | 1586 | |
| 1587 | - return update_post_meta( $this->ID, $meta_key, $meta_value, $prev_value ); |
|
| 1587 | + return update_post_meta($this->ID, $meta_key, $meta_value, $prev_value); |
|
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | /** |
@@ -1599,14 +1599,14 @@ discard block |
||
| 1599 | 1599 | $process_refund = true; |
| 1600 | 1600 | |
| 1601 | 1601 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
| 1602 | - if ( 'publish' != $this->old_status || 'refunded' != $this->status ) { |
|
| 1602 | + if ('publish' != $this->old_status || 'refunded' != $this->status) { |
|
| 1603 | 1603 | $process_refund = false; |
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | 1606 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1607 | - $process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this ); |
|
| 1607 | + $process_refund = apply_filters('give_should_process_refund', $process_refund, $this); |
|
| 1608 | 1608 | |
| 1609 | - if ( false === $process_refund ) { |
|
| 1609 | + if (false === $process_refund) { |
|
| 1610 | 1610 | return; |
| 1611 | 1611 | } |
| 1612 | 1612 | |
@@ -1617,17 +1617,17 @@ discard block |
||
| 1617 | 1617 | * |
| 1618 | 1618 | * @param Give_Payment $this Payment object. |
| 1619 | 1619 | */ |
| 1620 | - do_action( 'give_pre_refund_payment', $this ); |
|
| 1620 | + do_action('give_pre_refund_payment', $this); |
|
| 1621 | 1621 | |
| 1622 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this ); |
|
| 1623 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this ); |
|
| 1624 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this ); |
|
| 1622 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this); |
|
| 1623 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this); |
|
| 1624 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this); |
|
| 1625 | 1625 | |
| 1626 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
| 1626 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
| 1627 | 1627 | $this->delete_sales_logs(); |
| 1628 | 1628 | |
| 1629 | 1629 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
| 1630 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 1630 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 1631 | 1631 | |
| 1632 | 1632 | /** |
| 1633 | 1633 | * Fires after refunding payment. |
@@ -1636,7 +1636,7 @@ discard block |
||
| 1636 | 1636 | * |
| 1637 | 1637 | * @param Give_Payment $this Payment object. |
| 1638 | 1638 | */ |
| 1639 | - do_action( 'give_post_refund_payment', $this ); |
|
| 1639 | + do_action('give_post_refund_payment', $this); |
|
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | /** |
@@ -1663,29 +1663,29 @@ discard block |
||
| 1663 | 1663 | $process_pending = true; |
| 1664 | 1664 | |
| 1665 | 1665 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
| 1666 | - if ( 'publish' != $this->old_status || 'pending' != $this->status ) { |
|
| 1666 | + if ('publish' != $this->old_status || 'pending' != $this->status) { |
|
| 1667 | 1667 | $process_pending = false; |
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1671 | - $process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this ); |
|
| 1671 | + $process_pending = apply_filters('give_should_process_pending', $process_pending, $this); |
|
| 1672 | 1672 | |
| 1673 | - if ( false === $process_pending ) { |
|
| 1673 | + if (false === $process_pending) { |
|
| 1674 | 1674 | return; |
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_pending', true, $this ); |
|
| 1678 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_pending', true, $this ); |
|
| 1679 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_pending', true, $this ); |
|
| 1677 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_pending', true, $this); |
|
| 1678 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_pending', true, $this); |
|
| 1679 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_pending', true, $this); |
|
| 1680 | 1680 | |
| 1681 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
| 1681 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
| 1682 | 1682 | $this->delete_sales_logs(); |
| 1683 | 1683 | |
| 1684 | 1684 | $this->completed_date = false; |
| 1685 | - $this->update_meta( '_give_completed_date', '' ); |
|
| 1685 | + $this->update_meta('_give_completed_date', ''); |
|
| 1686 | 1686 | |
| 1687 | 1687 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
| 1688 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 1688 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | /** |
@@ -1700,29 +1700,29 @@ discard block |
||
| 1700 | 1700 | $process_cancelled = true; |
| 1701 | 1701 | |
| 1702 | 1702 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
| 1703 | - if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) { |
|
| 1703 | + if ('publish' != $this->old_status || 'cancelled' != $this->status) { |
|
| 1704 | 1704 | $process_cancelled = false; |
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1708 | - $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this ); |
|
| 1708 | + $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this); |
|
| 1709 | 1709 | |
| 1710 | - if ( false === $process_cancelled ) { |
|
| 1710 | + if (false === $process_cancelled) { |
|
| 1711 | 1711 | return; |
| 1712 | 1712 | } |
| 1713 | 1713 | |
| 1714 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_cancelled', true, $this ); |
|
| 1715 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_cancelled', true, $this ); |
|
| 1716 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_cancelled', true, $this ); |
|
| 1714 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_cancelled', true, $this); |
|
| 1715 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_cancelled', true, $this); |
|
| 1716 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_cancelled', true, $this); |
|
| 1717 | 1717 | |
| 1718 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
| 1718 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
| 1719 | 1719 | $this->delete_sales_logs(); |
| 1720 | 1720 | |
| 1721 | 1721 | $this->completed_date = false; |
| 1722 | - $this->update_meta( '_give_completed_date', '' ); |
|
| 1722 | + $this->update_meta('_give_completed_date', ''); |
|
| 1723 | 1723 | |
| 1724 | 1724 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
| 1725 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 1725 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | 1728 | /** |
@@ -1735,29 +1735,29 @@ discard block |
||
| 1735 | 1735 | $process_revoked = true; |
| 1736 | 1736 | |
| 1737 | 1737 | // If the payment was not in publish, don't decrement stats as they were never incremented. |
| 1738 | - if ( 'publish' != $this->old_status || 'revoked' != $this->status ) { |
|
| 1738 | + if ('publish' != $this->old_status || 'revoked' != $this->status) { |
|
| 1739 | 1739 | $process_revoked = false; |
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1743 | - $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this ); |
|
| 1743 | + $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this); |
|
| 1744 | 1744 | |
| 1745 | - if ( false === $process_revoked ) { |
|
| 1745 | + if (false === $process_revoked) { |
|
| 1746 | 1746 | return; |
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | - $decrease_store_earnings = apply_filters( 'give_decrease_store_earnings_on_revoked', true, $this ); |
|
| 1750 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_revoked', true, $this ); |
|
| 1751 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_revoked', true, $this ); |
|
| 1749 | + $decrease_store_earnings = apply_filters('give_decrease_store_earnings_on_revoked', true, $this); |
|
| 1750 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_revoked', true, $this); |
|
| 1751 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_revoked', true, $this); |
|
| 1752 | 1752 | |
| 1753 | - $this->maybe_alter_stats( $decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
| 1753 | + $this->maybe_alter_stats($decrease_store_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
| 1754 | 1754 | $this->delete_sales_logs(); |
| 1755 | 1755 | |
| 1756 | 1756 | $this->completed_date = false; |
| 1757 | - $this->update_meta( '_give_completed_date', '' ); |
|
| 1757 | + $this->update_meta('_give_completed_date', ''); |
|
| 1758 | 1758 | |
| 1759 | 1759 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
| 1760 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
| 1760 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
| 1761 | 1761 | } |
| 1762 | 1762 | |
| 1763 | 1763 | /** |
@@ -1772,25 +1772,25 @@ discard block |
||
| 1772 | 1772 | * |
| 1773 | 1773 | * @return void |
| 1774 | 1774 | */ |
| 1775 | - private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { |
|
| 1775 | + private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) { |
|
| 1776 | 1776 | |
| 1777 | - give_undo_purchase( false, $this->ID ); |
|
| 1777 | + give_undo_purchase(false, $this->ID); |
|
| 1778 | 1778 | |
| 1779 | 1779 | // Decrease store earnings. |
| 1780 | - if ( true === $alter_store_earnings ) { |
|
| 1781 | - give_decrease_total_earnings( $this->total ); |
|
| 1780 | + if (true === $alter_store_earnings) { |
|
| 1781 | + give_decrease_total_earnings($this->total); |
|
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | // Decrement the stats for the customer. |
| 1785 | - if ( ! empty( $this->customer_id ) ) { |
|
| 1785 | + if ( ! empty($this->customer_id)) { |
|
| 1786 | 1786 | |
| 1787 | - $customer = new Give_Customer( $this->customer_id ); |
|
| 1787 | + $customer = new Give_Customer($this->customer_id); |
|
| 1788 | 1788 | |
| 1789 | - if ( true === $alter_customer_value ) { |
|
| 1790 | - $customer->decrease_value( $this->total ); |
|
| 1789 | + if (true === $alter_customer_value) { |
|
| 1790 | + $customer->decrease_value($this->total); |
|
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | - if ( true === $alter_customer_purchase_count ) { |
|
| 1793 | + if (true === $alter_customer_purchase_count) { |
|
| 1794 | 1794 | $customer->decrease_purchase_count(); |
| 1795 | 1795 | } |
| 1796 | 1796 | } |
@@ -1839,13 +1839,13 @@ discard block |
||
| 1839 | 1839 | * @return string The date the payment was completed |
| 1840 | 1840 | */ |
| 1841 | 1841 | private function setup_completed_date() { |
| 1842 | - $payment = get_post( $this->ID ); |
|
| 1842 | + $payment = get_post($this->ID); |
|
| 1843 | 1843 | |
| 1844 | - if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) { |
|
| 1844 | + if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) { |
|
| 1845 | 1845 | return false; // This payment was never completed. |
| 1846 | 1846 | } |
| 1847 | 1847 | |
| 1848 | - $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; |
|
| 1848 | + $date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date; |
|
| 1849 | 1849 | |
| 1850 | 1850 | return $date; |
| 1851 | 1851 | } |
@@ -1859,7 +1859,7 @@ discard block |
||
| 1859 | 1859 | * @return string The payment mode |
| 1860 | 1860 | */ |
| 1861 | 1861 | private function setup_mode() { |
| 1862 | - return $this->get_meta( '_give_payment_mode' ); |
|
| 1862 | + return $this->get_meta('_give_payment_mode'); |
|
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | 1865 | /** |
@@ -1871,19 +1871,19 @@ discard block |
||
| 1871 | 1871 | * @return float The payment total |
| 1872 | 1872 | */ |
| 1873 | 1873 | private function setup_total() { |
| 1874 | - $amount = $this->get_meta( '_give_payment_total', true ); |
|
| 1874 | + $amount = $this->get_meta('_give_payment_total', true); |
|
| 1875 | 1875 | |
| 1876 | - if ( empty( $amount ) && '0.00' != $amount ) { |
|
| 1877 | - $meta = $this->get_meta( '_give_payment_meta', true ); |
|
| 1878 | - $meta = maybe_unserialize( $meta ); |
|
| 1876 | + if (empty($amount) && '0.00' != $amount) { |
|
| 1877 | + $meta = $this->get_meta('_give_payment_meta', true); |
|
| 1878 | + $meta = maybe_unserialize($meta); |
|
| 1879 | 1879 | |
| 1880 | - if ( isset( $meta['amount'] ) ) { |
|
| 1880 | + if (isset($meta['amount'])) { |
|
| 1881 | 1881 | $amount = $meta['amount']; |
| 1882 | 1882 | } |
| 1883 | 1883 | } |
| 1884 | 1884 | |
| 1885 | 1885 | |
| 1886 | - return round( floatval( $amount ), give_currency_decimal_filter() ); |
|
| 1886 | + return round(floatval($amount), give_currency_decimal_filter()); |
|
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | 1889 | /** |
@@ -1911,9 +1911,9 @@ discard block |
||
| 1911 | 1911 | private function setup_fees_total() { |
| 1912 | 1912 | $fees_total = (float) 0.00; |
| 1913 | 1913 | |
| 1914 | - $payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array(); |
|
| 1915 | - if ( ! empty( $payment_fees ) ) { |
|
| 1916 | - foreach ( $payment_fees as $fee ) { |
|
| 1914 | + $payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array(); |
|
| 1915 | + if ( ! empty($payment_fees)) { |
|
| 1916 | + foreach ($payment_fees as $fee) { |
|
| 1917 | 1917 | $fees_total += (float) $fee['amount']; |
| 1918 | 1918 | } |
| 1919 | 1919 | } |
@@ -1931,7 +1931,7 @@ discard block |
||
| 1931 | 1931 | * @return string The currency for the payment |
| 1932 | 1932 | */ |
| 1933 | 1933 | private function setup_currency() { |
| 1934 | - $currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this ); |
|
| 1934 | + $currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this); |
|
| 1935 | 1935 | |
| 1936 | 1936 | return $currency; |
| 1937 | 1937 | } |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | * @return array The Fees |
| 1946 | 1946 | */ |
| 1947 | 1947 | private function setup_fees() { |
| 1948 | - $payment_fees = isset( $this->payment_meta['fees'] ) ? $this->payment_meta['fees'] : array(); |
|
| 1948 | + $payment_fees = isset($this->payment_meta['fees']) ? $this->payment_meta['fees'] : array(); |
|
| 1949 | 1949 | |
| 1950 | 1950 | return $payment_fees; |
| 1951 | 1951 | } |
@@ -1959,7 +1959,7 @@ discard block |
||
| 1959 | 1959 | * @return string The gateway |
| 1960 | 1960 | */ |
| 1961 | 1961 | private function setup_gateway() { |
| 1962 | - $gateway = $this->get_meta( '_give_payment_gateway', true ); |
|
| 1962 | + $gateway = $this->get_meta('_give_payment_gateway', true); |
|
| 1963 | 1963 | |
| 1964 | 1964 | return $gateway; |
| 1965 | 1965 | } |
@@ -1973,11 +1973,11 @@ discard block |
||
| 1973 | 1973 | * @return string The donation ID |
| 1974 | 1974 | */ |
| 1975 | 1975 | private function setup_transaction_id() { |
| 1976 | - $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); |
|
| 1976 | + $transaction_id = $this->get_meta('_give_payment_transaction_id', true); |
|
| 1977 | 1977 | |
| 1978 | - if ( empty( $transaction_id ) ) { |
|
| 1978 | + if (empty($transaction_id)) { |
|
| 1979 | 1979 | $gateway = $this->gateway; |
| 1980 | - $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); |
|
| 1980 | + $transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID); |
|
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | 1983 | return $transaction_id; |
@@ -1992,7 +1992,7 @@ discard block |
||
| 1992 | 1992 | * @return string The IP address for the payment |
| 1993 | 1993 | */ |
| 1994 | 1994 | private function setup_ip() { |
| 1995 | - $ip = $this->get_meta( '_give_payment_user_ip', true ); |
|
| 1995 | + $ip = $this->get_meta('_give_payment_user_ip', true); |
|
| 1996 | 1996 | |
| 1997 | 1997 | return $ip; |
| 1998 | 1998 | } |
@@ -2006,7 +2006,7 @@ discard block |
||
| 2006 | 2006 | * @return int The Customer ID |
| 2007 | 2007 | */ |
| 2008 | 2008 | private function setup_customer_id() { |
| 2009 | - $customer_id = $this->get_meta( '_give_payment_customer_id', true ); |
|
| 2009 | + $customer_id = $this->get_meta('_give_payment_customer_id', true); |
|
| 2010 | 2010 | |
| 2011 | 2011 | return $customer_id; |
| 2012 | 2012 | } |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | * @return int The User ID |
| 2021 | 2021 | */ |
| 2022 | 2022 | private function setup_user_id() { |
| 2023 | - $user_id = $this->get_meta( '_give_payment_user_id', true ); |
|
| 2023 | + $user_id = $this->get_meta('_give_payment_user_id', true); |
|
| 2024 | 2024 | |
| 2025 | 2025 | return $user_id; |
| 2026 | 2026 | } |
@@ -2034,10 +2034,10 @@ discard block |
||
| 2034 | 2034 | * @return string The email address for the payment |
| 2035 | 2035 | */ |
| 2036 | 2036 | private function setup_email() { |
| 2037 | - $email = $this->get_meta( '_give_payment_user_email', true ); |
|
| 2037 | + $email = $this->get_meta('_give_payment_user_email', true); |
|
| 2038 | 2038 | |
| 2039 | - if ( empty( $email ) ) { |
|
| 2040 | - $email = Give()->customers->get_column( 'email', $this->customer_id ); |
|
| 2039 | + if (empty($email)) { |
|
| 2040 | + $email = Give()->customers->get_column('email', $this->customer_id); |
|
| 2041 | 2041 | } |
| 2042 | 2042 | |
| 2043 | 2043 | return $email; |
@@ -2057,15 +2057,15 @@ discard block |
||
| 2057 | 2057 | 'last_name' => $this->last_name, |
| 2058 | 2058 | ); |
| 2059 | 2059 | |
| 2060 | - $user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array(); |
|
| 2061 | - $user_info = wp_parse_args( $user_info, $defaults ); |
|
| 2060 | + $user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array(); |
|
| 2061 | + $user_info = wp_parse_args($user_info, $defaults); |
|
| 2062 | 2062 | |
| 2063 | - if ( empty( $user_info ) ) { |
|
| 2063 | + if (empty($user_info)) { |
|
| 2064 | 2064 | // Get the customer, but only if it's been created. |
| 2065 | - $customer = new Give_Customer( $this->customer_id ); |
|
| 2065 | + $customer = new Give_Customer($this->customer_id); |
|
| 2066 | 2066 | |
| 2067 | - if ( $customer->id > 0 ) { |
|
| 2068 | - $name = explode( ' ', $customer->name, 2 ); |
|
| 2067 | + if ($customer->id > 0) { |
|
| 2068 | + $name = explode(' ', $customer->name, 2); |
|
| 2069 | 2069 | $user_info = array( |
| 2070 | 2070 | 'first_name' => $name[0], |
| 2071 | 2071 | 'last_name' => $name[1], |
@@ -2075,29 +2075,29 @@ discard block |
||
| 2075 | 2075 | } |
| 2076 | 2076 | } else { |
| 2077 | 2077 | // Get the customer, but only if it's been created. |
| 2078 | - $customer = new Give_Customer( $this->customer_id ); |
|
| 2079 | - if ( $customer->id > 0 ) { |
|
| 2080 | - foreach ( $user_info as $key => $value ) { |
|
| 2081 | - if ( ! empty( $value ) ) { |
|
| 2078 | + $customer = new Give_Customer($this->customer_id); |
|
| 2079 | + if ($customer->id > 0) { |
|
| 2080 | + foreach ($user_info as $key => $value) { |
|
| 2081 | + if ( ! empty($value)) { |
|
| 2082 | 2082 | continue; |
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | - switch ( $key ) { |
|
| 2085 | + switch ($key) { |
|
| 2086 | 2086 | case 'first_name': |
| 2087 | - $name = explode( ' ', $customer->name, 2 ); |
|
| 2087 | + $name = explode(' ', $customer->name, 2); |
|
| 2088 | 2088 | |
| 2089 | - $user_info[ $key ] = $name[0]; |
|
| 2089 | + $user_info[$key] = $name[0]; |
|
| 2090 | 2090 | break; |
| 2091 | 2091 | |
| 2092 | 2092 | case 'last_name': |
| 2093 | - $name = explode( ' ', $customer->name, 2 ); |
|
| 2094 | - $last_name = ! empty( $name[1] ) ? $name[1] : ''; |
|
| 2093 | + $name = explode(' ', $customer->name, 2); |
|
| 2094 | + $last_name = ! empty($name[1]) ? $name[1] : ''; |
|
| 2095 | 2095 | |
| 2096 | - $user_info[ $key ] = $last_name; |
|
| 2096 | + $user_info[$key] = $last_name; |
|
| 2097 | 2097 | break; |
| 2098 | 2098 | |
| 2099 | 2099 | case 'email': |
| 2100 | - $user_info[ $key ] = $customer->email; |
|
| 2100 | + $user_info[$key] = $customer->email; |
|
| 2101 | 2101 | break; |
| 2102 | 2102 | } |
| 2103 | 2103 | } |
@@ -2118,7 +2118,7 @@ discard block |
||
| 2118 | 2118 | */ |
| 2119 | 2119 | private function setup_address() { |
| 2120 | 2120 | |
| 2121 | - $address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array( |
|
| 2121 | + $address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array( |
|
| 2122 | 2122 | 'line1' => '', |
| 2123 | 2123 | 'line2' => '', |
| 2124 | 2124 | 'city' => '', |
@@ -2140,7 +2140,7 @@ discard block |
||
| 2140 | 2140 | */ |
| 2141 | 2141 | private function setup_form_title() { |
| 2142 | 2142 | |
| 2143 | - $form_id = $this->get_meta( '_give_payment_form_title', true ); |
|
| 2143 | + $form_id = $this->get_meta('_give_payment_form_title', true); |
|
| 2144 | 2144 | |
| 2145 | 2145 | return $form_id; |
| 2146 | 2146 | } |
@@ -2155,7 +2155,7 @@ discard block |
||
| 2155 | 2155 | */ |
| 2156 | 2156 | private function setup_form_id() { |
| 2157 | 2157 | |
| 2158 | - $form_id = $this->get_meta( '_give_payment_form_id', true ); |
|
| 2158 | + $form_id = $this->get_meta('_give_payment_form_id', true); |
|
| 2159 | 2159 | |
| 2160 | 2160 | return $form_id; |
| 2161 | 2161 | } |
@@ -2169,7 +2169,7 @@ discard block |
||
| 2169 | 2169 | * @return int The Form Price ID |
| 2170 | 2170 | */ |
| 2171 | 2171 | private function setup_price_id() { |
| 2172 | - $price_id = $this->get_meta( '_give_payment_price_id', true ); |
|
| 2172 | + $price_id = $this->get_meta('_give_payment_price_id', true); |
|
| 2173 | 2173 | |
| 2174 | 2174 | return $price_id; |
| 2175 | 2175 | } |
@@ -2183,7 +2183,7 @@ discard block |
||
| 2183 | 2183 | * @return string The Payment Key |
| 2184 | 2184 | */ |
| 2185 | 2185 | private function setup_payment_key() { |
| 2186 | - $key = $this->get_meta( '_give_payment_purchase_key', true ); |
|
| 2186 | + $key = $this->get_meta('_give_payment_purchase_key', true); |
|
| 2187 | 2187 | |
| 2188 | 2188 | return $key; |
| 2189 | 2189 | } |
@@ -2199,11 +2199,11 @@ discard block |
||
| 2199 | 2199 | private function setup_payment_number() { |
| 2200 | 2200 | $number = $this->ID; |
| 2201 | 2201 | |
| 2202 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 2202 | + if (give_get_option('enable_sequential')) { |
|
| 2203 | 2203 | |
| 2204 | - $number = $this->get_meta( '_give_payment_number', true ); |
|
| 2204 | + $number = $this->get_meta('_give_payment_number', true); |
|
| 2205 | 2205 | |
| 2206 | - if ( ! $number ) { |
|
| 2206 | + if ( ! $number) { |
|
| 2207 | 2207 | |
| 2208 | 2208 | $number = $this->ID; |
| 2209 | 2209 | |
@@ -2221,7 +2221,7 @@ discard block |
||
| 2221 | 2221 | * @return array The payment object as an array |
| 2222 | 2222 | */ |
| 2223 | 2223 | public function array_convert() { |
| 2224 | - return get_object_vars( $this ); |
|
| 2224 | + return get_object_vars($this); |
|
| 2225 | 2225 | } |
| 2226 | 2226 | |
| 2227 | 2227 | |
@@ -2234,7 +2234,7 @@ discard block |
||
| 2234 | 2234 | * @return bool |
| 2235 | 2235 | */ |
| 2236 | 2236 | public function is_completed() { |
| 2237 | - return ( 'publish' === $this->status && $this->completed_date ); |
|
| 2237 | + return ('publish' === $this->status && $this->completed_date); |
|
| 2238 | 2238 | } |
| 2239 | 2239 | |
| 2240 | 2240 | /** |
@@ -2246,7 +2246,7 @@ discard block |
||
| 2246 | 2246 | * @return string Date payment was completed |
| 2247 | 2247 | */ |
| 2248 | 2248 | private function get_completed_date() { |
| 2249 | - return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); |
|
| 2249 | + return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this); |
|
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | /** |
@@ -2258,7 +2258,7 @@ discard block |
||
| 2258 | 2258 | * @return float Payment subtotal |
| 2259 | 2259 | */ |
| 2260 | 2260 | private function get_subtotal() { |
| 2261 | - return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); |
|
| 2261 | + return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this); |
|
| 2262 | 2262 | } |
| 2263 | 2263 | |
| 2264 | 2264 | /** |
@@ -2270,7 +2270,7 @@ discard block |
||
| 2270 | 2270 | * @return string Payment currency code |
| 2271 | 2271 | */ |
| 2272 | 2272 | private function get_currency() { |
| 2273 | - return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); |
|
| 2273 | + return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this); |
|
| 2274 | 2274 | } |
| 2275 | 2275 | |
| 2276 | 2276 | /** |
@@ -2282,7 +2282,7 @@ discard block |
||
| 2282 | 2282 | * @return string Gateway used |
| 2283 | 2283 | */ |
| 2284 | 2284 | private function get_gateway() { |
| 2285 | - return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); |
|
| 2285 | + return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this); |
|
| 2286 | 2286 | } |
| 2287 | 2287 | |
| 2288 | 2288 | /** |
@@ -2294,7 +2294,7 @@ discard block |
||
| 2294 | 2294 | * @return string Donation ID from merchant processor |
| 2295 | 2295 | */ |
| 2296 | 2296 | private function get_transaction_id() { |
| 2297 | - return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); |
|
| 2297 | + return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this); |
|
| 2298 | 2298 | } |
| 2299 | 2299 | |
| 2300 | 2300 | /** |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | * @return string Payment IP address |
| 2307 | 2307 | */ |
| 2308 | 2308 | private function get_ip() { |
| 2309 | - return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); |
|
| 2309 | + return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this); |
|
| 2310 | 2310 | } |
| 2311 | 2311 | |
| 2312 | 2312 | /** |
@@ -2318,7 +2318,7 @@ discard block |
||
| 2318 | 2318 | * @return int Payment customer ID |
| 2319 | 2319 | */ |
| 2320 | 2320 | private function get_customer_id() { |
| 2321 | - return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); |
|
| 2321 | + return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this); |
|
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | 2324 | /** |
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | * @return int Payment user ID |
| 2331 | 2331 | */ |
| 2332 | 2332 | private function get_user_id() { |
| 2333 | - return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); |
|
| 2333 | + return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this); |
|
| 2334 | 2334 | } |
| 2335 | 2335 | |
| 2336 | 2336 | /** |
@@ -2342,7 +2342,7 @@ discard block |
||
| 2342 | 2342 | * @return string Payment customer email |
| 2343 | 2343 | */ |
| 2344 | 2344 | private function get_email() { |
| 2345 | - return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); |
|
| 2345 | + return apply_filters('give_payment_user_email', $this->email, $this->ID, $this); |
|
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | 2348 | /** |
@@ -2354,7 +2354,7 @@ discard block |
||
| 2354 | 2354 | * @return array Payment user info |
| 2355 | 2355 | */ |
| 2356 | 2356 | private function get_user_info() { |
| 2357 | - return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); |
|
| 2357 | + return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this); |
|
| 2358 | 2358 | } |
| 2359 | 2359 | |
| 2360 | 2360 | /** |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | * @return array Payment billing address |
| 2367 | 2367 | */ |
| 2368 | 2368 | private function get_address() { |
| 2369 | - return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); |
|
| 2369 | + return apply_filters('give_payment_address', $this->address, $this->ID, $this); |
|
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | /** |
@@ -2378,7 +2378,7 @@ discard block |
||
| 2378 | 2378 | * @return string Payment key |
| 2379 | 2379 | */ |
| 2380 | 2380 | private function get_key() { |
| 2381 | - return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); |
|
| 2381 | + return apply_filters('give_payment_key', $this->key, $this->ID, $this); |
|
| 2382 | 2382 | } |
| 2383 | 2383 | |
| 2384 | 2384 | /** |
@@ -2390,7 +2390,7 @@ discard block |
||
| 2390 | 2390 | * @return string Payment form id |
| 2391 | 2391 | */ |
| 2392 | 2392 | private function get_form_id() { |
| 2393 | - return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); |
|
| 2393 | + return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this); |
|
| 2394 | 2394 | } |
| 2395 | 2395 | |
| 2396 | 2396 | /** |
@@ -2402,7 +2402,7 @@ discard block |
||
| 2402 | 2402 | * @return int|string Payment number |
| 2403 | 2403 | */ |
| 2404 | 2404 | private function get_number() { |
| 2405 | - return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); |
|
| 2405 | + return apply_filters('give_payment_number', $this->number, $this->ID, $this); |
|
| 2406 | 2406 | } |
| 2407 | 2407 | |
| 2408 | 2408 | } |