@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults. |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
124 | - 'ajax' => false, // Does this table support ajax? |
|
125 | - ) ); |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
124 | + 'ajax' => false, // Does this table support ajax? |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -135,29 +135,29 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | public function advanced_filters() { |
138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
141 | 141 | ?> |
142 | 142 | <div id="give-payment-filters"> |
143 | 143 | <span id="give-payment-date-filters"> |
144 | 144 | <label for="start-date" |
145 | - class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
145 | + class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
146 | 146 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
147 | 147 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
148 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
148 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
149 | 149 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
150 | 150 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
151 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
151 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
152 | 152 | </span> |
153 | - <?php if ( ! empty( $status ) ) : ?> |
|
154 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
153 | + <?php if ( ! empty($status)) : ?> |
|
154 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
155 | 155 | <?php endif; ?> |
156 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
157 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
158 | - class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
156 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
157 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
158 | + class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
159 | 159 | <?php endif; ?> |
160 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
160 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
161 | 161 | </div> |
162 | 162 | |
163 | 163 | <?php |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function search_box( $text, $input_id ) { |
|
178 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
177 | + public function search_box($text, $input_id) { |
|
178 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - $input_id = $input_id . '-search-input'; |
|
182 | + $input_id = $input_id.'-search-input'; |
|
183 | 183 | |
184 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
185 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
184 | + if ( ! empty($_REQUEST['orderby'])) { |
|
185 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
186 | 186 | } |
187 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
188 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
187 | + if ( ! empty($_REQUEST['order'])) { |
|
188 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
189 | 189 | } |
190 | 190 | ?> |
191 | 191 | <p class="search-box" role="search"> |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @since 1.7 |
199 | 199 | */ |
200 | - do_action( 'give_payment_history_search' ); |
|
200 | + do_action('give_payment_history_search'); |
|
201 | 201 | ?> |
202 | 202 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
203 | 203 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
204 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
204 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
205 | 205 | </p> |
206 | 206 | <?php |
207 | 207 | } |
@@ -215,52 +215,52 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function get_views() { |
217 | 217 | |
218 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
219 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
220 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
221 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
222 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
223 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
224 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
225 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
226 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
218 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
219 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
220 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
221 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
222 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
223 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
224 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
225 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
226 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
227 | 227 | |
228 | 228 | $views = array( |
229 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
229 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
230 | 230 | 'status', |
231 | 231 | 'paged', |
232 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
233 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
232 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
233 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
234 | 234 | 'status' => 'publish', |
235 | 235 | 'paged' => false, |
236 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
237 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
236 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
237 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
238 | 238 | 'status' => 'pending', |
239 | 239 | 'paged' => false, |
240 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
241 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
240 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
241 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
242 | 242 | 'status' => 'refunded', |
243 | 243 | 'paged' => false, |
244 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
245 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
244 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
245 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
246 | 246 | 'status' => 'revoked', |
247 | 247 | 'paged' => false, |
248 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
249 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
248 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
249 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
250 | 250 | 'status' => 'failed', |
251 | 251 | 'paged' => false, |
252 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
253 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
252 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
253 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
254 | 254 | 'status' => 'cancelled', |
255 | 255 | 'paged' => false, |
256 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
257 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
256 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
257 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
258 | 258 | 'status' => 'abandoned', |
259 | 259 | 'paged' => false, |
260 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
260 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
261 | 261 | ); |
262 | 262 | |
263 | - return apply_filters( 'give_payments_table_views', $views ); |
|
263 | + return apply_filters('give_payments_table_views', $views); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | public function get_columns() { |
274 | 274 | $columns = array( |
275 | 275 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
276 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
277 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
278 | - 'status' => esc_html__( 'Status', 'give' ), |
|
279 | - 'date' => esc_html__( 'Date', 'give' ), |
|
280 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
281 | - 'details' => esc_html__( 'Details', 'give' ), |
|
276 | + 'donation' => esc_html__('Donation', 'give'), |
|
277 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
278 | + 'status' => esc_html__('Status', 'give'), |
|
279 | + 'date' => esc_html__('Date', 'give'), |
|
280 | + 'amount' => esc_html__('Amount', 'give'), |
|
281 | + 'details' => esc_html__('Details', 'give'), |
|
282 | 282 | ); |
283 | 283 | |
284 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
284 | + return apply_filters('give_payments_table_columns', $columns); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function get_sortable_columns() { |
295 | 295 | $columns = array( |
296 | - 'donation' => array( 'ID', true ), |
|
297 | - 'donation_form' => array( 'donation_form', false ), |
|
298 | - 'status' => array( 'status', false ), |
|
299 | - 'amount' => array( 'amount', false ), |
|
300 | - 'date' => array( 'date', false ), |
|
296 | + 'donation' => array('ID', true), |
|
297 | + 'donation_form' => array('donation_form', false), |
|
298 | + 'status' => array('status', false), |
|
299 | + 'amount' => array('amount', false), |
|
300 | + 'date' => array('date', false), |
|
301 | 301 | ); |
302 | 302 | |
303 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
303 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -326,70 +326,70 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return string Column Name |
328 | 328 | */ |
329 | - public function column_default( $payment, $column_name ) { |
|
329 | + public function column_default($payment, $column_name) { |
|
330 | 330 | |
331 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
332 | - $row_actions = $this->get_row_actions( $payment ); |
|
331 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
332 | + $row_actions = $this->get_row_actions($payment); |
|
333 | 333 | |
334 | - switch ( $column_name ) { |
|
334 | + switch ($column_name) { |
|
335 | 335 | case 'donation' : |
336 | 336 | $value = sprintf( |
337 | 337 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
338 | 338 | $single_donation_url, |
339 | - sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), |
|
339 | + sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), |
|
340 | 340 | $payment->ID, |
341 | - esc_html__( 'by', 'give' ), |
|
342 | - $this->get_donor( $payment ) |
|
341 | + esc_html__('by', 'give'), |
|
342 | + $this->get_donor($payment) |
|
343 | 343 | ); |
344 | - $value .= $this->get_donor_email( $payment ); |
|
345 | - $value .= $this->row_actions( $row_actions ); |
|
344 | + $value .= $this->get_donor_email($payment); |
|
345 | + $value .= $this->row_actions($row_actions); |
|
346 | 346 | break; |
347 | 347 | |
348 | 348 | case 'amount' : |
349 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
350 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
351 | - $value .= sprintf( |
|
349 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
350 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
351 | + $value .= sprintf( |
|
352 | 352 | '<br><small>%1$s %2$s</small>', |
353 | - __( 'via', 'give' ), |
|
354 | - give_get_gateway_admin_label( $payment->gateway ) |
|
353 | + __('via', 'give'), |
|
354 | + give_get_gateway_admin_label($payment->gateway) |
|
355 | 355 | ); |
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'donation_form' : |
359 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
360 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
361 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
359 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
360 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
361 | + $level = give_get_payment_form_title($payment->meta, true); |
|
362 | 362 | |
363 | - if ( ! empty( $level ) ) { |
|
363 | + if ( ! empty($level)) { |
|
364 | 364 | $value .= $level; |
365 | 365 | } |
366 | 366 | |
367 | 367 | break; |
368 | 368 | |
369 | 369 | case 'date' : |
370 | - $date = strtotime( $payment->date ); |
|
371 | - $value = date_i18n( give_date_format(), $date ); |
|
370 | + $date = strtotime($payment->date); |
|
371 | + $value = date_i18n(give_date_format(), $date); |
|
372 | 372 | break; |
373 | 373 | |
374 | 374 | case 'status' : |
375 | - $value = $this->get_payment_status( $payment ); |
|
375 | + $value = $this->get_payment_status($payment); |
|
376 | 376 | break; |
377 | 377 | |
378 | 378 | case 'details' : |
379 | 379 | $value = sprintf( |
380 | 380 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
381 | 381 | $single_donation_url, |
382 | - sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) |
|
382 | + sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID) |
|
383 | 383 | ); |
384 | 384 | break; |
385 | 385 | |
386 | 386 | default: |
387 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
387 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
388 | 388 | break; |
389 | 389 | |
390 | 390 | } |
391 | 391 | |
392 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
392 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -402,17 +402,17 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @return string Data shown in the Email column |
404 | 404 | */ |
405 | - public function get_donor_email( $payment ) { |
|
405 | + public function get_donor_email($payment) { |
|
406 | 406 | |
407 | - $email = give_get_payment_user_email( $payment->ID ); |
|
407 | + $email = give_get_payment_user_email($payment->ID); |
|
408 | 408 | |
409 | - if ( empty( $email ) ) { |
|
410 | - $email = esc_html__( '(unknown)', 'give' ); |
|
409 | + if (empty($email)) { |
|
410 | + $email = esc_html__('(unknown)', 'give'); |
|
411 | 411 | } |
412 | 412 | |
413 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
413 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
414 | 414 | |
415 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
415 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -424,18 +424,18 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @return array $actions |
426 | 426 | */ |
427 | - function get_row_actions( $payment ) { |
|
427 | + function get_row_actions($payment) { |
|
428 | 428 | |
429 | 429 | $actions = array(); |
430 | - $email = give_get_payment_user_email( $payment->ID ); |
|
430 | + $email = give_get_payment_user_email($payment->ID); |
|
431 | 431 | |
432 | 432 | // Add search term string back to base URL. |
433 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
434 | - if ( ! empty( $search_terms ) ) { |
|
435 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
433 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
434 | + if ( ! empty($search_terms)) { |
|
435 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
436 | 436 | } |
437 | 437 | |
438 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
438 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
439 | 439 | |
440 | 440 | $actions['email_links'] = sprintf( |
441 | 441 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | ), |
450 | 450 | 'give_payment_nonce' |
451 | 451 | ), |
452 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
453 | - esc_html__( 'Resend Receipt', 'give' ) |
|
452 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
453 | + esc_html__('Resend Receipt', 'give') |
|
454 | 454 | ); |
455 | 455 | |
456 | 456 | } |
@@ -467,11 +467,11 @@ discard block |
||
467 | 467 | ), |
468 | 468 | 'give_donation_nonce' |
469 | 469 | ), |
470 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
471 | - esc_html__( 'Delete', 'give' ) |
|
470 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
471 | + esc_html__('Delete', 'give') |
|
472 | 472 | ); |
473 | 473 | |
474 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
474 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | * |
486 | 486 | * @return string Data shown in the Email column |
487 | 487 | */ |
488 | - function get_payment_status( $payment ) { |
|
489 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
490 | - if ( $payment->mode == 'test' ) { |
|
491 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
488 | + function get_payment_status($payment) { |
|
489 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
490 | + if ($payment->mode == 'test') { |
|
491 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | return $value; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @return string Displays a checkbox. |
506 | 506 | */ |
507 | - public function column_cb( $payment ) { |
|
507 | + public function column_cb($payment) { |
|
508 | 508 | return sprintf( |
509 | 509 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
510 | 510 | 'payment', |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | * |
523 | 523 | * @return string Displays a checkbox. |
524 | 524 | */ |
525 | - public function get_payment_id( $payment ) { |
|
526 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
525 | + public function get_payment_id($payment) { |
|
526 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -536,19 +536,19 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @return string Data shown in the User column |
538 | 538 | */ |
539 | - public function get_donor( $payment ) { |
|
539 | + public function get_donor($payment) { |
|
540 | 540 | |
541 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
541 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
542 | 542 | |
543 | - if ( ! empty( $customer_id ) ) { |
|
544 | - $customer = new Give_Customer( $customer_id ); |
|
545 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
543 | + if ( ! empty($customer_id)) { |
|
544 | + $customer = new Give_Customer($customer_id); |
|
545 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
546 | 546 | } else { |
547 | - $email = give_get_payment_user_email( $payment->ID ); |
|
548 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
547 | + $email = give_get_payment_user_email($payment->ID); |
|
548 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
549 | 549 | } |
550 | 550 | |
551 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
551 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
@@ -560,18 +560,18 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function get_bulk_actions() { |
562 | 562 | $actions = array( |
563 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
564 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
565 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
566 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
567 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
568 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
569 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
570 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
571 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
563 | + 'delete' => esc_html__('Delete', 'give'), |
|
564 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
565 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
566 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
567 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
568 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
569 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
570 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
571 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
572 | 572 | ); |
573 | 573 | |
574 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
574 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -582,59 +582,59 @@ discard block |
||
582 | 582 | * @return void |
583 | 583 | */ |
584 | 584 | public function process_bulk_action() { |
585 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
585 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
586 | 586 | $action = $this->current_action(); |
587 | 587 | |
588 | - if ( ! is_array( $ids ) ) { |
|
589 | - $ids = array( $ids ); |
|
588 | + if ( ! is_array($ids)) { |
|
589 | + $ids = array($ids); |
|
590 | 590 | } |
591 | 591 | |
592 | - if ( empty( $action ) ) { |
|
592 | + if (empty($action)) { |
|
593 | 593 | return; |
594 | 594 | } |
595 | 595 | |
596 | - foreach ( $ids as $id ) { |
|
596 | + foreach ($ids as $id) { |
|
597 | 597 | |
598 | 598 | // Detect when a bulk action is being triggered. |
599 | - switch ( $this->current_action() ) { |
|
599 | + switch ($this->current_action()) { |
|
600 | 600 | |
601 | 601 | case'delete': |
602 | - give_delete_purchase( $id ); |
|
602 | + give_delete_purchase($id); |
|
603 | 603 | break; |
604 | 604 | |
605 | 605 | case 'set-status-publish': |
606 | - give_update_payment_status( $id, 'publish' ); |
|
606 | + give_update_payment_status($id, 'publish'); |
|
607 | 607 | break; |
608 | 608 | |
609 | 609 | case 'set-status-pending': |
610 | - give_update_payment_status( $id, 'pending' ); |
|
610 | + give_update_payment_status($id, 'pending'); |
|
611 | 611 | break; |
612 | 612 | |
613 | 613 | case 'set-status-refunded': |
614 | - give_update_payment_status( $id, 'refunded' ); |
|
614 | + give_update_payment_status($id, 'refunded'); |
|
615 | 615 | break; |
616 | 616 | case 'set-status-revoked': |
617 | - give_update_payment_status( $id, 'revoked' ); |
|
617 | + give_update_payment_status($id, 'revoked'); |
|
618 | 618 | break; |
619 | 619 | |
620 | 620 | case 'set-status-failed': |
621 | - give_update_payment_status( $id, 'failed' ); |
|
621 | + give_update_payment_status($id, 'failed'); |
|
622 | 622 | break; |
623 | 623 | |
624 | 624 | case 'set-status-cancelled': |
625 | - give_update_payment_status( $id, 'cancelled' ); |
|
625 | + give_update_payment_status($id, 'cancelled'); |
|
626 | 626 | break; |
627 | 627 | |
628 | 628 | case 'set-status-abandoned': |
629 | - give_update_payment_status( $id, 'abandoned' ); |
|
629 | + give_update_payment_status($id, 'abandoned'); |
|
630 | 630 | break; |
631 | 631 | |
632 | 632 | case 'set-status-preapproval': |
633 | - give_update_payment_status( $id, 'preapproval' ); |
|
633 | + give_update_payment_status($id, 'preapproval'); |
|
634 | 634 | break; |
635 | 635 | |
636 | 636 | case 'resend-receipt': |
637 | - give_email_donation_receipt( $id, false ); |
|
637 | + give_email_donation_receipt($id, false); |
|
638 | 638 | break; |
639 | 639 | } |
640 | 640 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @param int $id The ID of the payment. |
647 | 647 | * @param string $current_action The action that is being triggered. |
648 | 648 | */ |
649 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
649 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | } |
@@ -662,27 +662,27 @@ discard block |
||
662 | 662 | |
663 | 663 | $args = array(); |
664 | 664 | |
665 | - if ( isset( $_GET['user'] ) ) { |
|
666 | - $args['user'] = urldecode( $_GET['user'] ); |
|
667 | - } elseif ( isset( $_GET['s'] ) ) { |
|
668 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
669 | - if ( $is_user ) { |
|
670 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
671 | - unset( $args['s'] ); |
|
665 | + if (isset($_GET['user'])) { |
|
666 | + $args['user'] = urldecode($_GET['user']); |
|
667 | + } elseif (isset($_GET['s'])) { |
|
668 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
669 | + if ($is_user) { |
|
670 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
671 | + unset($args['s']); |
|
672 | 672 | } else { |
673 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
673 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | |
677 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
678 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
677 | + if ( ! empty($_GET['start-date'])) { |
|
678 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
679 | 679 | } |
680 | 680 | |
681 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
682 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
681 | + if ( ! empty($_GET['end-date'])) { |
|
682 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
683 | 683 | } |
684 | 684 | |
685 | - $payment_count = give_count_payments( $args ); |
|
685 | + $payment_count = give_count_payments($args); |
|
686 | 686 | $this->complete_count = $payment_count->publish; |
687 | 687 | $this->pending_count = $payment_count->pending; |
688 | 688 | $this->refunded_count = $payment_count->refunded; |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | $this->cancelled_count = $payment_count->cancelled; |
692 | 692 | $this->abandoned_count = $payment_count->abandoned; |
693 | 693 | |
694 | - foreach ( $payment_count as $count ) { |
|
694 | + foreach ($payment_count as $count) { |
|
695 | 695 | $this->total_count += $count; |
696 | 696 | } |
697 | 697 | } |
@@ -706,26 +706,26 @@ discard block |
||
706 | 706 | public function payments_data() { |
707 | 707 | |
708 | 708 | $per_page = $this->per_page; |
709 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
710 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
711 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
712 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
713 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
714 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
715 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
716 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
717 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
718 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
719 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
720 | - |
|
721 | - if ( ! empty( $search ) ) { |
|
709 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
710 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
711 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
712 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
713 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
714 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
715 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
716 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
717 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
718 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
719 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
720 | + |
|
721 | + if ( ! empty($search)) { |
|
722 | 722 | $status = 'any'; // Force all payment statuses when searching. |
723 | 723 | } |
724 | 724 | |
725 | 725 | $args = array( |
726 | 726 | 'output' => 'payments', |
727 | 727 | 'number' => $per_page, |
728 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
728 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
729 | 729 | 'orderby' => $orderby, |
730 | 730 | 'order' => $order, |
731 | 731 | 'user' => $user, |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | 'end_date' => $end_date, |
740 | 740 | ); |
741 | 741 | |
742 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
742 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
743 | 743 | $args['search_in_notes'] = true; |
744 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
744 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
745 | 745 | } |
746 | 746 | |
747 | - $p_query = new Give_Payments_Query( $args ); |
|
747 | + $p_query = new Give_Payments_Query($args); |
|
748 | 748 | |
749 | 749 | return $p_query->get_payments(); |
750 | 750 | |
@@ -764,17 +764,17 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function prepare_items() { |
766 | 766 | |
767 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
767 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
768 | 768 | |
769 | 769 | $columns = $this->get_columns(); |
770 | 770 | $hidden = array(); // No hidden columns. |
771 | 771 | $sortable = $this->get_sortable_columns(); |
772 | 772 | $data = $this->payments_data(); |
773 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
773 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
774 | 774 | |
775 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
775 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
776 | 776 | |
777 | - switch ( $status ) { |
|
777 | + switch ($status) { |
|
778 | 778 | case 'publish': |
779 | 779 | $total_items = $this->complete_count; |
780 | 780 | break; |
@@ -801,19 +801,19 @@ discard block |
||
801 | 801 | break; |
802 | 802 | default: |
803 | 803 | // Retrieve the count of the non-default-Give status. |
804 | - $count = wp_count_posts( 'give_payment' ); |
|
805 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
804 | + $count = wp_count_posts('give_payment'); |
|
805 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
806 | 806 | break; |
807 | 807 | } |
808 | 808 | |
809 | 809 | $this->items = $data; |
810 | 810 | |
811 | - $this->set_pagination_args( array( |
|
811 | + $this->set_pagination_args(array( |
|
812 | 812 | 'total_items' => $total_items, |
813 | 813 | // We have to calculate the total number of items. |
814 | 814 | 'per_page' => $this->per_page, |
815 | 815 | // We have to determine how many items to show on a page. |
816 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
816 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
817 | 817 | // We have to calculate the total number of pages. |
818 | 818 | ) |
819 | 819 | ); |
@@ -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 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @return void |
39 | 39 | */ |
40 | 40 | public function headers() { |
41 | - ignore_user_abort( true ); |
|
41 | + ignore_user_abort(true); |
|
42 | 42 | |
43 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
44 | - set_time_limit( 0 ); |
|
43 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
44 | + set_time_limit(0); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
49 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
50 | - header( "Expires: 0" ); |
|
48 | + header('Content-Type: text/csv; charset=utf-8'); |
|
49 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
50 | + header("Expires: 0"); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => __( 'Date', 'give' ), |
|
65 | - 'donations' => __( 'Donations', 'give' ), |
|
64 | + 'date' => __('Date', 'give'), |
|
65 | + 'donations' => __('Donations', 'give'), |
|
66 | 66 | /* translators: %s: currency */ |
67 | - 'earnings' => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) ) |
|
67 | + 'earnings' => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true)) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $cols; |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function get_data() { |
81 | 81 | |
82 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
83 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
84 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
85 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
82 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
83 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
84 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
85 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
86 | 86 | |
87 | 87 | $data = array(); |
88 | 88 | $year = $start_year; |
89 | 89 | $stats = new Give_Payment_Stats; |
90 | 90 | |
91 | - while ( $year <= $end_year ) { |
|
91 | + while ($year <= $end_year) { |
|
92 | 92 | |
93 | - if ( $year == $start_year && $year == $end_year ) { |
|
93 | + if ($year == $start_year && $year == $end_year) { |
|
94 | 94 | |
95 | 95 | $m1 = $start_month; |
96 | 96 | $m2 = $end_month; |
97 | 97 | |
98 | - } elseif ( $year == $start_year ) { |
|
98 | + } elseif ($year == $start_year) { |
|
99 | 99 | |
100 | 100 | $m1 = $start_month; |
101 | 101 | $m2 = 12; |
102 | 102 | |
103 | - } elseif ( $year == $end_year ) { |
|
103 | + } elseif ($year == $end_year) { |
|
104 | 104 | |
105 | 105 | $m1 = 1; |
106 | 106 | $m2 = $end_month; |
@@ -112,28 +112,28 @@ discard block |
||
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - while ( $m1 <= $m2 ) { |
|
115 | + while ($m1 <= $m2) { |
|
116 | 116 | |
117 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
118 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
117 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
118 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
119 | 119 | |
120 | 120 | $data[] = array( |
121 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
122 | - 'donations' => $stats->get_sales( 0, $date1, $date2 ), |
|
123 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
121 | + 'date' => date_i18n('F Y', $date1), |
|
122 | + 'donations' => $stats->get_sales(0, $date1, $date2), |
|
123 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
124 | 124 | ); |
125 | 125 | |
126 | - $m1 ++; |
|
126 | + $m1++; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - $year ++; |
|
131 | + $year++; |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
136 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
135 | + $data = apply_filters('give_export_get_data', $data); |
|
136 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
137 | 137 | |
138 | 138 | return $data; |
139 | 139 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
51 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
50 | + $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
51 | + $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
52 | 52 | |
53 | 53 | $pdf = new give_pdf(); |
54 | 54 | $pdf->AddPage( 'L', 'A4' ); |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
81 | 81 | $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
82 | 82 | |
83 | - // Display Categories Heading only, if user has opted for it. |
|
84 | - if ( $categories_enabled ) { |
|
83 | + // Display Categories Heading only, if user has opted for it. |
|
84 | + if ( $categories_enabled ) { |
|
85 | 85 | $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - // Display Tags Heading only, if user has opted for it. |
|
89 | - if ( $tags_enabled ) { |
|
88 | + // Display Tags Heading only, if user has opted for it. |
|
89 | + if ( $tags_enabled ) { |
|
90 | 90 | $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
94 | 94 | $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | $price = give_currency_filter( give_get_form_price( $form->ID ), '', true ); |
126 | 126 | } |
127 | 127 | |
128 | - // Display Categories Data only, if user has opted for it. |
|
129 | - if ( $categories_enabled ) { |
|
130 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
131 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
132 | - } |
|
128 | + // Display Categories Data only, if user has opted for it. |
|
129 | + if ( $categories_enabled ) { |
|
130 | + $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
131 | + $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
132 | + } |
|
133 | 133 | |
134 | - // Display Tags Data only, if user has opted for it. |
|
135 | - if ( $tags_enabled ) { |
|
136 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
137 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
138 | - } |
|
134 | + // Display Tags Data only, if user has opted for it. |
|
135 | + if ( $tags_enabled ) { |
|
136 | + $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
137 | + $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
138 | + } |
|
139 | 139 | |
140 | 140 | $sales = give_get_form_sales_stats( $form->ID ); |
141 | 141 | $link = get_permalink( $form->ID ); |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
148 | 148 | } |
149 | 149 | |
150 | - // This will help filter data before appending it to PDF Receipt. |
|
151 | - $prepare_pdf_data = array(); |
|
152 | - $prepare_pdf_data[] = $title; |
|
153 | - $prepare_pdf_data[] = $price; |
|
150 | + // This will help filter data before appending it to PDF Receipt. |
|
151 | + $prepare_pdf_data = array(); |
|
152 | + $prepare_pdf_data[] = $title; |
|
153 | + $prepare_pdf_data[] = $price; |
|
154 | 154 | |
155 | - // Append Categories Data only, if user has opted for it. |
|
156 | - if ( $categories_enabled ) { |
|
157 | - $prepare_pdf_data[] = $categories; |
|
158 | - } |
|
155 | + // Append Categories Data only, if user has opted for it. |
|
156 | + if ( $categories_enabled ) { |
|
157 | + $prepare_pdf_data[] = $categories; |
|
158 | + } |
|
159 | 159 | |
160 | - // Append Tags Data only, if user has opted for it. |
|
161 | - if ( $tags_enabled ) { |
|
162 | - $prepare_pdf_data[] = $tags; |
|
163 | - } |
|
160 | + // Append Tags Data only, if user has opted for it. |
|
161 | + if ( $tags_enabled ) { |
|
162 | + $prepare_pdf_data[] = $tags; |
|
163 | + } |
|
164 | 164 | |
165 | - $prepare_pdf_data[] = $sales; |
|
166 | - $prepare_pdf_data[] = $earnings; |
|
165 | + $prepare_pdf_data[] = $sales; |
|
166 | + $prepare_pdf_data[] = $earnings; |
|
167 | 167 | |
168 | 168 | $pdf->Row( $prepare_pdf_data ); |
169 | 169 | endforeach; |
170 | 170 | } else { |
171 | 171 | |
172 | - // Fix: Minor Styling Alignment Issue for PDF |
|
173 | - if( $categories_enabled && $tags_enabled ) { |
|
174 | - $pdf->SetWidths( array( 280 ) ); |
|
175 | - } elseif( $categories_enabled || $tags_enabled ) { |
|
176 | - $pdf->SetWidths( array( 235 ) ); |
|
177 | - } else { |
|
178 | - $pdf->SetWidths( array( 190 ) ); |
|
179 | - } |
|
172 | + // Fix: Minor Styling Alignment Issue for PDF |
|
173 | + if( $categories_enabled && $tags_enabled ) { |
|
174 | + $pdf->SetWidths( array( 280 ) ); |
|
175 | + } elseif( $categories_enabled || $tags_enabled ) { |
|
176 | + $pdf->SetWidths( array( 235 ) ); |
|
177 | + } else { |
|
178 | + $pdf->SetWidths( array( 190 ) ); |
|
179 | + } |
|
180 | 180 | |
181 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
181 | + $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
182 | 182 | $pdf->Row( array( $title ) ); |
183 | 183 | } |
184 | 184 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly.. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,94 +25,94 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
40 | 40 | |
41 | 41 | $daterange = utf8_decode( |
42 | 42 | sprintf( |
43 | 43 | /* translators: 1: start date 2: end date */ |
44 | - __( '%1$s to %2$s', 'give' ), |
|
45 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
46 | - date_i18n( give_date_format() ) |
|
44 | + __('%1$s to %2$s', 'give'), |
|
45 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
46 | + date_i18n(give_date_format()) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
51 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
50 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
51 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
52 | 52 | |
53 | 53 | $pdf = new give_pdf(); |
54 | - $pdf->AddPage( 'L', 'A4' ); |
|
54 | + $pdf->AddPage('L', 'A4'); |
|
55 | 55 | |
56 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
57 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
58 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
56 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
57 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
58 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
59 | 59 | |
60 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
60 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8); |
|
61 | 61 | |
62 | - $pdf->SetMargins( 8, 8, 8 ); |
|
63 | - $pdf->SetX( 8 ); |
|
62 | + $pdf->SetMargins(8, 8, 8); |
|
63 | + $pdf->SetX(8); |
|
64 | 64 | |
65 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
66 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
67 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
65 | + $pdf->SetFont('Helvetica', '', 16); |
|
66 | + $pdf->SetTextColor(50, 50, 50); |
|
67 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
68 | 68 | |
69 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
69 | + $pdf->SetFont('Helvetica', '', 13); |
|
70 | 70 | $pdf->Ln(); |
71 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
72 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
71 | + $pdf->SetTextColor(150, 150, 150); |
|
72 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
73 | 73 | $pdf->Ln(); |
74 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
75 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
76 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
77 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
74 | + $pdf->SetTextColor(50, 50, 50); |
|
75 | + $pdf->SetFont('Helvetica', '', 14); |
|
76 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
77 | + $pdf->SetFont('Helvetica', '', 12); |
|
78 | 78 | |
79 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
80 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
81 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
79 | + $pdf->SetFillColor(238, 238, 238); |
|
80 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
81 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
82 | 82 | |
83 | 83 | // Display Categories Heading only, if user has opted for it. |
84 | - if ( $categories_enabled ) { |
|
85 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
84 | + if ($categories_enabled) { |
|
85 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // Display Tags Heading only, if user has opted for it. |
89 | - if ( $tags_enabled ) { |
|
90 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
89 | + if ($tags_enabled) { |
|
90 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
91 | 91 | } |
92 | 92 | |
93 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
94 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
93 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
94 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
95 | 95 | |
96 | - $year = date( 'Y' ); |
|
97 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
96 | + $year = date('Y'); |
|
97 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
98 | 98 | |
99 | - if ( $give_forms ) { |
|
100 | - $pdf->SetWidths( array( 70, 30, 45, 45, 45, 45 ) ); |
|
99 | + if ($give_forms) { |
|
100 | + $pdf->SetWidths(array(70, 30, 45, 45, 45, 45)); |
|
101 | 101 | |
102 | - foreach ( $give_forms as $form ): |
|
103 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
102 | + foreach ($give_forms as $form): |
|
103 | + $pdf->SetFillColor(255, 255, 255); |
|
104 | 104 | |
105 | 105 | $title = $form->post_title; |
106 | 106 | |
107 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
107 | + if (give_has_variable_prices($form->ID)) { |
|
108 | 108 | |
109 | - $prices = give_get_variable_prices( $form->ID ); |
|
109 | + $prices = give_get_variable_prices($form->ID); |
|
110 | 110 | |
111 | 111 | $first = $prices[0]['_give_amount']; |
112 | - $last = array_pop( $prices ); |
|
112 | + $last = array_pop($prices); |
|
113 | 113 | $last = $last['_give_amount']; |
114 | 114 | |
115 | - if ( $first < $last ) { |
|
115 | + if ($first < $last) { |
|
116 | 116 | $min = $first; |
117 | 117 | $max = $last; |
118 | 118 | } else { |
@@ -120,31 +120,31 @@ discard block |
||
120 | 120 | $max = $first; |
121 | 121 | } |
122 | 122 | |
123 | - $price = give_currency_filter( give_format_amount( $min ), '', true ) . ' - ' . give_currency_filter( give_format_amount( $max ), '', true ); |
|
123 | + $price = give_currency_filter(give_format_amount($min), '', true).' - '.give_currency_filter(give_format_amount($max), '', true); |
|
124 | 124 | } else { |
125 | - $price = give_currency_filter( give_get_form_price( $form->ID ), '', true ); |
|
125 | + $price = give_currency_filter(give_get_form_price($form->ID), '', true); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Display Categories Data only, if user has opted for it. |
129 | - if ( $categories_enabled ) { |
|
130 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
131 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
129 | + if ($categories_enabled) { |
|
130 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
131 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // Display Tags Data only, if user has opted for it. |
135 | - if ( $tags_enabled ) { |
|
136 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
137 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
135 | + if ($tags_enabled) { |
|
136 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
137 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
138 | 138 | } |
139 | 139 | |
140 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
141 | - $link = get_permalink( $form->ID ); |
|
142 | - $earnings = give_currency_filter( give_get_form_earnings_stats( $form->ID ), '', true ); |
|
140 | + $sales = give_get_form_sales_stats($form->ID); |
|
141 | + $link = get_permalink($form->ID); |
|
142 | + $earnings = give_currency_filter(give_get_form_earnings_stats($form->ID), '', true); |
|
143 | 143 | |
144 | - if ( function_exists( 'iconv' ) ) { |
|
144 | + if (function_exists('iconv')) { |
|
145 | 145 | // Ensure characters like euro; are properly converted. |
146 | - $price = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) ); |
|
147 | - $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
|
146 | + $price = iconv('UTF-8', 'windows-1252', utf8_encode($price)); |
|
147 | + $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // This will help filter data before appending it to PDF Receipt. |
@@ -153,51 +153,51 @@ discard block |
||
153 | 153 | $prepare_pdf_data[] = $price; |
154 | 154 | |
155 | 155 | // Append Categories Data only, if user has opted for it. |
156 | - if ( $categories_enabled ) { |
|
156 | + if ($categories_enabled) { |
|
157 | 157 | $prepare_pdf_data[] = $categories; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Append Tags Data only, if user has opted for it. |
161 | - if ( $tags_enabled ) { |
|
161 | + if ($tags_enabled) { |
|
162 | 162 | $prepare_pdf_data[] = $tags; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $prepare_pdf_data[] = $sales; |
166 | 166 | $prepare_pdf_data[] = $earnings; |
167 | 167 | |
168 | - $pdf->Row( $prepare_pdf_data ); |
|
168 | + $pdf->Row($prepare_pdf_data); |
|
169 | 169 | endforeach; |
170 | 170 | } else { |
171 | 171 | |
172 | 172 | // Fix: Minor Styling Alignment Issue for PDF |
173 | - if( $categories_enabled && $tags_enabled ) { |
|
174 | - $pdf->SetWidths( array( 280 ) ); |
|
175 | - } elseif( $categories_enabled || $tags_enabled ) { |
|
176 | - $pdf->SetWidths( array( 235 ) ); |
|
173 | + if ($categories_enabled && $tags_enabled) { |
|
174 | + $pdf->SetWidths(array(280)); |
|
175 | + } elseif ($categories_enabled || $tags_enabled) { |
|
176 | + $pdf->SetWidths(array(235)); |
|
177 | 177 | } else { |
178 | - $pdf->SetWidths( array( 190 ) ); |
|
178 | + $pdf->SetWidths(array(190)); |
|
179 | 179 | } |
180 | 180 | |
181 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
182 | - $pdf->Row( array( $title ) ); |
|
181 | + $title = utf8_decode(__('No forms found.', 'give')); |
|
182 | + $pdf->Row(array($title)); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $pdf->Ln(); |
186 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
187 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
188 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
189 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
190 | - |
|
191 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
192 | - $image = str_replace( ' ', '%20', $image ); |
|
193 | - |
|
194 | - $pdf->SetX( 25 ); |
|
195 | - $pdf->Image( $image . '&file=.png' ); |
|
196 | - $pdf->Ln( 7 ); |
|
197 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
186 | + $pdf->SetTextColor(50, 50, 50); |
|
187 | + $pdf->SetFont('Helvetica', '', 14); |
|
188 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
189 | + $pdf->SetFont('Helvetica', '', 12); |
|
190 | + |
|
191 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
192 | + $image = str_replace(' ', '%20', $image); |
|
193 | + |
|
194 | + $pdf->SetX(25); |
|
195 | + $pdf->Image($image.'&file=.png'); |
|
196 | + $pdf->Ln(7); |
|
197 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
198 | 198 | } |
199 | 199 | |
200 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
200 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Draws Chart for PDF Report. |
@@ -214,38 +214,38 @@ discard block |
||
214 | 214 | * @return string $chart->getUrl() URL for the Google Chart |
215 | 215 | */ |
216 | 216 | function give_draw_chart_image() { |
217 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
218 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
219 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
217 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
218 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
219 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
220 | 220 | |
221 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
221 | + $chart = new GoogleChart('lc', 900, 330); |
|
222 | 222 | |
223 | 223 | $i = 1; |
224 | 224 | $earnings = ""; |
225 | 225 | $sales = ""; |
226 | 226 | |
227 | - while ( $i <= 12 ) : |
|
228 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
229 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
230 | - $i ++; |
|
227 | + while ($i <= 12) : |
|
228 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
229 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
230 | + $i++; |
|
231 | 231 | endwhile; |
232 | 232 | |
233 | - $earnings_array = explode( ",", $earnings ); |
|
234 | - $sales_array = explode( ",", $sales ); |
|
233 | + $earnings_array = explode(",", $earnings); |
|
234 | + $sales_array = explode(",", $sales); |
|
235 | 235 | |
236 | 236 | $i = 0; |
237 | - while ( $i <= 11 ) { |
|
238 | - if ( empty( $sales_array[ $i ] ) ) { |
|
239 | - $sales_array[ $i ] = 0; |
|
237 | + while ($i <= 11) { |
|
238 | + if (empty($sales_array[$i])) { |
|
239 | + $sales_array[$i] = 0; |
|
240 | 240 | } |
241 | - $i ++; |
|
241 | + $i++; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $min_earnings = 0; |
245 | - $max_earnings = max( $earnings_array ); |
|
246 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
245 | + $max_earnings = max($earnings_array); |
|
246 | + $earnings_scale = round($max_earnings, - 1); |
|
247 | 247 | |
248 | - $data = new GoogleChartData( array( |
|
248 | + $data = new GoogleChartData(array( |
|
249 | 249 | $earnings_array[0], |
250 | 250 | $earnings_array[1], |
251 | 251 | $earnings_array[2], |
@@ -258,25 +258,25 @@ discard block |
||
258 | 258 | $earnings_array[9], |
259 | 259 | $earnings_array[10], |
260 | 260 | $earnings_array[11] |
261 | - ) ); |
|
261 | + )); |
|
262 | 262 | |
263 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
264 | - $data->setColor( '1b58a3' ); |
|
265 | - $chart->addData( $data ); |
|
263 | + $data->setLegend(__('Income', 'give')); |
|
264 | + $data->setColor('1b58a3'); |
|
265 | + $chart->addData($data); |
|
266 | 266 | |
267 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
268 | - $shape_marker->setColor( '000000' ); |
|
269 | - $shape_marker->setSize( 7 ); |
|
270 | - $shape_marker->setBorder( 2 ); |
|
271 | - $shape_marker->setData( $data ); |
|
272 | - $chart->addMarker( $shape_marker ); |
|
267 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
268 | + $shape_marker->setColor('000000'); |
|
269 | + $shape_marker->setSize(7); |
|
270 | + $shape_marker->setBorder(2); |
|
271 | + $shape_marker->setData($data); |
|
272 | + $chart->addMarker($shape_marker); |
|
273 | 273 | |
274 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
275 | - $value_marker->setColor( '000000' ); |
|
276 | - $value_marker->setData( $data ); |
|
277 | - $chart->addMarker( $value_marker ); |
|
274 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
275 | + $value_marker->setColor('000000'); |
|
276 | + $value_marker->setData($data); |
|
277 | + $chart->addMarker($value_marker); |
|
278 | 278 | |
279 | - $data = new GoogleChartData( array( |
|
279 | + $data = new GoogleChartData(array( |
|
280 | 280 | $sales_array[0], |
281 | 281 | $sales_array[1], |
282 | 282 | $sales_array[2], |
@@ -289,46 +289,46 @@ discard block |
||
289 | 289 | $sales_array[9], |
290 | 290 | $sales_array[10], |
291 | 291 | $sales_array[11] |
292 | - ) ); |
|
293 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
294 | - $data->setColor( 'ff6c1c' ); |
|
295 | - $chart->addData( $data ); |
|
296 | - |
|
297 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
298 | - |
|
299 | - $chart->setScale( 0, $max_earnings ); |
|
300 | - |
|
301 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
302 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
303 | - $chart->addAxis( $y_axis ); |
|
304 | - |
|
305 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
306 | - $x_axis->setTickMarks( 5 ); |
|
307 | - $x_axis->setLabels( array( |
|
308 | - __( 'Jan', 'give' ), |
|
309 | - __( 'Feb', 'give' ), |
|
310 | - __( 'Mar', 'give' ), |
|
311 | - __( 'Apr', 'give' ), |
|
312 | - __( 'May', 'give' ), |
|
313 | - __( 'June', 'give' ), |
|
314 | - __( 'July', 'give' ), |
|
315 | - __( 'Aug', 'give' ), |
|
316 | - __( 'Sept', 'give' ), |
|
317 | - __( 'Oct', 'give' ), |
|
318 | - __( 'Nov', 'give' ), |
|
319 | - __( 'Dec', 'give' ) |
|
320 | - ) ); |
|
321 | - $chart->addAxis( $x_axis ); |
|
322 | - |
|
323 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
324 | - $shape_marker->setSize( 6 ); |
|
325 | - $shape_marker->setBorder( 2 ); |
|
326 | - $shape_marker->setData( $data ); |
|
327 | - $chart->addMarker( $shape_marker ); |
|
328 | - |
|
329 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
330 | - $value_marker->setData( $data ); |
|
331 | - $chart->addMarker( $value_marker ); |
|
292 | + )); |
|
293 | + $data->setLegend(__('Donations', 'give')); |
|
294 | + $data->setColor('ff6c1c'); |
|
295 | + $chart->addData($data); |
|
296 | + |
|
297 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
298 | + |
|
299 | + $chart->setScale(0, $max_earnings); |
|
300 | + |
|
301 | + $y_axis = new GoogleChartAxis('y'); |
|
302 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
303 | + $chart->addAxis($y_axis); |
|
304 | + |
|
305 | + $x_axis = new GoogleChartAxis('x'); |
|
306 | + $x_axis->setTickMarks(5); |
|
307 | + $x_axis->setLabels(array( |
|
308 | + __('Jan', 'give'), |
|
309 | + __('Feb', 'give'), |
|
310 | + __('Mar', 'give'), |
|
311 | + __('Apr', 'give'), |
|
312 | + __('May', 'give'), |
|
313 | + __('June', 'give'), |
|
314 | + __('July', 'give'), |
|
315 | + __('Aug', 'give'), |
|
316 | + __('Sept', 'give'), |
|
317 | + __('Oct', 'give'), |
|
318 | + __('Nov', 'give'), |
|
319 | + __('Dec', 'give') |
|
320 | + )); |
|
321 | + $chart->addAxis($x_axis); |
|
322 | + |
|
323 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
324 | + $shape_marker->setSize(6); |
|
325 | + $shape_marker->setBorder(2); |
|
326 | + $shape_marker->setData($data); |
|
327 | + $chart->addMarker($shape_marker); |
|
328 | + |
|
329 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
330 | + $value_marker->setData($data); |
|
331 | + $chart->addMarker($value_marker); |
|
332 | 332 | |
333 | 333 | return $chart->getUrl(); |
334 | 334 | } |
@@ -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 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => __( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
43 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID. |
|
44 | - 'email' => __( 'Email', 'give' ), |
|
45 | - 'first' => __( 'First Name', 'give' ), |
|
46 | - 'last' => __( 'Last Name', 'give' ), |
|
47 | - 'address1' => __( 'Address 1', 'give' ), |
|
48 | - 'address2' => __( 'Address 2', 'give' ), |
|
49 | - 'city' => __( 'City', 'give' ), |
|
50 | - 'state' => __( 'State', 'give' ), |
|
51 | - 'country' => __( 'Country', 'give' ), |
|
52 | - 'zip' => __( 'Zip / Postal Code', 'give' ), |
|
53 | - 'form_id' => __( 'Form ID', 'give' ), |
|
54 | - 'form_name' => __( 'Form Name', 'give' ), |
|
55 | - 'amount' => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')', |
|
56 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
57 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
58 | - 'key' => __( 'Key', 'give' ), |
|
59 | - 'date' => __( 'Date', 'give' ), |
|
60 | - 'user' => __( 'User', 'give' ), |
|
61 | - 'status' => __( 'Status', 'give' ) |
|
42 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying). |
|
43 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID. |
|
44 | + 'email' => __('Email', 'give'), |
|
45 | + 'first' => __('First Name', 'give'), |
|
46 | + 'last' => __('Last Name', 'give'), |
|
47 | + 'address1' => __('Address 1', 'give'), |
|
48 | + 'address2' => __('Address 2', 'give'), |
|
49 | + 'city' => __('City', 'give'), |
|
50 | + 'state' => __('State', 'give'), |
|
51 | + 'country' => __('Country', 'give'), |
|
52 | + 'zip' => __('Zip / Postal Code', 'give'), |
|
53 | + 'form_id' => __('Form ID', 'give'), |
|
54 | + 'form_name' => __('Form Name', 'give'), |
|
55 | + 'amount' => __('Amount', 'give').' ('.give_currency_symbol('', true).')', |
|
56 | + 'gateway' => __('Payment Method', 'give'), |
|
57 | + 'trans_id' => __('Transaction ID', 'give'), |
|
58 | + 'key' => __('Key', 'give'), |
|
59 | + 'date' => __('Date', 'give'), |
|
60 | + 'user' => __('User', 'give'), |
|
61 | + 'status' => __('Status', 'give') |
|
62 | 62 | ); |
63 | 63 | |
64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
65 | - unset( $cols['seq_id'] ); |
|
64 | + if ( ! give_get_option('enable_sequential')) { |
|
65 | + unset($cols['seq_id']); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $cols; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | 'status' => $this->status |
87 | 87 | ); |
88 | 88 | |
89 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
89 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
90 | 90 | |
91 | 91 | $args['date_query'] = array( |
92 | 92 | array( |
93 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
94 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
93 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
94 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
95 | 95 | 'inclusive' => true |
96 | 96 | ) |
97 | 97 | ); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Add category or tag to payment query if any. |
102 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
102 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
103 | 103 | $form_args = array( |
104 | 104 | 'post_type' => 'give_forms', |
105 | 105 | 'post_status' => 'publish', |
106 | - 'posts_per_page' => - 1, |
|
106 | + 'posts_per_page' => -1, |
|
107 | 107 | 'fields' => 'ids', |
108 | 108 | 'tax_query' => array( |
109 | 109 | 'relation' => 'AND', |
@@ -111,72 +111,72 @@ discard block |
||
111 | 111 | ); |
112 | 112 | |
113 | 113 | |
114 | - if ( ! empty( $this->categories ) ) { |
|
114 | + if ( ! empty($this->categories)) { |
|
115 | 115 | $form_args['tax_query'][] = array( |
116 | 116 | 'taxonomy' => 'give_forms_category', |
117 | 117 | 'terms' => $this->categories, |
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
121 | - if ( ! empty( $this->tags ) ) { |
|
121 | + if ( ! empty($this->tags)) { |
|
122 | 122 | $form_args['tax_query'][] = array( |
123 | 123 | 'taxonomy' => 'give_forms_tag', |
124 | 124 | 'terms' => $this->tags, |
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
128 | - $forms = new WP_Query( $form_args ); |
|
128 | + $forms = new WP_Query($form_args); |
|
129 | 129 | |
130 | - if ( empty( $forms->posts ) ) { |
|
130 | + if (empty($forms->posts)) { |
|
131 | 131 | return array(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | $args['give_forms'] = $forms->posts; |
135 | 135 | } |
136 | 136 | |
137 | - $payments = give_get_payments( $args ); |
|
137 | + $payments = give_get_payments($args); |
|
138 | 138 | |
139 | - if ( $payments ) { |
|
139 | + if ($payments) { |
|
140 | 140 | |
141 | - foreach ( $payments as $payment ) { |
|
142 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
143 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
144 | - $total = give_get_payment_amount( $payment->ID ); |
|
145 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
141 | + foreach ($payments as $payment) { |
|
142 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
143 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
144 | + $total = give_get_payment_amount($payment->ID); |
|
145 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
146 | 146 | |
147 | - if ( is_numeric( $user_id ) ) { |
|
148 | - $user = get_userdata( $user_id ); |
|
147 | + if (is_numeric($user_id)) { |
|
148 | + $user = get_userdata($user_id); |
|
149 | 149 | } else { |
150 | 150 | $user = false; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $data[] = array( |
154 | 154 | 'id' => $payment->ID, |
155 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
155 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
156 | 156 | 'email' => $payment_meta['email'], |
157 | 157 | 'first' => $user_info['first_name'], |
158 | 158 | 'last' => $user_info['last_name'], |
159 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
160 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
161 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
162 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
163 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
164 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
165 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
166 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
167 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
168 | - 'gateway' => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
169 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
159 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
160 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
161 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
162 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
163 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
164 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
165 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
166 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
167 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
168 | + 'gateway' => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)), |
|
169 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
170 | 170 | 'key' => $payment_meta['key'], |
171 | 171 | 'date' => $payment->post_date, |
172 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
173 | - 'status' => give_get_payment_status( $payment, true ) |
|
172 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
173 | + 'status' => give_get_payment_status($payment, true) |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
179 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
178 | + $data = apply_filters('give_export_get_data', $data); |
|
179 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
180 | 180 | |
181 | 181 | return $data; |
182 | 182 | |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | |
197 | 197 | $status = $this->status; |
198 | 198 | $args = array( |
199 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
200 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
199 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
200 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
201 | 201 | ); |
202 | 202 | |
203 | - if ( 'any' == $status ) { |
|
203 | + if ('any' == $status) { |
|
204 | 204 | |
205 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
205 | + $total = array_sum((array) give_count_payments($args)); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | |
209 | - $total = give_count_payments( $args )->$status; |
|
209 | + $total = give_count_payments($args)->$status; |
|
210 | 210 | |
211 | 211 | } |
212 | 212 | |
213 | 213 | $percentage = 100; |
214 | 214 | |
215 | - if ( $total > 0 ) { |
|
216 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
215 | + if ($total > 0) { |
|
216 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( $percentage > 100 ) { |
|
219 | + if ($percentage > 100) { |
|
220 | 220 | $percentage = 100; |
221 | 221 | } |
222 | 222 | |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param array $request The Form Data passed into the batch processing. |
232 | 232 | */ |
233 | - public function set_properties( $request ) { |
|
234 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
235 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
236 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
237 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
238 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
233 | + public function set_properties($request) { |
|
234 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
235 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
236 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
237 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
238 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
239 | 239 | } |
240 | 240 | } |
@@ -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 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'ID' => __( 'ID', 'give' ), |
|
45 | - 'post_name' => __( 'Slug', 'give' ), |
|
46 | - 'post_title' => __( 'Name', 'give' ), |
|
47 | - 'post_date' => __( 'Date Created', 'give' ), |
|
48 | - 'post_author' => __( 'Author', 'give' ), |
|
49 | - 'post_content' => __( 'Description', 'give' ), |
|
50 | - 'post_excerpt' => __( 'Excerpt', 'give' ), |
|
51 | - 'post_status' => __( 'Status', 'give' ), |
|
52 | - 'categories' => __( 'Categories', 'give' ), |
|
53 | - 'tags' => __( 'Tags', 'give' ), |
|
54 | - 'give_price' => __( 'Price', 'give' ), |
|
55 | - '_thumbnail_id' => __( 'Featured Image', 'give' ), |
|
56 | - '_give_form_sales' => __( 'Donations', 'give' ), |
|
57 | - '_give_download_earnings' => __( 'Income', 'give' ), |
|
44 | + 'ID' => __('ID', 'give'), |
|
45 | + 'post_name' => __('Slug', 'give'), |
|
46 | + 'post_title' => __('Name', 'give'), |
|
47 | + 'post_date' => __('Date Created', 'give'), |
|
48 | + 'post_author' => __('Author', 'give'), |
|
49 | + 'post_content' => __('Description', 'give'), |
|
50 | + 'post_excerpt' => __('Excerpt', 'give'), |
|
51 | + 'post_status' => __('Status', 'give'), |
|
52 | + 'categories' => __('Categories', 'give'), |
|
53 | + 'tags' => __('Tags', 'give'), |
|
54 | + 'give_price' => __('Price', 'give'), |
|
55 | + '_thumbnail_id' => __('Featured Image', 'give'), |
|
56 | + '_give_form_sales' => __('Donations', 'give'), |
|
57 | + '_give_download_earnings' => __('Income', 'give'), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | return $cols; |
@@ -84,43 +84,43 @@ discard block |
||
84 | 84 | 'paged' => $this->step |
85 | 85 | ); |
86 | 86 | |
87 | - $forms = new WP_Query( $args ); |
|
87 | + $forms = new WP_Query($args); |
|
88 | 88 | |
89 | - if ( $forms->posts ) { |
|
90 | - foreach ( $forms->posts as $form ) { |
|
89 | + if ($forms->posts) { |
|
90 | + foreach ($forms->posts as $form) { |
|
91 | 91 | |
92 | 92 | $row = []; |
93 | 93 | |
94 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
94 | + foreach ($this->csv_cols() as $key => $value) { |
|
95 | 95 | |
96 | 96 | // Setup default value/ |
97 | - $row[ $key ] = ''; |
|
97 | + $row[$key] = ''; |
|
98 | 98 | |
99 | - if ( in_array( $key, $meta ) ) { |
|
99 | + if (in_array($key, $meta)) { |
|
100 | 100 | |
101 | - switch ( $key ) { |
|
101 | + switch ($key) { |
|
102 | 102 | |
103 | 103 | case '_thumbnail_id' : |
104 | 104 | |
105 | - $image_id = get_post_thumbnail_id( $form->ID ); |
|
106 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
105 | + $image_id = get_post_thumbnail_id($form->ID); |
|
106 | + $row[$key] = wp_get_attachment_url($image_id); |
|
107 | 107 | |
108 | 108 | break; |
109 | 109 | |
110 | 110 | case 'give_price' : |
111 | 111 | |
112 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
112 | + if (give_has_variable_prices($form->ID)) { |
|
113 | 113 | |
114 | 114 | $prices = []; |
115 | - foreach ( give_get_variable_prices( $form->ID ) as $price ) { |
|
116 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
115 | + foreach (give_get_variable_prices($form->ID) as $price) { |
|
116 | + $prices[] = $price['name'].': '.$price['amount']; |
|
117 | 117 | } |
118 | 118 | |
119 | - $row[ $key ] = implode( ' | ', $prices ); |
|
119 | + $row[$key] = implode(' | ', $prices); |
|
120 | 120 | |
121 | 121 | } else { |
122 | 122 | |
123 | - $row[ $key ] = give_get_form_price( $form->ID ); |
|
123 | + $row[$key] = give_get_form_price($form->ID); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
@@ -128,44 +128,44 @@ discard block |
||
128 | 128 | |
129 | 129 | default : |
130 | 130 | |
131 | - $row[ $key ] = give_get_meta( $form->ID, $key, TRUE ); |
|
131 | + $row[$key] = give_get_meta($form->ID, $key, TRUE); |
|
132 | 132 | |
133 | 133 | break; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - } elseif ( isset( $form->$key ) ) { |
|
137 | + } elseif (isset($form->$key)) { |
|
138 | 138 | |
139 | - switch ( $key ) { |
|
139 | + switch ($key) { |
|
140 | 140 | |
141 | 141 | case 'post_author' : |
142 | 142 | |
143 | - $row[ $key ] = get_the_author_meta( 'user_login', $form->post_author ); |
|
143 | + $row[$key] = get_the_author_meta('user_login', $form->post_author); |
|
144 | 144 | |
145 | 145 | break; |
146 | 146 | |
147 | 147 | default : |
148 | 148 | |
149 | - $row[ $key ] = $form->$key; |
|
149 | + $row[$key] = $form->$key; |
|
150 | 150 | |
151 | 151 | break; |
152 | 152 | } |
153 | 153 | |
154 | - } elseif ( 'tags' == $key ) { |
|
154 | + } elseif ('tags' == $key) { |
|
155 | 155 | |
156 | - $terms = get_the_terms( $form->ID, 'form_tag' ); |
|
157 | - if ( $terms ) { |
|
158 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
159 | - $row[ $key ] = implode( ' | ', $terms ); |
|
156 | + $terms = get_the_terms($form->ID, 'form_tag'); |
|
157 | + if ($terms) { |
|
158 | + $terms = wp_list_pluck($terms, 'name'); |
|
159 | + $row[$key] = implode(' | ', $terms); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | - } elseif ( 'categories' == $key ) { |
|
163 | + } elseif ('categories' == $key) { |
|
164 | 164 | |
165 | - $terms = get_the_terms( $form->ID, 'form_category' ); |
|
166 | - if ( $terms ) { |
|
167 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
168 | - $row[ $key ] = implode( ' | ', $terms ); |
|
165 | + $terms = get_the_terms($form->ID, 'form_category'); |
|
166 | + if ($terms) { |
|
167 | + $terms = wp_list_pluck($terms, 'name'); |
|
168 | + $row[$key] = implode(' | ', $terms); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | } |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
180 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
179 | + $data = apply_filters('give_export_get_data', $data); |
|
180 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
181 | 181 | |
182 | 182 | return $data; |
183 | 183 | |
@@ -197,20 +197,20 @@ discard block |
||
197 | 197 | |
198 | 198 | $args = array( |
199 | 199 | 'post_type' => 'give_forms', |
200 | - 'posts_per_page' => - 1, |
|
200 | + 'posts_per_page' => -1, |
|
201 | 201 | 'post_status' => 'any', |
202 | 202 | 'fields' => 'ids', |
203 | 203 | ); |
204 | 204 | |
205 | - $forms = new WP_Query( $args ); |
|
205 | + $forms = new WP_Query($args); |
|
206 | 206 | $total = (int) $forms->post_count; |
207 | 207 | $percentage = 100; |
208 | 208 | |
209 | - if ( $total > 0 ) { |
|
210 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
209 | + if ($total > 0) { |
|
210 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
211 | 211 | } |
212 | 212 | |
213 | - if ( $percentage > 100 ) { |
|
213 | + if ($percentage > 100) { |
|
214 | 214 | $percentage = 100; |
215 | 215 | } |
216 | 216 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.0 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
21 | + do_action('give_tools_tab_export_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat export-options-table give-table"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,43 +38,43 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
41 | + do_action('give_tools_tab_export_table_top'); |
|
42 | 42 | ?> |
43 | 43 | <tr class="give-export-pdf-sales-earnings"> |
44 | 44 | <td scope="row" class="row-title"> |
45 | 45 | <h3> |
46 | - <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
46 | + <span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
47 | 47 | </h3> |
48 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
48 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
49 | 49 | </td> |
50 | 50 | <td> |
51 | 51 | <a class="button" |
52 | - href="<?php echo wp_nonce_url( add_query_arg( [ |
|
52 | + href="<?php echo wp_nonce_url(add_query_arg([ |
|
53 | 53 | 'give-action' => 'generate_pdf', |
54 | - ] ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
54 | + ]), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
55 | 55 | </td> |
56 | 56 | </tr> |
57 | 57 | <tr class="alternate give-export-sales-earnings"> |
58 | 58 | <td scope="row" class="row-title"> |
59 | 59 | <h3> |
60 | - <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
60 | + <span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span> |
|
61 | 61 | </h3> |
62 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
62 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
63 | 63 | </td> |
64 | 64 | <td> |
65 | 65 | <form method="post"> |
66 | 66 | <?php |
67 | 67 | printf( |
68 | 68 | /* translators: 1: start date dropdown 2: end date dropdown */ |
69 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
70 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
71 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
69 | + esc_html__('%1$s to %2$s', 'give'), |
|
70 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
71 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
72 | 72 | ); |
73 | 73 | ?> |
74 | 74 | <input type="hidden" name="give-action" |
75 | 75 | value="earnings_export"/> |
76 | 76 | <input type="submit" |
77 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
77 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
78 | 78 | class="button-secondary"/> |
79 | 79 | </form> |
80 | 80 | </td> |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | <tr class="give-export-payment-history"> |
83 | 83 | <td scope="row" class="row-title"> |
84 | 84 | <h3> |
85 | - <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
|
85 | + <span><?php esc_html_e('Export Donation History', 'give'); ?></span> |
|
86 | 86 | </h3> |
87 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
87 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
88 | 88 | </td> |
89 | 89 | <td> |
90 | 90 | <form id="give-export-payments" |
@@ -93,27 +93,27 @@ discard block |
||
93 | 93 | $args = [ |
94 | 94 | 'id' => 'give-payment-export-start', |
95 | 95 | 'name' => 'start', |
96 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
96 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
97 | 97 | ]; |
98 | - echo Give()->html->date_field( $args ); ?> |
|
98 | + echo Give()->html->date_field($args); ?> |
|
99 | 99 | <?php |
100 | 100 | $args = [ |
101 | 101 | 'id' => 'give-payment-export-end', |
102 | 102 | 'name' => 'end', |
103 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
103 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
104 | 104 | ]; |
105 | - echo Give()->html->date_field( $args ); ?> |
|
105 | + echo Give()->html->date_field($args); ?> |
|
106 | 106 | <select name="status"> |
107 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
107 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
108 | 108 | <?php |
109 | 109 | $statuses = give_get_payment_statuses(); |
110 | - foreach ( $statuses as $status => $label ) { |
|
111 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
110 | + foreach ($statuses as $status => $label) { |
|
111 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </select> |
115 | 115 | <?php |
116 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
116 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
117 | 117 | echo Give()->html->category_dropdown( |
118 | 118 | 'give_forms_categories[]', |
119 | 119 | 0, |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | 'multiple' => true, |
124 | 124 | 'selected' => [], |
125 | 125 | 'show_option_all' => false, |
126 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
126 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
127 | 127 | ] |
128 | 128 | ); |
129 | 129 | } |
130 | 130 | |
131 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
131 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
132 | 132 | echo Give()->html->tags_dropdown( |
133 | 133 | 'give_forms_tags[]', |
134 | 134 | 0, |
@@ -138,18 +138,18 @@ discard block |
||
138 | 138 | 'multiple' => true, |
139 | 139 | 'selected' => [], |
140 | 140 | 'show_option_all' => false, |
141 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
141 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
142 | 142 | ] |
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
146 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
146 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
147 | 147 | ?> |
148 | 148 | <input type="hidden" name="give-export-class" |
149 | 149 | value="Give_Batch_Payments_Export"/> |
150 | 150 | <span> |
151 | 151 | <input type="submit" |
152 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
152 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
153 | 153 | class="button-secondary"/> |
154 | 154 | <span class="spinner"></span> |
155 | 155 | </span> |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | <tr class="alternate give-export-donors"> |
160 | 160 | <td scope="row" class="row-title"> |
161 | 161 | <h3> |
162 | - <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
|
162 | + <span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span> |
|
163 | 163 | </h3> |
164 | - <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> |
|
164 | + <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> |
|
165 | 165 | </td> |
166 | 166 | <td> |
167 | 167 | <form method="post" id="give_donor_export" |
@@ -173,73 +173,73 @@ discard block |
||
173 | 173 | 'id' => 'give_donor_export_form', |
174 | 174 | 'chosen' => true, |
175 | 175 | ]; |
176 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
176 | + echo Give()->html->forms_dropdown($args); ?> |
|
177 | 177 | |
178 | 178 | <input type="submit" |
179 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
179 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
180 | 180 | class="button-secondary"/> |
181 | 181 | |
182 | 182 | <div id="export-donor-options-wrap" |
183 | 183 | class="give-clearfix"> |
184 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
184 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
185 | 185 | <ul id="give-export-option-ul"> |
186 | 186 | <li> |
187 | 187 | <label for="give-export-fullname"> |
188 | 188 | <input type="checkbox" checked |
189 | 189 | name="give_export_option[full_name]" |
190 | - id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
190 | + id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
191 | 191 | </label> |
192 | 192 | </li> |
193 | 193 | <li> |
194 | 194 | <label for="give-export-email"> |
195 | 195 | <input type="checkbox" checked |
196 | 196 | name="give_export_option[email]" |
197 | - id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
197 | + id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
198 | 198 | </label> |
199 | 199 | </li> |
200 | 200 | <li> |
201 | 201 | <label for="give-export-address"> |
202 | 202 | <input type="checkbox" checked |
203 | 203 | name="give_export_option[address]" |
204 | - id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
204 | + id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
205 | 205 | </label> |
206 | 206 | </li> |
207 | 207 | <li> |
208 | 208 | <label for="give-export-userid"> |
209 | 209 | <input type="checkbox" checked |
210 | 210 | name="give_export_option[userid]" |
211 | - id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
211 | + id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
212 | 212 | </label> |
213 | 213 | </li> |
214 | 214 | <li> |
215 | 215 | <label for="give-export-first-donation-date"> |
216 | 216 | <input type="checkbox" checked |
217 | 217 | name="give_export_option[date_first_donated]" |
218 | - id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
218 | + id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
219 | 219 | </label> |
220 | 220 | </li> |
221 | 221 | <li> |
222 | 222 | <label for="give-export-donation-number"> |
223 | 223 | <input type="checkbox" checked |
224 | 224 | name="give_export_option[donations]" |
225 | - id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
225 | + id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
226 | 226 | </label> |
227 | 227 | </li> |
228 | 228 | <li> |
229 | 229 | <label for="give-export-donation-sum"> |
230 | 230 | <input type="checkbox" checked |
231 | 231 | name="give_export_option[donation_sum]" |
232 | - id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
232 | + id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
233 | 233 | </label> |
234 | 234 | </li> |
235 | 235 | </ul> |
236 | 236 | </div> |
237 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
237 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
238 | 238 | <input type="hidden" name="give-export-class" |
239 | 239 | value="Give_Batch_Customers_Export"/> |
240 | 240 | <input type="hidden" |
241 | 241 | name="give_export_option[query_id]" |
242 | - value="<?php echo uniqid( 'give_' ); ?>"/> |
|
242 | + value="<?php echo uniqid('give_'); ?>"/> |
|
243 | 243 | </form> |
244 | 244 | </td> |
245 | 245 | </tr> |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @since 1.0 |
254 | 254 | */ |
255 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
255 | + do_action('give_tools_tab_export_table_bottom'); |
|
256 | 256 | ?> |
257 | 257 | </tbody> |
258 | 258 | </table> |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @since 1.0 |
265 | 265 | */ |
266 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
266 | + do_action('give_tools_tab_export_content_bottom'); |
|
267 | 267 | ?> |
268 | 268 | |
269 | 269 | </div> |
@@ -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 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_customers_page() { |
26 | 26 | $default_views = give_customer_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_customer_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_customer_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_customers_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_customer_views', $views ); |
|
45 | + return apply_filters('give_customer_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
59 | + return apply_filters('give_customer_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_customers_list() { |
70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
71 | 71 | |
72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
73 | 73 | $customers_table->prepare_items(); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
85 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
86 | 86 | <?php |
87 | - $customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
87 | + $customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors'); |
|
88 | 88 | $customers_table->display(); |
89 | 89 | ?> |
90 | 90 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 1.0 |
99 | 99 | */ |
100 | - do_action( 'give_donors_table_bottom' ); |
|
100 | + do_action('give_donors_table_bottom'); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return void |
115 | 115 | */ |
116 | -function give_render_customer_view( $view, $callbacks ) { |
|
116 | +function give_render_customer_view($view, $callbacks) { |
|
117 | 117 | |
118 | 118 | $render = true; |
119 | 119 | |
120 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
120 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
121 | 121 | |
122 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
123 | - give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) ); |
|
122 | + if ( ! current_user_can($customer_view_role)) { |
|
123 | + give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give')); |
|
124 | 124 | $render = false; |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
128 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
128 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
129 | 129 | $render = false; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $customer_id = (int) $_GET['id']; |
133 | - $customer = new Give_Customer( $customer_id ); |
|
133 | + $customer = new Give_Customer($customer_id); |
|
134 | 134 | |
135 | - if ( empty( $customer->id ) ) { |
|
136 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
135 | + if (empty($customer->id)) { |
|
136 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
137 | 137 | $render = false; |
138 | 138 | } |
139 | 139 | |
@@ -142,34 +142,34 @@ discard block |
||
142 | 142 | |
143 | 143 | <div class='wrap'> |
144 | 144 | |
145 | - <?php if ( give_get_errors() ) : ?> |
|
145 | + <?php if (give_get_errors()) : ?> |
|
146 | 146 | <div class="error settings-error"> |
147 | - <?php give_print_errors( 0 ); ?> |
|
147 | + <?php give_print_errors(0); ?> |
|
148 | 148 | </div> |
149 | 149 | <?php endif; ?> |
150 | 150 | |
151 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1> |
|
151 | + <h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1> |
|
152 | 152 | |
153 | - <?php if ( $customer && $render ) : ?> |
|
153 | + <?php if ($customer && $render) : ?> |
|
154 | 154 | |
155 | 155 | <h2 class="nav-tab-wrapper"> |
156 | 156 | <?php |
157 | - foreach ( $customer_tabs as $key => $tab ) : |
|
157 | + foreach ($customer_tabs as $key => $tab) : |
|
158 | 158 | $active = $key === $view ? true : false; |
159 | 159 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
160 | 160 | printf( |
161 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
162 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ), |
|
163 | - esc_attr( $class ), |
|
164 | - sanitize_html_class( $tab['dashicon'] ), |
|
165 | - esc_html( $tab['title'] ) |
|
161 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
162 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)), |
|
163 | + esc_attr($class), |
|
164 | + sanitize_html_class($tab['dashicon']), |
|
165 | + esc_html($tab['title']) |
|
166 | 166 | ); |
167 | 167 | endforeach; |
168 | 168 | ?> |
169 | 169 | </h2> |
170 | 170 | |
171 | 171 | <div id="give-customer-card-wrapper"> |
172 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
172 | + <?php $callbacks[$view]($customer) ?> |
|
173 | 173 | </div> |
174 | 174 | |
175 | 175 | <?php endif; ?> |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return void |
191 | 191 | */ |
192 | -function give_customers_view( $customer ) { |
|
192 | +function give_customers_view($customer) { |
|
193 | 193 | |
194 | - $customer_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
194 | + $customer_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Fires in donor profile screen, above the donor card. |
@@ -200,32 +200,32 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param object $customer The customer object being displayed. |
202 | 202 | */ |
203 | - do_action( 'give_donor_card_top', $customer ); |
|
203 | + do_action('give_donor_card_top', $customer); |
|
204 | 204 | ?> |
205 | 205 | |
206 | 206 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
207 | 207 | |
208 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
208 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
209 | 209 | |
210 | 210 | <div class="customer-info"> |
211 | 211 | |
212 | 212 | <div class="donor-bio-header clearfix"> |
213 | 213 | |
214 | 214 | <div class="avatar-wrap left" id="customer-avatar"> |
215 | - <?php echo get_avatar( $customer->email ); ?> |
|
215 | + <?php echo get_avatar($customer->email); ?> |
|
216 | 216 | </div> |
217 | 217 | |
218 | 218 | <div id="customer-name-wrap" class="left"> |
219 | 219 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
220 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
220 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
221 | 221 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
222 | 222 | </div> |
223 | 223 | <p class="customer-since info-item"> |
224 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
225 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
224 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
225 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
226 | 226 | </p> |
227 | - <?php if ( current_user_can( $customer_edit_role ) ) : ?> |
|
228 | - <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
227 | + <?php if (current_user_can($customer_edit_role)) : ?> |
|
228 | + <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
229 | 229 | <?php endif; ?> |
230 | 230 | </div> |
231 | 231 | <!-- /donor-bio-header --> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | <table class="widefat"> |
236 | 236 | <tbody> |
237 | 237 | <tr class="alternate"> |
238 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User:', 'give' ); ?></label></th> |
|
238 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User:', 'give'); ?></label></th> |
|
239 | 239 | <td> |
240 | 240 | <span class="customer-user-id info-item edit-item"> |
241 | 241 | <?php |
@@ -252,37 +252,37 @@ discard block |
||
252 | 252 | 'data' => $data_atts, |
253 | 253 | ); |
254 | 254 | |
255 | - if ( ! empty( $user_id ) ) { |
|
256 | - $userdata = get_userdata( $user_id ); |
|
255 | + if ( ! empty($user_id)) { |
|
256 | + $userdata = get_userdata($user_id); |
|
257 | 257 | $user_args['value'] = $userdata->user_login; |
258 | 258 | } |
259 | 259 | |
260 | - echo Give()->html->ajax_user_search( $user_args ); |
|
260 | + echo Give()->html->ajax_user_search($user_args); |
|
261 | 261 | ?> |
262 | 262 | </span> |
263 | 263 | |
264 | 264 | <span class="customer-user-id info-item editable"> |
265 | - <?php if ( !empty( $userdata ) ) { ?> |
|
266 | - <span data-key="user_id">#<?php echo $customer->user_id . ' - ' . $userdata->display_name; ?></span> |
|
265 | + <?php if ( ! empty($userdata)) { ?> |
|
266 | + <span data-key="user_id">#<?php echo $customer->user_id.' - '.$userdata->display_name; ?></span> |
|
267 | 267 | <?php } else { ?> |
268 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
268 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
269 | 269 | <?php } ?> |
270 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) { ?> |
|
271 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this customer record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
270 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?> |
|
271 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this customer record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
272 | 272 | <?php } ?> |
273 | 273 | </span> |
274 | 274 | </td> |
275 | 275 | </tr> |
276 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
276 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
277 | 277 | |
278 | 278 | <tr> |
279 | - <th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th> |
|
279 | + <th scope="col"><?php esc_html_e('Address:', 'give'); ?></th> |
|
280 | 280 | <td class="row-title"> |
281 | 281 | |
282 | 282 | <div class="customer-address-wrapper"> |
283 | 283 | |
284 | 284 | <?php |
285 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
285 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
286 | 286 | $defaults = array( |
287 | 287 | 'line1' => '', |
288 | 288 | 'line2' => '', |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | 'zip' => '', |
293 | 293 | ); |
294 | 294 | |
295 | - $address = wp_parse_args( $address, $defaults ); |
|
295 | + $address = wp_parse_args($address, $defaults); |
|
296 | 296 | ?> |
297 | 297 | |
298 | - <?php if ( ! empty( $address ) ) { ?> |
|
298 | + <?php if ( ! empty($address)) { ?> |
|
299 | 299 | <span class="customer-address info-item editable"> |
300 | 300 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
301 | 301 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -306,43 +306,43 @@ discard block |
||
306 | 306 | </span> |
307 | 307 | <?php } ?> |
308 | 308 | <span class="customer-address info-item edit-item"> |
309 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
310 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
311 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
309 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
310 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
311 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
312 | 312 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
313 | 313 | <?php |
314 | 314 | |
315 | 315 | $selected_country = $address['country']; |
316 | 316 | |
317 | 317 | $countries = give_get_country_list(); |
318 | - foreach ( $countries as $country_code => $country ) { |
|
319 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
318 | + foreach ($countries as $country_code => $country) { |
|
319 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
320 | 320 | } |
321 | 321 | ?> |
322 | 322 | </select> |
323 | 323 | <?php |
324 | 324 | $selected_state = give_get_state(); |
325 | - $states = give_get_states( $selected_country ); |
|
325 | + $states = give_get_states($selected_country); |
|
326 | 326 | |
327 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
327 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
328 | 328 | |
329 | - if ( ! empty( $states ) ) { |
|
329 | + if ( ! empty($states)) { |
|
330 | 330 | ?> |
331 | 331 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
332 | 332 | <?php |
333 | - foreach ( $states as $state_code => $state ) { |
|
334 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
333 | + foreach ($states as $state_code => $state) { |
|
334 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
335 | 335 | } |
336 | 336 | ?> |
337 | 337 | </select> |
338 | 338 | <?php |
339 | 339 | } else { |
340 | 340 | ?> |
341 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
341 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
342 | 342 | <?php |
343 | 343 | } |
344 | 344 | ?> |
345 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
345 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
346 | 346 | </span> |
347 | 347 | |
348 | 348 | </div> |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | |
359 | 359 | <span id="customer-edit-actions" class="edit-item"> |
360 | 360 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
361 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
361 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
362 | 362 | <input type="hidden" name="give_action" value="edit-customer" /> |
363 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
364 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
363 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
364 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
365 | 365 | </span> |
366 | 366 | |
367 | 367 | </form> |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param object $customer The customer object being displayed. |
378 | 378 | */ |
379 | - do_action( 'give_donor_before_stats', $customer ); |
|
379 | + do_action('give_donor_before_stats', $customer); |
|
380 | 380 | ?> |
381 | 381 | |
382 | 382 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
383 | 383 | <ul> |
384 | 384 | <li> |
385 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
385 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
386 | 386 | <span class="dashicons dashicons-heart"></span> |
387 | 387 | <?php |
388 | 388 | // Completed Donations |
389 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
390 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
389 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
390 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
391 | 391 | ?> |
392 | 392 | </a> |
393 | 393 | </li> |
394 | 394 | <li> |
395 | 395 | <span class="dashicons dashicons-chart-area"></span> |
396 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
396 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
397 | 397 | </li> |
398 | 398 | <?php |
399 | 399 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @param object $customer The customer object being displayed. |
407 | 407 | */ |
408 | - do_action( 'give_donor_stats_list', $customer ); |
|
408 | + do_action('give_donor_stats_list', $customer); |
|
409 | 409 | ?> |
410 | 410 | </ul> |
411 | 411 | </div> |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param object $customer The customer object being displayed. |
420 | 420 | */ |
421 | - do_action( 'give_donor_before_tables_wrapper', $customer ); |
|
421 | + do_action('give_donor_before_tables_wrapper', $customer); |
|
422 | 422 | ?> |
423 | 423 | |
424 | 424 | <div id="customer-tables-wrapper" class="customer-section"> |
@@ -431,46 +431,46 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @param object $customer The customer object being displayed. |
433 | 433 | */ |
434 | - do_action( 'give_donor_before_tables', $customer ); |
|
434 | + do_action('give_donor_before_tables', $customer); |
|
435 | 435 | ?> |
436 | 436 | |
437 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
437 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
438 | 438 | |
439 | 439 | <table class="wp-list-table widefat striped emails"> |
440 | 440 | <thead> |
441 | 441 | <tr> |
442 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
443 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
442 | + <th><?php _e('Email', 'give'); ?></th> |
|
443 | + <th><?php _e('Actions', 'give'); ?></th> |
|
444 | 444 | </tr> |
445 | 445 | </thead> |
446 | 446 | |
447 | 447 | <tbody> |
448 | - <?php if ( ! empty( $customer->emails ) ) { ?> |
|
448 | + <?php if ( ! empty($customer->emails)) { ?> |
|
449 | 449 | |
450 | - <?php foreach ( $customer->emails as $key => $email ) : ?> |
|
450 | + <?php foreach ($customer->emails as $key => $email) : ?> |
|
451 | 451 | <tr data-key="<?php echo $key; ?>"> |
452 | 452 | <td> |
453 | 453 | <?php echo $email; ?> |
454 | - <?php if ( 'primary' === $key ) : ?> |
|
454 | + <?php if ('primary' === $key) : ?> |
|
455 | 455 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
456 | 456 | <?php endif; ?> |
457 | 457 | </td> |
458 | 458 | <td> |
459 | - <?php if ( 'primary' !== $key ) : ?> |
|
459 | + <?php if ('primary' !== $key) : ?> |
|
460 | 460 | <?php |
461 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); |
|
462 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
463 | - 'email' => rawurlencode( $email ), |
|
461 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); |
|
462 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
463 | + 'email' => rawurlencode($email), |
|
464 | 464 | 'give_action' => 'set_donor_primary_email', |
465 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
466 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
467 | - 'email' => rawurlencode( $email ), |
|
465 | + ), $base_url), 'give-set-donor-primary-email'); |
|
466 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
467 | + 'email' => rawurlencode($email), |
|
468 | 468 | 'give_action' => 'remove_donor_email', |
469 | - ), $base_url ), 'give-remove-donor-email' ); |
|
469 | + ), $base_url), 'give-remove-donor-email'); |
|
470 | 470 | ?> |
471 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
471 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
472 | 472 | | |
473 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
473 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
474 | 474 | <?php endif; ?> |
475 | 475 | </td> |
476 | 476 | </tr> |
@@ -480,59 +480,59 @@ discard block |
||
480 | 480 | <td colspan="2" class="add-customer-email-td"> |
481 | 481 | <div class="add-customer-email-wrapper"> |
482 | 482 | <input type="hidden" name="customer-id" value="<?php echo $customer->id; ?>" /> |
483 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
484 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
485 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
486 | - <button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
483 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
484 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
485 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
486 | + <button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e('Add Email', 'give'); ?></button> |
|
487 | 487 | <span class="spinner"></span> |
488 | 488 | </div> |
489 | 489 | <div class="notice-wrap"></div> |
490 | 490 | </td> |
491 | 491 | </tr> |
492 | 492 | <?php } else { ?> |
493 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'easy-digital-downloads' ); ?></td></tr> |
|
493 | + <tr><td colspan="2"><?php _e('No Emails Found', 'easy-digital-downloads'); ?></td></tr> |
|
494 | 494 | <?php }// End if(). |
495 | 495 | ?> |
496 | 496 | </tbody> |
497 | 497 | </table> |
498 | 498 | |
499 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
499 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
500 | 500 | <?php |
501 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
502 | - $payments = give_get_payments( array( |
|
501 | + $payment_ids = explode(',', $customer->payment_ids); |
|
502 | + $payments = give_get_payments(array( |
|
503 | 503 | 'post__in' => $payment_ids, |
504 | - ) ); |
|
505 | - $payments = array_slice( $payments, 0, 10 ); |
|
504 | + )); |
|
505 | + $payments = array_slice($payments, 0, 10); |
|
506 | 506 | ?> |
507 | 507 | <table class="wp-list-table widefat striped payments"> |
508 | 508 | <thead> |
509 | 509 | <tr> |
510 | - <th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
511 | - <th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
512 | - <th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
513 | - <th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
514 | - <th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
510 | + <th scope="col"><?php esc_html_e('ID', 'give'); ?></th> |
|
511 | + <th scope="col"><?php esc_html_e('Amount', 'give'); ?></th> |
|
512 | + <th scope="col"><?php esc_html_e('Date', 'give'); ?></th> |
|
513 | + <th scope="col"><?php esc_html_e('Status', 'give'); ?></th> |
|
514 | + <th scope="col"><?php esc_html_e('Actions', 'give'); ?></th> |
|
515 | 515 | </tr> |
516 | 516 | </thead> |
517 | 517 | <tbody> |
518 | - <?php if ( ! empty( $payments ) ) { ?> |
|
519 | - <?php foreach ( $payments as $payment ) : ?> |
|
518 | + <?php if ( ! empty($payments)) { ?> |
|
519 | + <?php foreach ($payments as $payment) : ?> |
|
520 | 520 | <tr> |
521 | 521 | <td><?php echo $payment->ID; ?></td> |
522 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
523 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
524 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
522 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
523 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
524 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
525 | 525 | <td> |
526 | 526 | <?php |
527 | 527 | printf( |
528 | 528 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
529 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ), |
|
529 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID), |
|
530 | 530 | sprintf( |
531 | 531 | /* translators: %s: Donation ID */ |
532 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
532 | + esc_attr__('View Donation %s.', 'give'), |
|
533 | 533 | $payment->ID |
534 | 534 | ), |
535 | - esc_html__( 'View Donation', 'give' ) |
|
535 | + esc_html__('View Donation', 'give') |
|
536 | 536 | ); |
537 | 537 | ?> |
538 | 538 | |
@@ -547,47 +547,47 @@ discard block |
||
547 | 547 | * @param object $customer The customer object being displayed. |
548 | 548 | * @param object $payment The payment object being displayed. |
549 | 549 | */ |
550 | - do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); |
|
550 | + do_action('give_donor_recent_purchases_actions', $customer, $payment); |
|
551 | 551 | ?> |
552 | 552 | </td> |
553 | 553 | </tr> |
554 | 554 | <?php endforeach; ?> |
555 | 555 | <?php } else { ?> |
556 | 556 | <tr> |
557 | - <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td> |
|
557 | + <td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td> |
|
558 | 558 | </tr> |
559 | 559 | <?php }// End if(). |
560 | 560 | ?> |
561 | 561 | </tbody> |
562 | 562 | </table> |
563 | 563 | |
564 | - <h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3> |
|
564 | + <h3><?php esc_html_e('Completed Forms', 'give'); ?></h3> |
|
565 | 565 | <?php |
566 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
566 | + $donations = give_get_users_completed_donations($customer->email); |
|
567 | 567 | ?> |
568 | 568 | <table class="wp-list-table widefat striped donations"> |
569 | 569 | <thead> |
570 | 570 | <tr> |
571 | - <th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th> |
|
572 | - <th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
571 | + <th scope="col"><?php esc_html_e('Form', 'give'); ?></th> |
|
572 | + <th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
573 | 573 | </tr> |
574 | 574 | </thead> |
575 | 575 | <tbody> |
576 | - <?php if ( ! empty( $donations ) ) { ?> |
|
577 | - <?php foreach ( $donations as $donation ) : ?> |
|
576 | + <?php if ( ! empty($donations)) { ?> |
|
577 | + <?php foreach ($donations as $donation) : ?> |
|
578 | 578 | <tr> |
579 | 579 | <td><?php echo $donation->post_title; ?></td> |
580 | 580 | <td> |
581 | 581 | <?php |
582 | 582 | printf( |
583 | 583 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
584 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
584 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
585 | 585 | sprintf( |
586 | 586 | /* translators: %s: form name */ |
587 | - esc_attr__( 'View Form %s.', 'give' ), |
|
587 | + esc_attr__('View Form %s.', 'give'), |
|
588 | 588 | $donation->post_title |
589 | 589 | ), |
590 | - esc_html__( 'View Form', 'give' ) |
|
590 | + esc_html__('View Form', 'give') |
|
591 | 591 | ); |
592 | 592 | ?> |
593 | 593 | </td> |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | <?php endforeach; ?> |
596 | 596 | <?php } else { ?> |
597 | 597 | <tr> |
598 | - <td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td> |
|
598 | + <td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td> |
|
599 | 599 | </tr> |
600 | 600 | <?php } ?> |
601 | 601 | </tbody> |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @param object $customer The customer object being displayed. |
611 | 611 | */ |
612 | - do_action( 'give_donor_after_tables', $customer ); |
|
612 | + do_action('give_donor_after_tables', $customer); |
|
613 | 613 | ?> |
614 | 614 | |
615 | 615 | </div> |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @param object $customer The customer object being displayed. |
624 | 624 | */ |
625 | - do_action( 'give_donor_card_bottom', $customer ); |
|
625 | + do_action('give_donor_card_bottom', $customer); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -635,30 +635,30 @@ discard block |
||
635 | 635 | * |
636 | 636 | * @return void |
637 | 637 | */ |
638 | -function give_customer_notes_view( $customer ) { |
|
638 | +function give_customer_notes_view($customer) { |
|
639 | 639 | |
640 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
641 | - $paged = absint( $paged ); |
|
640 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
641 | + $paged = absint($paged); |
|
642 | 642 | $note_count = $customer->get_notes_count(); |
643 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
644 | - $total_pages = ceil( $note_count / $per_page ); |
|
645 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
643 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
644 | + $total_pages = ceil($note_count / $per_page); |
|
645 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
646 | 646 | ?> |
647 | 647 | |
648 | 648 | <div id="customer-notes-wrapper"> |
649 | 649 | <div class="customer-notes-header"> |
650 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
650 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
651 | 651 | </div> |
652 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
652 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
653 | 653 | |
654 | - <?php if ( 1 == $paged ) : ?> |
|
654 | + <?php if (1 == $paged) : ?> |
|
655 | 655 | <div style="display: block; margin-bottom: 55px;"> |
656 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
656 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
657 | 657 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
658 | 658 | <br /> |
659 | 659 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
660 | 660 | <input type="hidden" name="give_action" value="add-customer-note" /> |
661 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
661 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
662 | 662 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
663 | 663 | </form> |
664 | 664 | </div> |
@@ -673,26 +673,26 @@ discard block |
||
673 | 673 | 'show_all' => true, |
674 | 674 | ); |
675 | 675 | |
676 | - echo paginate_links( $pagination_args ); |
|
676 | + echo paginate_links($pagination_args); |
|
677 | 677 | ?> |
678 | 678 | |
679 | 679 | <div id="give-customer-notes" class="postbox"> |
680 | - <?php if ( count( $customer_notes ) > 0 ) { ?> |
|
681 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
680 | + <?php if (count($customer_notes) > 0) { ?> |
|
681 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
682 | 682 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
683 | 683 | <span class="note-content-wrap"> |
684 | - <?php echo stripslashes( $note ); ?> |
|
684 | + <?php echo stripslashes($note); ?> |
|
685 | 685 | </span> |
686 | 686 | </div> |
687 | 687 | <?php endforeach; ?> |
688 | 688 | <?php } else { ?> |
689 | 689 | <div class="give-no-customer-notes"> |
690 | - <?php esc_html_e( 'No donor notes found.', 'give' ); ?> |
|
690 | + <?php esc_html_e('No donor notes found.', 'give'); ?> |
|
691 | 691 | </div> |
692 | 692 | <?php } ?> |
693 | 693 | </div> |
694 | 694 | |
695 | - <?php echo paginate_links( $pagination_args ); ?> |
|
695 | + <?php echo paginate_links($pagination_args); ?> |
|
696 | 696 | |
697 | 697 | </div> |
698 | 698 | |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return void |
710 | 710 | */ |
711 | -function give_customers_delete_view( $customer ) { |
|
711 | +function give_customers_delete_view($customer) { |
|
712 | 712 | |
713 | - $customer_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
713 | + $customer_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
714 | 714 | |
715 | 715 | /** |
716 | 716 | * Fires in donor delete screen, above the content. |
@@ -719,15 +719,15 @@ discard block |
||
719 | 719 | * |
720 | 720 | * @param object $customer The customer object being displayed. |
721 | 721 | */ |
722 | - do_action( 'give_customer_delete_top', $customer ); |
|
722 | + do_action('give_customer_delete_top', $customer); |
|
723 | 723 | ?> |
724 | 724 | |
725 | 725 | <div class="info-wrapper customer-section"> |
726 | 726 | |
727 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
727 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
728 | 728 | |
729 | 729 | <div class="customer-notes-header"> |
730 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
730 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
731 | 731 | </div> |
732 | 732 | |
733 | 733 | |
@@ -735,20 +735,20 @@ discard block |
||
735 | 735 | |
736 | 736 | <span class="delete-customer-options"> |
737 | 737 | <p> |
738 | - <?php echo Give()->html->checkbox( array( |
|
738 | + <?php echo Give()->html->checkbox(array( |
|
739 | 739 | 'name' => 'give-customer-delete-confirm', |
740 | - ) ); ?> |
|
741 | - <label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
740 | + )); ?> |
|
741 | + <label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
742 | 742 | </p> |
743 | 743 | |
744 | 744 | <p> |
745 | - <?php echo Give()->html->checkbox( array( |
|
745 | + <?php echo Give()->html->checkbox(array( |
|
746 | 746 | 'name' => 'give-customer-delete-records', |
747 | 747 | 'options' => array( |
748 | 748 | 'disabled' => true, |
749 | 749 | ), |
750 | - ) ); ?> |
|
751 | - <label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
750 | + )); ?> |
|
751 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label> |
|
752 | 752 | </p> |
753 | 753 | |
754 | 754 | <?php |
@@ -761,16 +761,16 @@ discard block |
||
761 | 761 | * |
762 | 762 | * @param object $customer The customer object being displayed. |
763 | 763 | */ |
764 | - do_action( 'give_customer_delete_inputs', $customer ); |
|
764 | + do_action('give_customer_delete_inputs', $customer); |
|
765 | 765 | ?> |
766 | 766 | </span> |
767 | 767 | |
768 | 768 | <span id="customer-edit-actions"> |
769 | 769 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
770 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
770 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
771 | 771 | <input type="hidden" name="give_action" value="delete-customer" /> |
772 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
773 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
772 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
773 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
774 | 774 | </span> |
775 | 775 | |
776 | 776 | </div> |
@@ -786,5 +786,5 @@ discard block |
||
786 | 786 | * |
787 | 787 | * @param object $customer The customer object being displayed. |
788 | 788 | */ |
789 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
789 | + do_action('give_customer_delete_bottom', $customer); |
|
790 | 790 | } |