@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views |
25 | 25 | */ |
26 | -function give_register_default_customer_views( $views ) { |
|
26 | +function give_register_default_customer_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_customers_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_customer_notes_view' |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 ); |
|
38 | +add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single customer view |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_customer_tabs( $tabs ) { |
|
49 | +function give_register_default_customer_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | - 'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => __( 'Donor Profile', 'give' ) ), |
|
53 | - 'notes' => array( 'dashicon' => 'dashicons-admin-comments', 'title' => __( 'Donor Notes', 'give' ) ) |
|
52 | + 'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => __('Donor Profile', 'give')), |
|
53 | + 'notes' => array('dashicon' => 'dashicons-admin-comments', 'title' => __('Donor Notes', 'give')) |
|
54 | 54 | ); |
55 | 55 | |
56 | - return array_merge( $tabs, $default_tabs ); |
|
56 | + return array_merge($tabs, $default_tabs); |
|
57 | 57 | } |
58 | 58 | |
59 | -add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 ); |
|
59 | +add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Register the Delete icon as late as possible so it's at the bottom |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return array The altered list of tabs, with 'delete' at the bottom |
69 | 69 | */ |
70 | -function give_register_delete_customer_tab( $tabs ) { |
|
70 | +function give_register_delete_customer_tab($tabs) { |
|
71 | 71 | |
72 | - $tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => __( 'Delete Donor', 'give' ) ); |
|
72 | + $tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => __('Delete Donor', 'give')); |
|
73 | 73 | |
74 | 74 | return $tabs; |
75 | 75 | } |
76 | 76 | |
77 | -add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 ); |
|
77 | +add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1); |
@@ -259,8 +259,11 @@ discard block |
||
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | 260 | <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | - <?php else : ?> |
|
263 | - <span data-key="user_id"><?php _e( 'none', 'give' ); ?></span> |
|
262 | + <?php else { |
|
263 | + : ?> |
|
264 | + <span data-key="user_id"><?php _e( 'none', 'give' ); |
|
265 | +} |
|
266 | +?></span> |
|
264 | 267 | <?php endif; ?> |
265 | 268 | <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
266 | 269 | <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
@@ -329,8 +332,11 @@ discard block |
||
329 | 332 | } |
330 | 333 | ?> |
331 | 334 | </select> |
332 | - <?php else : ?> |
|
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
335 | + <?php else { |
|
336 | + : ?> |
|
337 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); |
|
338 | +} |
|
339 | +?>" /> |
|
334 | 340 | <?php endif; ?> |
335 | 341 | <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
336 | 342 | </span> |
@@ -416,9 +422,12 @@ discard block |
||
416 | 422 | </td> |
417 | 423 | </tr> |
418 | 424 | <?php endforeach; ?> |
419 | - <?php else: ?> |
|
425 | + <?php else { |
|
426 | + : ?> |
|
420 | 427 | <tr> |
421 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
428 | + <td colspan="5"><?php _e( 'No Donations Found', 'give' ); |
|
429 | +} |
|
430 | +?></td> |
|
422 | 431 | </tr> |
423 | 432 | <?php endif; ?> |
424 | 433 | </tbody> |
@@ -447,9 +456,12 @@ discard block |
||
447 | 456 | </td> |
448 | 457 | </tr> |
449 | 458 | <?php endforeach; ?> |
450 | - <?php else: ?> |
|
459 | + <?php else { |
|
460 | + : ?> |
|
451 | 461 | <tr> |
452 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
462 | + <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); |
|
463 | +} |
|
464 | +?></td> |
|
453 | 465 | </tr> |
454 | 466 | <?php endif; ?> |
455 | 467 | </tbody> |
@@ -523,9 +535,12 @@ discard block |
||
523 | 535 | </span> |
524 | 536 | </div> |
525 | 537 | <?php endforeach; ?> |
526 | - <?php else: ?> |
|
538 | + <?php else { |
|
539 | + : ?> |
|
527 | 540 | <div class="give-no-customer-notes"> |
528 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
541 | + <?php _e( 'No Donor Notes', 'give' ); |
|
542 | +} |
|
543 | +?> |
|
529 | 544 | </div> |
530 | 545 | <?php endif; ?> |
531 | 546 | </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,24 +67,24 @@ 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(); |
74 | 74 | ?> |
75 | 75 | <div class="wrap"> |
76 | - <h2><?php _e( 'Donors', 'give' ); ?></h2> |
|
77 | - <?php do_action( 'give_donors_table_top' ); ?> |
|
78 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
76 | + <h2><?php _e('Donors', 'give'); ?></h2> |
|
77 | + <?php do_action('give_donors_table_top'); ?> |
|
78 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
79 | 79 | <?php |
80 | - $customers_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
80 | + $customers_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
81 | 81 | $customers_table->display(); |
82 | 82 | ?> |
83 | 83 | <input type="hidden" name="post_type" value="give_forms" /> |
84 | 84 | <input type="hidden" name="page" value="give-donors" /> |
85 | 85 | <input type="hidden" name="view" value="customers" /> |
86 | 86 | </form> |
87 | - <?php do_action( 'give_donors_table_bottom' ); ?> |
|
87 | + <?php do_action('give_donors_table_bottom'); ?> |
|
88 | 88 | </div> |
89 | 89 | <?php |
90 | 90 | } |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | -function give_render_customer_view( $view, $callbacks ) { |
|
102 | +function give_render_customer_view($view, $callbacks) { |
|
103 | 103 | |
104 | 104 | $render = true; |
105 | 105 | |
106 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
106 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
107 | 107 | |
108 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
109 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
108 | + if ( ! current_user_can($customer_view_role)) { |
|
109 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
110 | 110 | $render = false; |
111 | 111 | } |
112 | 112 | |
113 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
114 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
113 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
114 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
115 | 115 | $render = false; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $customer_id = (int) $_GET['id']; |
119 | - $customer = new Give_Customer( $customer_id ); |
|
119 | + $customer = new Give_Customer($customer_id); |
|
120 | 120 | |
121 | - if ( empty( $customer->id ) ) { |
|
122 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
121 | + if (empty($customer->id)) { |
|
122 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
123 | 123 | $render = false; |
124 | 124 | } |
125 | 125 | |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | |
129 | 129 | <div class='wrap'> |
130 | 130 | |
131 | - <?php if ( give_get_errors() ) : ?> |
|
131 | + <?php if (give_get_errors()) : ?> |
|
132 | 132 | <div class="error settings-error"> |
133 | - <?php give_print_errors( 0 ); ?> |
|
133 | + <?php give_print_errors(0); ?> |
|
134 | 134 | </div> |
135 | 135 | <?php endif; ?> |
136 | 136 | |
137 | - <?php if ( $customer && $render ) : ?> |
|
137 | + <?php if ($customer && $render) : ?> |
|
138 | 138 | |
139 | 139 | <div id="customer-tab-wrapper"> |
140 | 140 | <ul id="customer-tab-wrapper-list" class="nav-tab-wrapper"> |
141 | - <?php foreach ( $customer_tabs as $key => $tab ) : ?> |
|
141 | + <?php foreach ($customer_tabs as $key => $tab) : ?> |
|
142 | 142 | <?php $active = $key === $view ? true : false; ?> |
143 | 143 | <?php $class = $active ? 'active' : 'inactive'; ?> |
144 | 144 | |
145 | - <li class="<?php echo sanitize_html_class( $class ); ?>"> |
|
146 | - <?php if ( ! $active ) : ?> |
|
147 | - <a title="<?php echo esc_attr( $tab['title'] ); ?>" aria-label="<?php echo esc_attr( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>"> |
|
145 | + <li class="<?php echo sanitize_html_class($class); ?>"> |
|
146 | + <?php if ( ! $active) : ?> |
|
147 | + <a title="<?php echo esc_attr($tab['title']); ?>" aria-label="<?php echo esc_attr($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>"> |
|
148 | 148 | <?php endif; ?> |
149 | 149 | |
150 | - <span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php echo esc_attr( $tab['title'] ); ?> |
|
151 | - <?php if ( ! $active ) : ?> |
|
150 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php echo esc_attr($tab['title']); ?> |
|
151 | + <?php if ( ! $active) : ?> |
|
152 | 152 | </a> |
153 | 153 | <?php endif; ?> |
154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | </div> |
161 | 161 | |
162 | 162 | <div id="give-customer-card-wrapper"> |
163 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
163 | + <?php $callbacks[$view]($customer) ?> |
|
164 | 164 | </div> |
165 | 165 | |
166 | 166 | <?php endif; ?> |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return void |
182 | 182 | */ |
183 | -function give_customers_view( $customer ) { |
|
183 | +function give_customers_view($customer) { |
|
184 | 184 | |
185 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
185 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
186 | 186 | |
187 | 187 | ?> |
188 | 188 | |
189 | - <?php do_action( 'give_donor_card_top', $customer ); ?> |
|
189 | + <?php do_action('give_donor_card_top', $customer); ?> |
|
190 | 190 | |
191 | 191 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
192 | 192 | |
193 | - <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 ); ?>"> |
|
193 | + <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); ?>"> |
|
194 | 194 | |
195 | 195 | <div class="customer-info"> |
196 | 196 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | <div class="donor-bio-header clearfix"> |
199 | 199 | |
200 | 200 | <div class="avatar-wrap left" id="customer-avatar"> |
201 | - <?php echo get_avatar( $customer->email ); ?> |
|
201 | + <?php echo get_avatar($customer->email); ?> |
|
202 | 202 | </div> |
203 | 203 | |
204 | 204 | <div class="customer-id" class="left"> |
205 | 205 | #<?php echo $customer->id; ?> |
206 | 206 | </div> |
207 | 207 | <div id="customer-name-wrap" class="left"> |
208 | - <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 _e( 'Donor Name', 'give' ); ?>" /></span> |
|
208 | + <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 _e('Donor Name', 'give'); ?>" /></span> |
|
209 | 209 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
210 | 210 | </div> |
211 | 211 | <p class="customer-since info-item"> |
212 | - <?php _e( 'Donor since', 'give' ); ?> |
|
213 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
212 | + <?php _e('Donor since', 'give'); ?> |
|
213 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
214 | 214 | </p> |
215 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
216 | - <a title="<?php _e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
215 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
216 | + <a title="<?php _e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
217 | 217 | <?php endif; ?> |
218 | 218 | </div> |
219 | 219 | <!-- /donor-bio-header --> |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | <table class="widefat"> |
224 | 224 | <tbody> |
225 | 225 | <tr> |
226 | - <td><label for="tablecell"><?php esc_attr_e( 'Email', 'give' ); ?></label>:</td> |
|
226 | + <td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?></label>:</td> |
|
227 | 227 | <td class="row-title"> |
228 | - <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e( 'Donor Email', 'give' ); ?>" /></span> |
|
228 | + <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e('Donor Email', 'give'); ?>" /></span> |
|
229 | 229 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
230 | 230 | </td> |
231 | 231 | </tr> |
232 | 232 | <tr class="alternate"> |
233 | - <td><label for="tablecell"><?php esc_attr_e( 'User ID', 'give' ); ?></label>:</td> |
|
233 | + <td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?></label>:</td> |
|
234 | 234 | <td class="row-title"> |
235 | 235 | <span class="customer-user-id info-item edit-item"> |
236 | 236 | <?php |
@@ -246,38 +246,38 @@ discard block |
||
246 | 246 | 'data' => $data_atts, |
247 | 247 | ); |
248 | 248 | |
249 | - if ( ! empty( $user_id ) ) { |
|
250 | - $userdata = get_userdata( $user_id ); |
|
249 | + if ( ! empty($user_id)) { |
|
250 | + $userdata = get_userdata($user_id); |
|
251 | 251 | $user_args['value'] = $userdata->user_login; |
252 | 252 | } |
253 | 253 | |
254 | - echo Give()->html->ajax_user_search( $user_args ); |
|
254 | + echo Give()->html->ajax_user_search($user_args); |
|
255 | 255 | ?> |
256 | 256 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
257 | 257 | </span> |
258 | 258 | |
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
260 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | 262 | <?php else : ?> |
263 | - <span data-key="user_id"><?php _e( 'none', 'give' ); ?></span> |
|
263 | + <span data-key="user_id"><?php _e('none', 'give'); ?></span> |
|
264 | 264 | <?php endif; ?> |
265 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
266 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
|
265 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
266 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php _e('Disconnect User', 'give'); ?></a></span> |
|
267 | 267 | <?php endif; ?> |
268 | 268 | </span> |
269 | 269 | </td> |
270 | 270 | </tr> |
271 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
271 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
272 | 272 | |
273 | 273 | <tr> |
274 | - <td><?php esc_attr_e( 'Address', 'give' ); ?>:</td> |
|
274 | + <td><?php esc_attr_e('Address', 'give'); ?>:</td> |
|
275 | 275 | <td class="row-title"> |
276 | 276 | |
277 | 277 | <div class="customer-address-wrapper"> |
278 | 278 | |
279 | 279 | <?php |
280 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
280 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
281 | 281 | $defaults = array( |
282 | 282 | 'line1' => '', |
283 | 283 | 'line2' => '', |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | 'zip' => '' |
288 | 288 | ); |
289 | 289 | |
290 | - $address = wp_parse_args( $address, $defaults ); |
|
290 | + $address = wp_parse_args($address, $defaults); |
|
291 | 291 | ?> |
292 | 292 | |
293 | - <?php if ( ! empty( $address ) ) { ?> |
|
293 | + <?php if ( ! empty($address)) { ?> |
|
294 | 294 | <span class="customer-address info-item editable"> |
295 | 295 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
296 | 296 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -301,38 +301,38 @@ discard block |
||
301 | 301 | </span> |
302 | 302 | <?php } ?> |
303 | 303 | <span class="customer-address info-item edit-item"> |
304 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
305 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
306 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
304 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
305 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
306 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
307 | 307 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
308 | 308 | <?php |
309 | 309 | |
310 | 310 | $selected_country = $address['country']; |
311 | 311 | |
312 | 312 | $countries = give_get_country_list(); |
313 | - foreach ( $countries as $country_code => $country ) { |
|
314 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
313 | + foreach ($countries as $country_code => $country) { |
|
314 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
315 | 315 | } |
316 | 316 | ?> |
317 | 317 | </select> |
318 | 318 | <?php |
319 | 319 | $selected_state = give_get_state(); |
320 | - $states = give_get_states( $selected_country ); |
|
320 | + $states = give_get_states($selected_country); |
|
321 | 321 | |
322 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
322 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
323 | 323 | |
324 | - if ( ! empty( $states ) ) : ?> |
|
324 | + if ( ! empty($states)) : ?> |
|
325 | 325 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
326 | 326 | <?php |
327 | - foreach ( $states as $state_code => $state ) { |
|
328 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
327 | + foreach ($states as $state_code => $state) { |
|
328 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
329 | 329 | } |
330 | 330 | ?> |
331 | 331 | </select> |
332 | 332 | <?php else : ?> |
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
333 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?>" /> |
|
334 | 334 | <?php endif; ?> |
335 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
335 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
336 | 336 | </span> |
337 | 337 | |
338 | 338 | </div> |
@@ -350,120 +350,120 @@ discard block |
||
350 | 350 | |
351 | 351 | <span id="customer-edit-actions" class="edit-item"> |
352 | 352 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
353 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
353 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
354 | 354 | <input type="hidden" name="give_action" value="edit-customer" /> |
355 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
356 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
355 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
356 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
357 | 357 | </span> |
358 | 358 | |
359 | 359 | </form> |
360 | 360 | </div> |
361 | 361 | |
362 | - <?php do_action( 'give_donor_before_stats', $customer ); ?> |
|
362 | + <?php do_action('give_donor_before_stats', $customer); ?> |
|
363 | 363 | |
364 | 364 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
365 | 365 | <ul> |
366 | 366 | <li> |
367 | - <a title="<?php _e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
367 | + <a title="<?php _e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
368 | 368 | <span class="dashicons dashicons-heart"></span> |
369 | 369 | <?php |
370 | 370 | //Completed Donations |
371 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
372 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
371 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
372 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
373 | 373 | ?> |
374 | 374 | </a> |
375 | 375 | </li> |
376 | 376 | <li> |
377 | 377 | <span class="dashicons dashicons-chart-area"></span> |
378 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
378 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
379 | 379 | </li> |
380 | - <?php do_action( 'give_donor_stats_list', $customer ); ?> |
|
380 | + <?php do_action('give_donor_stats_list', $customer); ?> |
|
381 | 381 | </ul> |
382 | 382 | </div> |
383 | 383 | |
384 | - <?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?> |
|
384 | + <?php do_action('give_donor_before_tables_wrapper', $customer); ?> |
|
385 | 385 | |
386 | 386 | <div id="customer-tables-wrapper" class="customer-section"> |
387 | 387 | |
388 | - <?php do_action( 'give_donor_before_tables', $customer ); ?> |
|
388 | + <?php do_action('give_donor_before_tables', $customer); ?> |
|
389 | 389 | |
390 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
390 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
391 | 391 | <?php |
392 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
393 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
394 | - $payments = array_slice( $payments, 0, 10 ); |
|
392 | + $payment_ids = explode(',', $customer->payment_ids); |
|
393 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
394 | + $payments = array_slice($payments, 0, 10); |
|
395 | 395 | ?> |
396 | 396 | <table class="wp-list-table widefat striped payments"> |
397 | 397 | <thead> |
398 | 398 | <tr> |
399 | - <th><?php _e( 'ID', 'give' ); ?></th> |
|
400 | - <th><?php _e( 'Amount', 'give' ); ?></th> |
|
401 | - <th><?php _e( 'Date', 'give' ); ?></th> |
|
402 | - <th><?php _e( 'Status', 'give' ); ?></th> |
|
403 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
399 | + <th><?php _e('ID', 'give'); ?></th> |
|
400 | + <th><?php _e('Amount', 'give'); ?></th> |
|
401 | + <th><?php _e('Date', 'give'); ?></th> |
|
402 | + <th><?php _e('Status', 'give'); ?></th> |
|
403 | + <th><?php _e('Actions', 'give'); ?></th> |
|
404 | 404 | </tr> |
405 | 405 | </thead> |
406 | 406 | <tbody> |
407 | - <?php if ( ! empty( $payments ) ) : ?> |
|
408 | - <?php foreach ( $payments as $payment ) : ?> |
|
407 | + <?php if ( ! empty($payments)) : ?> |
|
408 | + <?php foreach ($payments as $payment) : ?> |
|
409 | 409 | <tr> |
410 | 410 | <td><?php echo $payment->ID; ?></td> |
411 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
412 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
413 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
411 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
412 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
413 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
414 | 414 | <td> |
415 | - <a title="<?php _e( 'View Details for Donation', 'give' ); |
|
416 | - echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>"> |
|
417 | - <?php _e( 'View Details', 'give' ); ?> |
|
415 | + <a title="<?php _e('View Details for Donation', 'give'); |
|
416 | + echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>"> |
|
417 | + <?php _e('View Details', 'give'); ?> |
|
418 | 418 | </a> |
419 | - <?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?> |
|
419 | + <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> |
|
420 | 420 | </td> |
421 | 421 | </tr> |
422 | 422 | <?php endforeach; ?> |
423 | 423 | <?php else: ?> |
424 | 424 | <tr> |
425 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
425 | + <td colspan="5"><?php _e('No Donations Found', 'give'); ?></td> |
|
426 | 426 | </tr> |
427 | 427 | <?php endif; ?> |
428 | 428 | </tbody> |
429 | 429 | </table> |
430 | 430 | |
431 | - <h3><?php _e( 'Completed Donations', 'give' ); ?></h3> |
|
431 | + <h3><?php _e('Completed Donations', 'give'); ?></h3> |
|
432 | 432 | <?php |
433 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
433 | + $donations = give_get_users_completed_donations($customer->email); |
|
434 | 434 | ?> |
435 | 435 | <table class="wp-list-table widefat striped downloads"> |
436 | 436 | <thead> |
437 | 437 | <tr> |
438 | 438 | <th><?php echo give_get_forms_label_singular(); ?></th> |
439 | - <th width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
439 | + <th width="120px"><?php _e('Actions', 'give'); ?></th> |
|
440 | 440 | </tr> |
441 | 441 | </thead> |
442 | 442 | <tbody> |
443 | - <?php if ( ! empty( $donations ) ) : ?> |
|
444 | - <?php foreach ( $donations as $donation ) : ?> |
|
443 | + <?php if ( ! empty($donations)) : ?> |
|
444 | + <?php foreach ($donations as $donation) : ?> |
|
445 | 445 | <tr> |
446 | 446 | <td><?php echo $donation->post_title; ?></td> |
447 | 447 | <td> |
448 | - <a title="<?php echo esc_attr( sprintf( __( 'View %s', 'give' ), $donation->post_title ) ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); ?>"> |
|
449 | - <?php printf( __( 'View %s', 'give' ), give_get_forms_label_singular() ); ?> |
|
448 | + <a title="<?php echo esc_attr(sprintf(__('View %s', 'give'), $donation->post_title)); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); ?>"> |
|
449 | + <?php printf(__('View %s', 'give'), give_get_forms_label_singular()); ?> |
|
450 | 450 | </a> |
451 | 451 | </td> |
452 | 452 | </tr> |
453 | 453 | <?php endforeach; ?> |
454 | 454 | <?php else: ?> |
455 | 455 | <tr> |
456 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
456 | + <td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <?php endif; ?> |
459 | 459 | </tbody> |
460 | 460 | </table> |
461 | 461 | |
462 | - <?php do_action( 'give_donor_after_tables', $customer ); ?> |
|
462 | + <?php do_action('give_donor_after_tables', $customer); ?> |
|
463 | 463 | |
464 | 464 | </div> |
465 | 465 | |
466 | - <?php do_action( 'give_donor_card_bottom', $customer ); ?> |
|
466 | + <?php do_action('give_donor_card_bottom', $customer); ?> |
|
467 | 467 | |
468 | 468 | <?php |
469 | 469 | } |
@@ -477,30 +477,30 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @return void |
479 | 479 | */ |
480 | -function give_customer_notes_view( $customer ) { |
|
480 | +function give_customer_notes_view($customer) { |
|
481 | 481 | |
482 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
483 | - $paged = absint( $paged ); |
|
482 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
483 | + $paged = absint($paged); |
|
484 | 484 | $note_count = $customer->get_notes_count(); |
485 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
486 | - $total_pages = ceil( $note_count / $per_page ); |
|
487 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
485 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
486 | + $total_pages = ceil($note_count / $per_page); |
|
487 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
488 | 488 | ?> |
489 | 489 | |
490 | 490 | <div id="customer-notes-wrapper"> |
491 | 491 | <div class="customer-notes-header"> |
492 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
492 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
493 | 493 | </div> |
494 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
494 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
495 | 495 | |
496 | - <?php if ( 1 == $paged ) : ?> |
|
496 | + <?php if (1 == $paged) : ?> |
|
497 | 497 | <div style="display: block; margin-bottom: 55px;"> |
498 | - <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 ); ?>"> |
|
498 | + <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); ?>"> |
|
499 | 499 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
500 | 500 | <br /> |
501 | 501 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
502 | 502 | <input type="hidden" name="give_action" value="add-customer-note" /> |
503 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
503 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
504 | 504 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
505 | 505 | </form> |
506 | 506 | </div> |
@@ -515,46 +515,46 @@ discard block |
||
515 | 515 | 'show_all' => true |
516 | 516 | ); |
517 | 517 | |
518 | - echo paginate_links( $pagination_args ); |
|
518 | + echo paginate_links($pagination_args); |
|
519 | 519 | ?> |
520 | 520 | |
521 | 521 | <div id="give-customer-notes" class="postbox"> |
522 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
523 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
522 | + <?php if (count($customer_notes) > 0) : ?> |
|
523 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
524 | 524 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
525 | 525 | <span class="note-content-wrap"> |
526 | - <?php echo stripslashes( $note ); ?> |
|
526 | + <?php echo stripslashes($note); ?> |
|
527 | 527 | </span> |
528 | 528 | </div> |
529 | 529 | <?php endforeach; ?> |
530 | 530 | <?php else: ?> |
531 | 531 | <div class="give-no-customer-notes"> |
532 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
532 | + <?php _e('No Donor Notes', 'give'); ?> |
|
533 | 533 | </div> |
534 | 534 | <?php endif; ?> |
535 | 535 | </div> |
536 | 536 | |
537 | - <?php echo paginate_links( $pagination_args ); ?> |
|
537 | + <?php echo paginate_links($pagination_args); ?> |
|
538 | 538 | |
539 | 539 | </div> |
540 | 540 | |
541 | 541 | <?php |
542 | 542 | } |
543 | 543 | |
544 | -function give_customers_delete_view( $customer ) { |
|
544 | +function give_customers_delete_view($customer) { |
|
545 | 545 | |
546 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
546 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
547 | 547 | |
548 | 548 | ?> |
549 | 549 | |
550 | - <?php do_action( 'give_customer_delete_top', $customer ); ?> |
|
550 | + <?php do_action('give_customer_delete_top', $customer); ?> |
|
551 | 551 | |
552 | 552 | <div class="info-wrapper customer-section"> |
553 | 553 | |
554 | - <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 ); ?>"> |
|
554 | + <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); ?>"> |
|
555 | 555 | |
556 | 556 | <div class="customer-notes-header"> |
557 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
557 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
558 | 558 | </div> |
559 | 559 | |
560 | 560 | |
@@ -562,27 +562,27 @@ discard block |
||
562 | 562 | |
563 | 563 | <span class="delete-customer-options"> |
564 | 564 | <p> |
565 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
566 | - <label for="give-customer-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
565 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
566 | + <label for="give-customer-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
567 | 567 | </p> |
568 | 568 | |
569 | 569 | <p> |
570 | - <?php echo Give()->html->checkbox( array( |
|
570 | + <?php echo Give()->html->checkbox(array( |
|
571 | 571 | 'name' => 'give-customer-delete-records', |
572 | - 'options' => array( 'disabled' => true ) |
|
573 | - ) ); ?> |
|
574 | - <label for="give-customer-delete-records"><?php _e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
572 | + 'options' => array('disabled' => true) |
|
573 | + )); ?> |
|
574 | + <label for="give-customer-delete-records"><?php _e('Delete all associated payments and records?', 'give'); ?></label> |
|
575 | 575 | </p> |
576 | 576 | |
577 | - <?php do_action( 'give_customer_delete_inputs', $customer ); ?> |
|
577 | + <?php do_action('give_customer_delete_inputs', $customer); ?> |
|
578 | 578 | </span> |
579 | 579 | |
580 | 580 | <span id="customer-edit-actions"> |
581 | 581 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
582 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
582 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
583 | 583 | <input type="hidden" name="give_action" value="delete-customer" /> |
584 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
585 | - <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 _e( 'Cancel', 'give' ); ?></a> |
|
584 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
585 | + <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 _e('Cancel', 'give'); ?></a> |
|
586 | 586 | </span> |
587 | 587 | |
588 | 588 | </div> |
@@ -592,5 +592,5 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | |
595 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
595 | + do_action('give_customer_delete_bottom', $customer); |
|
596 | 596 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Payment History Page |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | function give_payment_history_page() { |
25 | 25 | global $give_options; |
26 | 26 | |
27 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
27 | + $give_payment = get_post_type_object('give_payment'); |
|
28 | 28 | |
29 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
29 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
31 | 31 | } else { |
32 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
32 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
33 | 33 | $payments_table = new Give_Payment_History_Table(); |
34 | 34 | $payments_table->prepare_items(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap"> |
37 | 37 | <h2><?php echo $give_payment->labels->menu_name ?></h2> |
38 | - <?php do_action( 'give_payments_page_top' ); ?> |
|
39 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
38 | + <?php do_action('give_payments_page_top'); ?> |
|
39 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
40 | 40 | <input type="hidden" name="post_type" value="give_forms" /> |
41 | 41 | <input type="hidden" name="page" value="give-payment-history" /> |
42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | <?php $payments_table->display() ?> |
48 | 48 | </form> |
49 | - <?php do_action( 'give_payments_page_bottom' ); ?> |
|
49 | + <?php do_action('give_payments_page_bottom'); ?> |
|
50 | 50 | </div> |
51 | 51 | <?php |
52 | 52 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | * @param $title |
62 | 62 | * @return string |
63 | 63 | */ |
64 | -function give_view_order_details_title( $admin_title, $title ) { |
|
64 | +function give_view_order_details_title($admin_title, $title) { |
|
65 | 65 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
66 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) |
|
67 | 67 | return $admin_title; |
68 | 68 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
69 | + if ( ! isset($_GET['give-action'])) |
|
70 | 70 | return $admin_title; |
71 | 71 | |
72 | - switch( $_GET['give-action'] ) : |
|
72 | + switch ($_GET['give-action']) : |
|
73 | 73 | |
74 | 74 | case 'view-order-details' : |
75 | - $title = __( 'View Donation Details', 'give' ) . ' - ' . $admin_title; |
|
75 | + $title = __('View Donation Details', 'give').' - '.$admin_title; |
|
76 | 76 | break; |
77 | 77 | case 'edit-payment' : |
78 | - $title = __( 'Edit Payment', 'give' ) . ' - ' . $admin_title; |
|
78 | + $title = __('Edit Payment', 'give').' - '.$admin_title; |
|
79 | 79 | break; |
80 | 80 | default: |
81 | 81 | $title = $admin_title; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | return $title; |
86 | 86 | } |
87 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
87 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | * @param $context |
97 | 97 | * @return string |
98 | 98 | */ |
99 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
99 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
100 | 100 | |
101 | - $post = get_post( $post_id ); |
|
102 | - if( ! $post ) |
|
101 | + $post = get_post($post_id); |
|
102 | + if ( ! $post) |
|
103 | 103 | return $url; |
104 | 104 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
105 | + if ('give_payment' != $post->post_type) |
|
106 | 106 | return $url; |
107 | 107 | |
108 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
108 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
109 | 109 | |
110 | 110 | return $url; |
111 | 111 | } |
112 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
112 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Payment History Page |
@@ -63,11 +65,13 @@ discard block |
||
63 | 65 | */ |
64 | 66 | function give_view_order_details_title( $admin_title, $title ) { |
65 | 67 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
67 | - return $admin_title; |
|
68 | + if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
69 | + return $admin_title; |
|
70 | + } |
|
68 | 71 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
70 | - return $admin_title; |
|
72 | + if( ! isset( $_GET['give-action'] ) ) { |
|
73 | + return $admin_title; |
|
74 | + } |
|
71 | 75 | |
72 | 76 | switch( $_GET['give-action'] ) : |
73 | 77 | |
@@ -99,11 +103,13 @@ discard block |
||
99 | 103 | function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
100 | 104 | |
101 | 105 | $post = get_post( $post_id ); |
102 | - if( ! $post ) |
|
103 | - return $url; |
|
106 | + if( ! $post ) { |
|
107 | + return $url; |
|
108 | + } |
|
104 | 109 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
106 | - return $url; |
|
110 | + if( 'give_payment' != $post->post_type ) { |
|
111 | + return $url; |
|
112 | + } |
|
107 | 113 | |
108 | 114 | $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
109 | 115 |
@@ -440,8 +440,10 @@ |
||
440 | 440 | echo give_get_payment_note_html( $note, $payment_id ); |
441 | 441 | |
442 | 442 | endforeach; |
443 | - else : |
|
443 | + else { |
|
444 | + : |
|
444 | 445 | $no_notes_display = ''; |
446 | + } |
|
445 | 447 | endif; |
446 | 448 | echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
447 | 449 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if purchase ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $customer_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $gateway = $payment->gateway; |
46 | 46 | $currency_code = $payment->currency; |
@@ -49,72 +49,72 @@ discard block |
||
49 | 49 | $payment_mode = $payment->mode; |
50 | 50 | ?> |
51 | 51 | <div class="wrap give-wrap"> |
52 | - <h1 id="transaction-details-heading"><?php printf( __( 'Payment %s', 'give' ), $number ); ?><?php if ( $payment_mode == 'test' ) { |
|
53 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . __( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . __( 'Test Payment', 'give' ) . '</span>'; |
|
52 | + <h1 id="transaction-details-heading"><?php printf(__('Payment %s', 'give'), $number); ?><?php if ($payment_mode == 'test') { |
|
53 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.__('Test Payment', 'give').'</span>'; |
|
54 | 54 | } ?></h1> |
55 | 55 | |
56 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
56 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
57 | 57 | <form id="give-edit-order-form" method="post"> |
58 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
58 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
59 | 59 | <div id="poststuff"> |
60 | 60 | <div id="give-dashboard-widgets-wrap"> |
61 | 61 | <div id="post-body" class="metabox-holder columns-2"> |
62 | 62 | <div id="postbox-container-1" class="postbox-container"> |
63 | 63 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
64 | 64 | |
65 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
65 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
66 | 66 | |
67 | 67 | |
68 | 68 | <div id="give-order-update" class="postbox give-order-data"> |
69 | 69 | |
70 | 70 | <h3 class="hndle"> |
71 | - <span><?php _e( 'Update Payment', 'give' ); ?></span> |
|
71 | + <span><?php _e('Update Payment', 'give'); ?></span> |
|
72 | 72 | </h3> |
73 | 73 | |
74 | 74 | <div class="inside"> |
75 | 75 | <div class="give-admin-box"> |
76 | 76 | |
77 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
77 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
78 | 78 | |
79 | 79 | <div class="give-admin-box-inside"> |
80 | 80 | <p> |
81 | - <span class="label"><?php _e( 'Status:', 'give' ); ?></span> |
|
81 | + <span class="label"><?php _e('Status:', 'give'); ?></span> |
|
82 | 82 | <select name="give-payment-status" class="medium-text"> |
83 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
84 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
83 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
84 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
85 | 85 | <?php endforeach; ?> |
86 | 86 | </select> |
87 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
87 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | |
91 | 91 | <div class="give-admin-box-inside"> |
92 | 92 | <p> |
93 | - <span class="label"><?php _e( 'Date:', 'give' ); ?></span> |
|
94 | - <input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
93 | + <span class="label"><?php _e('Date:', 'give'); ?></span> |
|
94 | + <input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
95 | 95 | </p> |
96 | 96 | </div> |
97 | 97 | |
98 | 98 | <div class="give-admin-box-inside"> |
99 | 99 | <p> |
100 | - <span class="label"><?php _e( 'Time:', 'give' ); ?></span> |
|
101 | - <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
102 | - <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
100 | + <span class="label"><?php _e('Time:', 'give'); ?></span> |
|
101 | + <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
102 | + <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
103 | 103 | </p> |
104 | 104 | </div> |
105 | 105 | |
106 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
106 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
107 | 107 | |
108 | 108 | <?php |
109 | 109 | //@TODO: Fees |
110 | - $fees = give_get_payment_fees( $payment_id ); |
|
111 | - if ( ! empty( $fees ) ) : ?> |
|
110 | + $fees = give_get_payment_fees($payment_id); |
|
111 | + if ( ! empty($fees)) : ?> |
|
112 | 112 | <div class="give-order-fees give-admin-box-inside"> |
113 | - <p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p> |
|
113 | + <p class="strong"><?php _e('Fees', 'give'); ?>:</p> |
|
114 | 114 | <ul class="give-payment-fees"> |
115 | - <?php foreach ( $fees as $fee ) : ?> |
|
115 | + <?php foreach ($fees as $fee) : ?> |
|
116 | 116 | <li> |
117 | - <span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
117 | + <span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
118 | 118 | </li> |
119 | 119 | <?php endforeach; ?> |
120 | 120 | </ul> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | |
125 | 125 | <div class="give-order-payment give-admin-box-inside"> |
126 | 126 | <p> |
127 | - <span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span> |
|
128 | - <?php echo give_currency_symbol( $payment->currency ); ?> <input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_amount( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
127 | + <span class="label"><?php _e('Total Donation', 'give'); ?>:</span> |
|
128 | + <?php echo give_currency_symbol($payment->currency); ?> <input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_amount(give_get_payment_amount($payment_id))); ?>"/> |
|
129 | 129 | </p> |
130 | 130 | </div> |
131 | 131 | |
132 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
132 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
133 | 133 | |
134 | 134 | </div> |
135 | 135 | <!-- /.give-admin-box --> |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | <!-- /.inside --> |
139 | 139 | |
140 | 140 | <div class="give-order-update-box give-admin-box"> |
141 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
141 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
142 | 142 | <div id="major-publishing-actions"> |
143 | 143 | <div id="publishing-action"> |
144 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/> |
|
145 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
146 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
144 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/> |
|
145 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
146 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
147 | 147 | 'give-action' => 'email_links', |
148 | 148 | 'purchase_id' => $payment_id |
149 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a> |
|
149 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a> |
|
150 | 150 | <?php endif; ?> |
151 | 151 | </div> |
152 | 152 | <div class="clear"></div> |
153 | 153 | </div> |
154 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
154 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
155 | 155 | </div> |
156 | 156 | <!-- /.give-order-update-box --> |
157 | 157 | |
@@ -161,55 +161,55 @@ discard block |
||
161 | 161 | <div id="give-order-details" class="postbox give-order-data"> |
162 | 162 | |
163 | 163 | <h3 class="hndle"> |
164 | - <span><?php _e( 'Payment Meta', 'give' ); ?></span> |
|
164 | + <span><?php _e('Payment Meta', 'give'); ?></span> |
|
165 | 165 | </h3> |
166 | 166 | |
167 | 167 | <div class="inside"> |
168 | 168 | <div class="give-admin-box"> |
169 | 169 | |
170 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
170 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
171 | 171 | |
172 | 172 | <?php |
173 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
174 | - if ( $gateway ) : ?> |
|
173 | + $gateway = give_get_payment_gateway($payment_id); |
|
174 | + if ($gateway) : ?> |
|
175 | 175 | <div class="give-order-gateway give-admin-box-inside"> |
176 | 176 | <p> |
177 | - <span class="label"><?php _e( 'Gateway:', 'give' ); ?></span> |
|
178 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
177 | + <span class="label"><?php _e('Gateway:', 'give'); ?></span> |
|
178 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
179 | 179 | </p> |
180 | 180 | </div> |
181 | 181 | <?php endif; ?> |
182 | 182 | |
183 | 183 | <div class="give-order-payment-key give-admin-box-inside"> |
184 | 184 | <p> |
185 | - <span class="label"><?php _e( 'Key:', 'give' ); ?></span> |
|
186 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
185 | + <span class="label"><?php _e('Key:', 'give'); ?></span> |
|
186 | + <span><?php echo give_get_payment_key($payment_id); ?></span> |
|
187 | 187 | </p> |
188 | 188 | </div> |
189 | 189 | |
190 | 190 | <div class="give-order-ip give-admin-box-inside"> |
191 | 191 | <p> |
192 | - <span class="label"><?php _e( 'IP:', 'give' ); ?></span> |
|
193 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
192 | + <span class="label"><?php _e('IP:', 'give'); ?></span> |
|
193 | + <span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span> |
|
194 | 194 | </p> |
195 | 195 | </div> |
196 | 196 | |
197 | - <?php if ( $transaction_id ) : ?> |
|
197 | + <?php if ($transaction_id) : ?> |
|
198 | 198 | <div class="give-order-tx-id give-admin-box-inside"> |
199 | 199 | <p> |
200 | - <span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span> |
|
201 | - <span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span> |
|
200 | + <span class="label"><?php _e('Transaction ID:', 'give'); ?></span> |
|
201 | + <span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span> |
|
202 | 202 | </p> |
203 | 203 | </div> |
204 | 204 | <?php endif; ?> |
205 | 205 | |
206 | 206 | <div class="give-admin-box-inside"> |
207 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?> |
|
208 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> »</a> |
|
207 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?> |
|
208 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> »</a> |
|
209 | 209 | </p> |
210 | 210 | </div> |
211 | 211 | |
212 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
212 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
213 | 213 | |
214 | 214 | </div> |
215 | 215 | <!-- /.column-container --> |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | </div> |
221 | 221 | <!-- /#give-order-data --> |
222 | 222 | |
223 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
223 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
224 | 224 | |
225 | 225 | </div> |
226 | 226 | <!-- /#side-sortables --> |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | |
232 | 232 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
233 | 233 | |
234 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
234 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
235 | 235 | |
236 | 236 | <?php $column_count = 'columns-3'; ?> |
237 | 237 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
238 | 238 | <h3 class="hndle"> |
239 | - <span><?php _e( 'Donation Information', 'give' ); ?></span> |
|
239 | + <span><?php _e('Donation Information', 'give'); ?></span> |
|
240 | 240 | </h3> |
241 | 241 | |
242 | 242 | <div class="inside"> |
@@ -244,29 +244,29 @@ discard block |
||
244 | 244 | <table style="width:100%;text-align:left;"> |
245 | 245 | <thead> |
246 | 246 | <tr> |
247 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
248 | - <th><?php _e( 'Donation Form ID', 'give' ) ?></th> |
|
249 | - <th><?php _e( 'Donation Form Title', 'give' ) ?></th> |
|
250 | - <th><?php _e( 'Donation Level', 'give' ) ?></th> |
|
251 | - <th><?php _e( 'Donation Date', 'give' ) ?></th> |
|
252 | - <th><?php _e( 'Total Donation', 'give' ) ?></th> |
|
253 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
247 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
248 | + <th><?php _e('Donation Form ID', 'give') ?></th> |
|
249 | + <th><?php _e('Donation Form Title', 'give') ?></th> |
|
250 | + <th><?php _e('Donation Level', 'give') ?></th> |
|
251 | + <th><?php _e('Donation Date', 'give') ?></th> |
|
252 | + <th><?php _e('Total Donation', 'give') ?></th> |
|
253 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
254 | 254 | </tr> |
255 | 255 | </thead> |
256 | 256 | <tr> |
257 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
257 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
258 | 258 | <td> |
259 | 259 | <?php echo $payment_meta['form_id']; ?> |
260 | 260 | </td> |
261 | 261 | <td> |
262 | - <a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
262 | + <a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
263 | 263 | </td> |
264 | 264 | <td> |
265 | 265 | <?php |
266 | 266 | //Level ID |
267 | - $level_title = give_get_payment_form_title( $payment_meta, true ); |
|
268 | - if ( empty( $level_title ) ) { |
|
269 | - echo __( 'n/a', 'give' ); |
|
267 | + $level_title = give_get_payment_form_title($payment_meta, true); |
|
268 | + if (empty($level_title)) { |
|
269 | + echo __('n/a', 'give'); |
|
270 | 270 | } else { |
271 | 271 | echo $level_title; |
272 | 272 | } ?> |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | <td> |
275 | 275 | <?php |
276 | 276 | //Transaction Date |
277 | - $date_format = get_option( 'date_format' ); |
|
278 | - echo date_i18n( $date_format, strtotime( $payment_date ) ); |
|
277 | + $date_format = get_option('date_format'); |
|
278 | + echo date_i18n($date_format, strtotime($payment_date)); |
|
279 | 279 | ?> |
280 | 280 | </td> |
281 | 281 | <td> |
282 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
283 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
282 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
283 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
284 | 284 | |
285 | 285 | </tr> |
286 | 286 | </table> |
@@ -292,64 +292,64 @@ discard block |
||
292 | 292 | </div> |
293 | 293 | <!-- /#give-donation-overview --> |
294 | 294 | |
295 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
295 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
296 | 296 | |
297 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
297 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
298 | 298 | |
299 | 299 | |
300 | 300 | <div id="give-customer-details" class="postbox"> |
301 | 301 | <h3 class="hndle"> |
302 | - <span><?php _e( 'Donor Details', 'give' ); ?></span> |
|
302 | + <span><?php _e('Donor Details', 'give'); ?></span> |
|
303 | 303 | </h3> |
304 | 304 | |
305 | 305 | <div class="inside give-clearfix"> |
306 | 306 | |
307 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
307 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
308 | 308 | |
309 | 309 | <div class="column-container customer-info"> |
310 | 310 | <div class="column"> |
311 | - <?php echo Give()->html->donor_dropdown( array( |
|
311 | + <?php echo Give()->html->donor_dropdown(array( |
|
312 | 312 | 'selected' => $customer->id, |
313 | 313 | 'name' => 'customer-id' |
314 | - ) ); ?> |
|
314 | + )); ?> |
|
315 | 315 | </div> |
316 | 316 | <div class="column"> |
317 | 317 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
318 | 318 | </div> |
319 | 319 | <div class="column"> |
320 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
321 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
322 | - <a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a> |
|
320 | + <?php if ( ! empty($customer->id)) : ?> |
|
321 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
322 | + <a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a> |
|
323 | 323 | | |
324 | 324 | <?php endif; ?> |
325 | - <a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a> |
|
325 | + <a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a> |
|
326 | 326 | </div> |
327 | 327 | </div> |
328 | 328 | |
329 | 329 | <div class="column-container new-customer" style="display: none"> |
330 | 330 | <div class="column"> |
331 | - <strong><?php _e( 'Name:', 'give' ); ?></strong> |
|
331 | + <strong><?php _e('Name:', 'give'); ?></strong> |
|
332 | 332 | <input type="text" name="give-new-customer-name" value="" class="medium-text"/> |
333 | 333 | </div> |
334 | 334 | <div class="column"> |
335 | - <strong><?php _e( 'Email:', 'give' ); ?></strong> |
|
335 | + <strong><?php _e('Email:', 'give'); ?></strong> |
|
336 | 336 | <input type="email" name="give-new-customer-email" value="" class="medium-text"/> |
337 | 337 | </div> |
338 | 338 | <div class="column"> |
339 | 339 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
340 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
340 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
341 | 341 | </div> |
342 | 342 | <div class="column"> |
343 | 343 | <small> |
344 | - <em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
344 | + <em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
345 | 345 | </small> |
346 | 346 | </div> |
347 | 347 | </div> |
348 | 348 | |
349 | 349 | <?php |
350 | 350 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
351 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
352 | - do_action( 'give_payment_view_details', $payment_id ); |
|
351 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
352 | + do_action('give_payment_view_details', $payment_id); |
|
353 | 353 | ?> |
354 | 354 | |
355 | 355 | </div> |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | <div id="give-billing-details" class="postbox"> |
362 | 362 | <h3 class="hndle"> |
363 | - <span><?php _e( 'Billing Address', 'give' ); ?></span> |
|
363 | + <span><?php _e('Billing Address', 'give'); ?></span> |
|
364 | 364 | </h3> |
365 | 365 | |
366 | 366 | <div class="inside give-clearfix"> |
@@ -371,62 +371,62 @@ discard block |
||
371 | 371 | <div class="data column-container"> |
372 | 372 | <div class="column"> |
373 | 373 | <p> |
374 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br/> |
|
375 | - <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
374 | + <strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br/> |
|
375 | + <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
376 | 376 | </p> |
377 | 377 | |
378 | 378 | <p> |
379 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br/> |
|
380 | - <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
379 | + <strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br/> |
|
380 | + <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
381 | 381 | </p> |
382 | 382 | |
383 | 383 | </div> |
384 | 384 | <div class="column"> |
385 | 385 | <p> |
386 | - <strong class="order-data-address-line"><?php echo _x( 'City:', 'Address City', 'give' ); ?></strong><br/> |
|
387 | - <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
386 | + <strong class="order-data-address-line"><?php echo _x('City:', 'Address City', 'give'); ?></strong><br/> |
|
387 | + <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
388 | 388 | |
389 | 389 | </p> |
390 | 390 | |
391 | 391 | <p> |
392 | - <strong class="order-data-address-line"><?php echo _x( 'Zip / Postal Code:', 'Zip / Postal code of address', 'give' ); ?></strong><br/> |
|
393 | - <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
392 | + <strong class="order-data-address-line"><?php echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'give'); ?></strong><br/> |
|
393 | + <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
394 | 394 | |
395 | 395 | </p> |
396 | 396 | </div> |
397 | 397 | <div class="column"> |
398 | 398 | <p id="give-order-address-country-wrap"> |
399 | - <strong class="order-data-address-line"><?php echo _x( 'Country:', 'Address country', 'give' ); ?></strong><br/> |
|
399 | + <strong class="order-data-address-line"><?php echo _x('Country:', 'Address country', 'give'); ?></strong><br/> |
|
400 | 400 | <?php |
401 | - echo Give()->html->select( array( |
|
401 | + echo Give()->html->select(array( |
|
402 | 402 | 'options' => give_get_country_list(), |
403 | 403 | 'name' => 'give-payment-address[0][country]', |
404 | 404 | 'selected' => $address['country'], |
405 | 405 | 'show_option_all' => false, |
406 | 406 | 'show_option_none' => false, |
407 | 407 | 'chosen' => true, |
408 | - 'placeholder' => __( 'Select a country', 'give' ) |
|
409 | - ) ); |
|
408 | + 'placeholder' => __('Select a country', 'give') |
|
409 | + )); |
|
410 | 410 | ?> |
411 | 411 | </p> |
412 | 412 | |
413 | 413 | <p id="give-order-address-state-wrap"> |
414 | - <strong class="order-data-address-line"><?php echo _x( 'State / Province:', 'State / province of address', 'give' ); ?></strong><br/> |
|
414 | + <strong class="order-data-address-line"><?php echo _x('State / Province:', 'State / province of address', 'give'); ?></strong><br/> |
|
415 | 415 | <?php |
416 | - $states = give_get_states( $address['country'] ); |
|
417 | - if ( ! empty( $states ) ) { |
|
418 | - echo Give()->html->select( array( |
|
416 | + $states = give_get_states($address['country']); |
|
417 | + if ( ! empty($states)) { |
|
418 | + echo Give()->html->select(array( |
|
419 | 419 | 'options' => $states, |
420 | 420 | 'name' => 'give-payment-address[0][state]', |
421 | 421 | 'selected' => $address['state'], |
422 | 422 | 'show_option_all' => false, |
423 | 423 | 'show_option_none' => false, |
424 | 424 | 'chosen' => true, |
425 | - 'placeholder' => __( 'Select a state', 'give' ) |
|
426 | - ) ); |
|
425 | + 'placeholder' => __('Select a state', 'give') |
|
426 | + )); |
|
427 | 427 | } else { |
428 | 428 | ?> |
429 | - <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
429 | + <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
430 | 430 | <?php |
431 | 431 | } ?> |
432 | 432 | </p> |
@@ -436,39 +436,39 @@ discard block |
||
436 | 436 | </div> |
437 | 437 | <!-- /#give-order-address --> |
438 | 438 | |
439 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
439 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
440 | 440 | |
441 | 441 | </div> |
442 | 442 | <!-- /.inside --> |
443 | 443 | </div> |
444 | 444 | <!-- /#give-billing-details --> |
445 | 445 | |
446 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
446 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
447 | 447 | |
448 | 448 | <div id="give-payment-notes" class="postbox"> |
449 | - <h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3> |
|
449 | + <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3> |
|
450 | 450 | |
451 | 451 | <div class="inside"> |
452 | 452 | <div id="give-payment-notes-inner"> |
453 | 453 | <?php |
454 | - $notes = give_get_payment_notes( $payment_id ); |
|
455 | - if ( ! empty( $notes ) ) : |
|
454 | + $notes = give_get_payment_notes($payment_id); |
|
455 | + if ( ! empty($notes)) : |
|
456 | 456 | $no_notes_display = ' style="display:none;"'; |
457 | - foreach ( $notes as $note ) : |
|
457 | + foreach ($notes as $note) : |
|
458 | 458 | |
459 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
459 | + echo give_get_payment_note_html($note, $payment_id); |
|
460 | 460 | |
461 | 461 | endforeach; |
462 | 462 | else : |
463 | 463 | $no_notes_display = ''; |
464 | 464 | endif; |
465 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
|
465 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>'; |
|
466 | 466 | ?> |
467 | 467 | </div> |
468 | 468 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
469 | 469 | |
470 | 470 | <p class="give-clearfix"> |
471 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
471 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
472 | 472 | </p> |
473 | 473 | |
474 | 474 | <div class="clear"></div> |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | </div> |
478 | 478 | <!-- /#give-payment-notes --> |
479 | 479 | |
480 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
480 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
481 | 481 | </div> |
482 | 482 | <!-- /#normal-sortables --> |
483 | 483 | </div> |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | <!-- #give-dashboard-widgets-wrap --> |
489 | 489 | </div> |
490 | 490 | <!-- /#post-stuff --> |
491 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
492 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
493 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
491 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
492 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
493 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
494 | 494 | <input type="hidden" name="give_action" value="update_payment_details"/> |
495 | 495 | </form> |
496 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
496 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
497 | 497 | </div><!-- /.wrap --> |
@@ -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 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records |
|
68 | 68 | 'ajax' => false // Does this table support ajax? |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return false |
85 | 85 | */ |
86 | - public function search_box( $text, $input_id ) { |
|
86 | + public function search_box($text, $input_id) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function give_search_box( $text, $input_id ) { |
|
102 | - $input_id = $input_id . '-search-input'; |
|
101 | + public function give_search_box($text, $input_id) { |
|
102 | + $input_id = $input_id.'-search-input'; |
|
103 | 103 | |
104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
106 | 106 | } |
107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
107 | + if ( ! empty($_REQUEST['order'])) { |
|
108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
109 | 109 | } |
110 | 110 | ?> |
111 | 111 | <p class="search-box donor-search"> |
112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
115 | 115 | </p> |
116 | 116 | <?php |
117 | 117 | } |
@@ -124,29 +124,29 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $which |
126 | 126 | */ |
127 | - protected function display_tablenav( $which ) { |
|
127 | + protected function display_tablenav($which) { |
|
128 | 128 | |
129 | - if ( 'top' == $which ) { |
|
130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
129 | + if ('top' == $which) { |
|
130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
131 | 131 | } |
132 | 132 | ?> |
133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
134 | 134 | |
135 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donors Report', 'give' ); ?></span></h3> |
|
135 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Donors Report', 'give'); ?></span></h3> |
|
136 | 136 | |
137 | 137 | <div class="alignright tablenav-right"> |
138 | 138 | <div class="actions bulkactions"> |
139 | 139 | <?php |
140 | - if ( 'top' == $which ) { |
|
141 | - $this->give_search_box( __( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
140 | + if ('top' == $which) { |
|
141 | + $this->give_search_box(__('Search Donors', 'give'), 'give-donors-report-search'); |
|
142 | 142 | } |
143 | 143 | |
144 | - $this->bulk_actions( $which ); ?> |
|
144 | + $this->bulk_actions($which); ?> |
|
145 | 145 | |
146 | 146 | </div> |
147 | 147 | <?php |
148 | - $this->extra_tablenav( $which ); |
|
149 | - $this->pagination( $which ); |
|
148 | + $this->extra_tablenav($which); |
|
149 | + $this->pagination($which); |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return string Column Name |
170 | 170 | */ |
171 | - public function column_default( $item, $column_name ) { |
|
172 | - switch ( $column_name ) { |
|
171 | + public function column_default($item, $column_name) { |
|
172 | + switch ($column_name) { |
|
173 | 173 | |
174 | 174 | case 'num_purchases' : |
175 | - $value = '<a href="' . |
|
176 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
177 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
175 | + $value = '<a href="'. |
|
176 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
177 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'amount_spent' : |
181 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
181 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
182 | 182 | break; |
183 | 183 | |
184 | 184 | default: |
185 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
185 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
186 | 186 | break; |
187 | 187 | } |
188 | 188 | |
189 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
189 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function get_columns() { |
200 | 200 | $columns = array( |
201 | - 'name' => __( 'Name', 'give' ), |
|
202 | - 'id' => __( 'ID', 'give' ), |
|
203 | - 'email' => __( 'Email', 'give' ), |
|
204 | - 'num_purchases' => __( 'Purchases', 'give' ), |
|
205 | - 'amount_spent' => __( 'Total Spent', 'give' ) |
|
201 | + 'name' => __('Name', 'give'), |
|
202 | + 'id' => __('ID', 'give'), |
|
203 | + 'email' => __('Email', 'give'), |
|
204 | + 'num_purchases' => __('Purchases', 'give'), |
|
205 | + 'amount_spent' => __('Total Spent', 'give') |
|
206 | 206 | ); |
207 | 207 | |
208 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
208 | + return apply_filters('give_report_donor_columns', $columns); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function get_sortable_columns() { |
220 | 220 | return array( |
221 | - 'id' => array( 'id', true ), |
|
222 | - 'name' => array( 'name', true ), |
|
223 | - 'num_purchases' => array( 'purchase_count', false ), |
|
224 | - 'amount_spent' => array( 'purchase_value', false ), |
|
221 | + 'id' => array('id', true), |
|
222 | + 'name' => array('name', true), |
|
223 | + 'num_purchases' => array('purchase_count', false), |
|
224 | + 'amount_spent' => array('purchase_value', false), |
|
225 | 225 | ); |
226 | 226 | } |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - public function bulk_actions( $which = '' ) { |
|
235 | + public function bulk_actions($which = '') { |
|
236 | 236 | // These aren't really bulk actions but this outputs the markup in the right place |
237 | 237 | give_report_views(); |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return int Current page number |
246 | 246 | */ |
247 | 247 | public function get_paged() { |
248 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
248 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return mixed string If search is present, false otherwise |
257 | 257 | */ |
258 | 258 | public function get_search() { |
259 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
259 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | |
274 | 274 | $data = array(); |
275 | 275 | $paged = $this->get_paged(); |
276 | - $offset = $this->per_page * ( $paged - 1 ); |
|
276 | + $offset = $this->per_page * ($paged - 1); |
|
277 | 277 | $search = $this->get_search(); |
278 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
279 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
278 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
279 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
280 | 280 | |
281 | 281 | $args = array( |
282 | 282 | 'number' => $this->per_page, |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | 'orderby' => $orderby |
286 | 286 | ); |
287 | 287 | |
288 | - if ( is_email( $search ) ) { |
|
288 | + if (is_email($search)) { |
|
289 | 289 | $args['email'] = $search; |
290 | - } elseif ( is_numeric( $search ) ) { |
|
290 | + } elseif (is_numeric($search)) { |
|
291 | 291 | $args['id'] = $search; |
292 | 292 | } |
293 | 293 | |
294 | - $donors = Give()->customers->get_customers( $args ); |
|
294 | + $donors = Give()->customers->get_customers($args); |
|
295 | 295 | |
296 | - if ( $donors ) { |
|
296 | + if ($donors) { |
|
297 | 297 | |
298 | - $this->count = count( $donors ); |
|
298 | + $this->count = count($donors); |
|
299 | 299 | |
300 | - foreach ( $donors as $donor ) { |
|
300 | + foreach ($donors as $donor) { |
|
301 | 301 | |
302 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
302 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
303 | 303 | |
304 | 304 | $data[] = array( |
305 | 305 | 'id' => $donor->id, |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | $hidden = array(); // No hidden columns |
333 | 333 | $sortable = $this->get_sortable_columns(); |
334 | 334 | |
335 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
335 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
336 | 336 | |
337 | 337 | $this->items = $this->reports_data(); |
338 | 338 | |
339 | 339 | $this->total = give_count_total_customers(); |
340 | 340 | |
341 | - $this->set_pagination_args( array( |
|
341 | + $this->set_pagination_args(array( |
|
342 | 342 | 'total_items' => $this->total, |
343 | 343 | 'per_page' => $this->per_page, |
344 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
345 | - ) ); |
|
344 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
345 | + )); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |
@@ -115,8 +115,8 @@ |
||
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | 117 | $value = '<a href="' . |
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
118 | + admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | + ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
@@ -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,9 +61,9 @@ discard block |
||
61 | 61 | public function csv_cols() { |
62 | 62 | |
63 | 63 | $cols = array( |
64 | - 'date' => __( 'Date', 'give' ), |
|
65 | - 'donations' => __( 'Donations', 'give' ), |
|
66 | - 'earnings' => __( 'Income', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')' |
|
64 | + 'date' => __('Date', 'give'), |
|
65 | + 'donations' => __('Donations', 'give'), |
|
66 | + 'earnings' => __('Income', 'give').' ('.html_entity_decode(give_currency_filter('')).')' |
|
67 | 67 | ); |
68 | 68 | |
69 | 69 | return $cols; |
@@ -78,28 +78,28 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function get_data() { |
80 | 80 | |
81 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
82 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
83 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
84 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
81 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
82 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
83 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
84 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
85 | 85 | |
86 | 86 | $data = array(); |
87 | 87 | $year = $start_year; |
88 | 88 | $stats = new Give_Payment_Stats; |
89 | 89 | |
90 | - while ( $year <= $end_year ) { |
|
90 | + while ($year <= $end_year) { |
|
91 | 91 | |
92 | - if ( $year == $start_year && $year == $end_year ) { |
|
92 | + if ($year == $start_year && $year == $end_year) { |
|
93 | 93 | |
94 | 94 | $m1 = $start_month; |
95 | 95 | $m2 = $end_month; |
96 | 96 | |
97 | - } elseif ( $year == $start_year ) { |
|
97 | + } elseif ($year == $start_year) { |
|
98 | 98 | |
99 | 99 | $m1 = $start_month; |
100 | 100 | $m2 = 12; |
101 | 101 | |
102 | - } elseif ( $year == $end_year ) { |
|
102 | + } elseif ($year == $end_year) { |
|
103 | 103 | |
104 | 104 | $m1 = 1; |
105 | 105 | $m2 = $end_month; |
@@ -111,28 +111,28 @@ discard block |
||
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | - while ( $m1 <= $m2 ) { |
|
114 | + while ($m1 <= $m2) { |
|
115 | 115 | |
116 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
117 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
116 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
117 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
118 | 118 | |
119 | 119 | $data[] = array( |
120 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
121 | - 'donations' => $stats->get_sales( 0, $date1, $date2, array( 'publish', 'revoked' ) ), |
|
122 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ), |
|
120 | + 'date' => date_i18n('F Y', $date1), |
|
121 | + 'donations' => $stats->get_sales(0, $date1, $date2, array('publish', 'revoked')), |
|
122 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2)), |
|
123 | 123 | ); |
124 | 124 | |
125 | - $m1 ++; |
|
125 | + $m1++; |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | |
130 | - $year ++; |
|
130 | + $year++; |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
135 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
134 | + $data = apply_filters('give_export_get_data', $data); |
|
135 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
136 | 136 | |
137 | 137 | return $data; |
138 | 138 | } |
@@ -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 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public function headers() { |
51 | - ignore_user_abort( true ); |
|
51 | + ignore_user_abort(true); |
|
52 | 52 | |
53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
54 | - set_time_limit( 0 ); |
|
53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
54 | + set_time_limit(0); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | nocache_headers(); |
58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
60 | - header( "Expires: 0" ); |
|
58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
60 | + header("Expires: 0"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function csv_cols() { |
71 | 71 | $cols = array( |
72 | - 'id' => __( 'ID', 'give' ), |
|
73 | - 'date' => __( 'Date', 'give' ) |
|
72 | + 'id' => __('ID', 'give'), |
|
73 | + 'date' => __('Date', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function get_csv_cols() { |
87 | 87 | $cols = $this->csv_cols(); |
88 | 88 | |
89 | - return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols ); |
|
89 | + return apply_filters('give_export_csv_cols_'.$this->export_type, $cols); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | public function csv_cols_out() { |
101 | 101 | $cols = $this->get_csv_cols(); |
102 | 102 | $i = 1; |
103 | - foreach ( $cols as $col_id => $column ) { |
|
104 | - echo '"' . addslashes( $column ) . '"'; |
|
105 | - echo $i == count( $cols ) ? '' : ','; |
|
106 | - $i ++; |
|
103 | + foreach ($cols as $col_id => $column) { |
|
104 | + echo '"'.addslashes($column).'"'; |
|
105 | + echo $i == count($cols) ? '' : ','; |
|
106 | + $i++; |
|
107 | 107 | } |
108 | 108 | echo "\r\n"; |
109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $data = array( |
121 | 121 | 0 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ), |
125 | 125 | 1 => array( |
126 | 126 | 'id' => '', |
127 | - 'data' => date( 'F j, Y' ) |
|
127 | + 'data' => date('F j, Y') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $cols = $this->get_csv_cols(); |
148 | 148 | |
149 | 149 | // Output each row |
150 | - foreach ( $data as $row ) { |
|
150 | + foreach ($data as $row) { |
|
151 | 151 | $i = 1; |
152 | - foreach ( $row as $col_id => $column ) { |
|
152 | + foreach ($row as $col_id => $column) { |
|
153 | 153 | // Make sure the column is valid |
154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
155 | - echo '"' . addslashes( $column ) . '"'; |
|
156 | - echo $i == count( $cols ) ? '' : ','; |
|
157 | - $i ++; |
|
154 | + if (array_key_exists($col_id, $cols)) { |
|
155 | + echo '"'.addslashes($column).'"'; |
|
156 | + echo $i == count($cols) ? '' : ','; |
|
157 | + $i++; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function export() { |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Set headers |
@@ -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 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.0 |
80 | 80 | */ |
81 | - public function __construct( $_data ) { |
|
81 | + public function __construct($_data) { |
|
82 | 82 | |
83 | 83 | $this->data = $_data; |
84 | 84 | |
85 | 85 | // Generate unique ID |
86 | - $this->id = md5( rand() ); |
|
86 | + $this->id = md5(rand()); |
|
87 | 87 | |
88 | 88 | // Setup default options; |
89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
89 | + $this->options = apply_filters('give_graph_args', array( |
|
90 | 90 | 'y_mode' => null, |
91 | 91 | 'x_mode' => null, |
92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'bars' => true, |
104 | 104 | 'lines' => false, |
105 | 105 | 'points' => true |
106 | - ) ); |
|
106 | + )); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | - public function set( $key, $value ) { |
|
119 | - $this->options[ $key ] = $value; |
|
118 | + public function set($key, $value) { |
|
119 | + $this->options[$key] = $value; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | - public function get( $key ) { |
|
130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
129 | + public function get($key) { |
|
130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @since 1.0 |
137 | 137 | */ |
138 | 138 | public function get_data() { |
139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function load_scripts() { |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
153 | 153 | |
154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
155 | + wp_enqueue_script('jquery-flot-time'); |
|
156 | 156 | |
157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
158 | + wp_enqueue_script('jquery-flot-resize'); |
|
159 | 159 | |
160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
161 | - wp_enqueue_script( 'jquery-flot' ); |
|
160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
161 | + wp_enqueue_script('jquery-flot'); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | [ |
186 | 186 | <?php |
187 | 187 | $order = 0; |
188 | - foreach( $this->get_data() as $label => $data ) : |
|
188 | + foreach ($this->get_data() as $label => $data) : |
|
189 | 189 | ?> |
190 | 190 | { |
191 | - label : "<?php echo esc_attr( $label ); ?>", |
|
192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
191 | + label : "<?php echo esc_attr($label); ?>", |
|
192 | + id : "<?php echo sanitize_key($label); ?>", |
|
193 | 193 | // data format is: [ point on x, value on y ] |
194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
195 | 195 | points: { |
196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | fill : true, |
207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
208 | 208 | }, |
209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | grid: { |
221 | 221 | show : true, |
222 | 222 | aboveData : false, |
223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
223 | + color : "<?php echo $this->options['color']; ?>", |
|
224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
227 | 227 | clickable : false, |
228 | 228 | hoverable : true |
229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
239 | 239 | <?php endif; ?> |
240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | min : 0, |
244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
248 | 248 | <?php endif; ?> |
249 | 249 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | 305 | public function display() { |
306 | - do_action( 'give_before_graph', $this ); |
|
306 | + do_action('give_before_graph', $this); |
|
307 | 307 | echo $this->build_graph(); |
308 | - do_action( 'give_after_graph', $this ); |
|
308 | + do_action('give_after_graph', $this); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | } |
@@ -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,75 +25,75 @@ 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 | - $daterange = date_i18n( get_option( 'date_format' ), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ) . ' ' . utf8_decode( __( 'to', 'give' ) ) . ' ' . date_i18n( get_option( 'date_format' ) ); |
|
41 | + $daterange = date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))).' '.utf8_decode(__('to', 'give')).' '.date_i18n(get_option('date_format')); |
|
42 | 42 | |
43 | 43 | $pdf = new give_pdf(); |
44 | - $pdf->AddPage( 'L', 'A4' ); |
|
44 | + $pdf->AddPage('L', 'A4'); |
|
45 | 45 | |
46 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
47 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
48 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
46 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
47 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
48 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
49 | 49 | |
50 | - $pdf->Image( GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png', 247, 8 ); |
|
50 | + $pdf->Image(GIVE_PLUGIN_URL.'assets/images/give-logo-small.png', 247, 8); |
|
51 | 51 | |
52 | - $pdf->SetMargins( 8, 8, 8 ); |
|
53 | - $pdf->SetX( 8 ); |
|
52 | + $pdf->SetMargins(8, 8, 8); |
|
53 | + $pdf->SetX(8); |
|
54 | 54 | |
55 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
56 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
57 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
55 | + $pdf->SetFont('Helvetica', '', 16); |
|
56 | + $pdf->SetTextColor(50, 50, 50); |
|
57 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
58 | 58 | |
59 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
59 | + $pdf->SetFont('Helvetica', '', 13); |
|
60 | 60 | $pdf->Ln(); |
61 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
62 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
61 | + $pdf->SetTextColor(150, 150, 150); |
|
62 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
63 | 63 | $pdf->Ln(); |
64 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
65 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
66 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
67 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
64 | + $pdf->SetTextColor(50, 50, 50); |
|
65 | + $pdf->SetFont('Helvetica', '', 14); |
|
66 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
67 | + $pdf->SetFont('Helvetica', '', 12); |
|
68 | 68 | |
69 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
70 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
71 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
72 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
73 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
74 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
75 | - $pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
69 | + $pdf->SetFillColor(238, 238, 238); |
|
70 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
71 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
72 | + $pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
73 | + $pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
74 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
75 | + $pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
76 | 76 | |
77 | - $year = date( 'Y' ); |
|
78 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
77 | + $year = date('Y'); |
|
78 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
79 | 79 | |
80 | - if ( $give_forms ): |
|
81 | - $pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) ); |
|
80 | + if ($give_forms): |
|
81 | + $pdf->SetWidths(array(70, 30, 50, 50, 45, 35)); |
|
82 | 82 | |
83 | - foreach ( $give_forms as $form ): |
|
84 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
83 | + foreach ($give_forms as $form): |
|
84 | + $pdf->SetFillColor(255, 255, 255); |
|
85 | 85 | |
86 | 86 | $title = $form->post_title; |
87 | 87 | |
88 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
88 | + if (give_has_variable_prices($form->ID)) { |
|
89 | 89 | |
90 | - $prices = give_get_variable_prices( $form->ID ); |
|
90 | + $prices = give_get_variable_prices($form->ID); |
|
91 | 91 | |
92 | 92 | $first = $prices[0]['_give_amount']; |
93 | - $last = array_pop( $prices ); |
|
93 | + $last = array_pop($prices); |
|
94 | 94 | $last = $last['_give_amount']; |
95 | 95 | |
96 | - if ( $first < $last ) { |
|
96 | + if ($first < $last) { |
|
97 | 97 | $min = $first; |
98 | 98 | $max = $last; |
99 | 99 | } else { |
@@ -101,51 +101,51 @@ discard block |
||
101 | 101 | $max = $first; |
102 | 102 | } |
103 | 103 | |
104 | - $price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) ); |
|
104 | + $price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max))); |
|
105 | 105 | } else { |
106 | - $price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) ); |
|
106 | + $price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID))); |
|
107 | 107 | } |
108 | 108 | |
109 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
110 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
109 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
110 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
111 | 111 | |
112 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
113 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
112 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
113 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
114 | 114 | |
115 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
116 | - $link = get_permalink( $form->ID ); |
|
117 | - $earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) ); |
|
115 | + $sales = give_get_form_sales_stats($form->ID); |
|
116 | + $link = get_permalink($form->ID); |
|
117 | + $earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID))); |
|
118 | 118 | |
119 | - if ( function_exists( 'iconv' ) ) { |
|
119 | + if (function_exists('iconv')) { |
|
120 | 120 | // Ensure characters like euro; are properly converted. |
121 | - $price = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) ); |
|
122 | - $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
|
121 | + $price = iconv('UTF-8', 'windows-1252', utf8_encode($price)); |
|
122 | + $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings)); |
|
123 | 123 | } |
124 | 124 | |
125 | - $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
|
125 | + $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings)); |
|
126 | 126 | endforeach; |
127 | 127 | else: |
128 | - $pdf->SetWidths( array( 280 ) ); |
|
129 | - $title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) ); |
|
130 | - $pdf->Row( array( $title ) ); |
|
128 | + $pdf->SetWidths(array(280)); |
|
129 | + $title = utf8_decode(sprintf(__('No %s found.', 'give'), give_get_forms_label_plural())); |
|
130 | + $pdf->Row(array($title)); |
|
131 | 131 | endif; |
132 | 132 | |
133 | 133 | $pdf->Ln(); |
134 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
135 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
136 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
137 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
138 | - |
|
139 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
140 | - $image = str_replace( ' ', '%20', $image ); |
|
141 | - |
|
142 | - $pdf->SetX( 25 ); |
|
143 | - $pdf->Image( $image . '&file=.png' ); |
|
144 | - $pdf->Ln( 7 ); |
|
145 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
134 | + $pdf->SetTextColor(50, 50, 50); |
|
135 | + $pdf->SetFont('Helvetica', '', 14); |
|
136 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
137 | + $pdf->SetFont('Helvetica', '', 12); |
|
138 | + |
|
139 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
140 | + $image = str_replace(' ', '%20', $image); |
|
141 | + |
|
142 | + $pdf->SetX(25); |
|
143 | + $pdf->Image($image.'&file=.png'); |
|
144 | + $pdf->Ln(7); |
|
145 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
146 | 146 | } |
147 | 147 | |
148 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
148 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Draws Chart for PDF Report |
@@ -162,38 +162,38 @@ discard block |
||
162 | 162 | * @return string $chart->getUrl() URL for the Google Chart |
163 | 163 | */ |
164 | 164 | function give_draw_chart_image() { |
165 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
166 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
167 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
165 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
166 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
167 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
168 | 168 | |
169 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
169 | + $chart = new GoogleChart('lc', 900, 330); |
|
170 | 170 | |
171 | 171 | $i = 1; |
172 | 172 | $earnings = ""; |
173 | 173 | $sales = ""; |
174 | 174 | |
175 | - while ( $i <= 12 ) : |
|
176 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
177 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
178 | - $i ++; |
|
175 | + while ($i <= 12) : |
|
176 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
177 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
178 | + $i++; |
|
179 | 179 | endwhile; |
180 | 180 | |
181 | - $earnings_array = explode( ",", $earnings ); |
|
182 | - $sales_array = explode( ",", $sales ); |
|
181 | + $earnings_array = explode(",", $earnings); |
|
182 | + $sales_array = explode(",", $sales); |
|
183 | 183 | |
184 | 184 | $i = 0; |
185 | - while ( $i <= 11 ) { |
|
186 | - if ( empty( $sales_array[ $i ] ) ) { |
|
187 | - $sales_array[ $i ] = 0; |
|
185 | + while ($i <= 11) { |
|
186 | + if (empty($sales_array[$i])) { |
|
187 | + $sales_array[$i] = 0; |
|
188 | 188 | } |
189 | - $i ++; |
|
189 | + $i++; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $min_earnings = 0; |
193 | - $max_earnings = max( $earnings_array ); |
|
194 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
193 | + $max_earnings = max($earnings_array); |
|
194 | + $earnings_scale = round($max_earnings, - 1); |
|
195 | 195 | |
196 | - $data = new GoogleChartData( array( |
|
196 | + $data = new GoogleChartData(array( |
|
197 | 197 | $earnings_array[0], |
198 | 198 | $earnings_array[1], |
199 | 199 | $earnings_array[2], |
@@ -206,25 +206,25 @@ discard block |
||
206 | 206 | $earnings_array[9], |
207 | 207 | $earnings_array[10], |
208 | 208 | $earnings_array[11] |
209 | - ) ); |
|
209 | + )); |
|
210 | 210 | |
211 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
212 | - $data->setColor( '1b58a3' ); |
|
213 | - $chart->addData( $data ); |
|
211 | + $data->setLegend(__('Income', 'give')); |
|
212 | + $data->setColor('1b58a3'); |
|
213 | + $chart->addData($data); |
|
214 | 214 | |
215 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
216 | - $shape_marker->setColor( '000000' ); |
|
217 | - $shape_marker->setSize( 7 ); |
|
218 | - $shape_marker->setBorder( 2 ); |
|
219 | - $shape_marker->setData( $data ); |
|
220 | - $chart->addMarker( $shape_marker ); |
|
215 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
216 | + $shape_marker->setColor('000000'); |
|
217 | + $shape_marker->setSize(7); |
|
218 | + $shape_marker->setBorder(2); |
|
219 | + $shape_marker->setData($data); |
|
220 | + $chart->addMarker($shape_marker); |
|
221 | 221 | |
222 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
223 | - $value_marker->setColor( '000000' ); |
|
224 | - $value_marker->setData( $data ); |
|
225 | - $chart->addMarker( $value_marker ); |
|
222 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
223 | + $value_marker->setColor('000000'); |
|
224 | + $value_marker->setData($data); |
|
225 | + $chart->addMarker($value_marker); |
|
226 | 226 | |
227 | - $data = new GoogleChartData( array( |
|
227 | + $data = new GoogleChartData(array( |
|
228 | 228 | $sales_array[0], |
229 | 229 | $sales_array[1], |
230 | 230 | $sales_array[2], |
@@ -237,46 +237,46 @@ discard block |
||
237 | 237 | $sales_array[9], |
238 | 238 | $sales_array[10], |
239 | 239 | $sales_array[11] |
240 | - ) ); |
|
241 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
242 | - $data->setColor( 'ff6c1c' ); |
|
243 | - $chart->addData( $data ); |
|
244 | - |
|
245 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
246 | - |
|
247 | - $chart->setScale( 0, $max_earnings ); |
|
248 | - |
|
249 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
250 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
251 | - $chart->addAxis( $y_axis ); |
|
252 | - |
|
253 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
254 | - $x_axis->setTickMarks( 5 ); |
|
255 | - $x_axis->setLabels( array( |
|
256 | - __( 'Jan', 'give' ), |
|
257 | - __( 'Feb', 'give' ), |
|
258 | - __( 'Mar', 'give' ), |
|
259 | - __( 'Apr', 'give' ), |
|
260 | - __( 'May', 'give' ), |
|
261 | - __( 'June', 'give' ), |
|
262 | - __( 'July', 'give' ), |
|
263 | - __( 'Aug', 'give' ), |
|
264 | - __( 'Sept', 'give' ), |
|
265 | - __( 'Oct', 'give' ), |
|
266 | - __( 'Nov', 'give' ), |
|
267 | - __( 'Dec', 'give' ) |
|
268 | - ) ); |
|
269 | - $chart->addAxis( $x_axis ); |
|
270 | - |
|
271 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
272 | - $shape_marker->setSize( 6 ); |
|
273 | - $shape_marker->setBorder( 2 ); |
|
274 | - $shape_marker->setData( $data ); |
|
275 | - $chart->addMarker( $shape_marker ); |
|
276 | - |
|
277 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
278 | - $value_marker->setData( $data ); |
|
279 | - $chart->addMarker( $value_marker ); |
|
240 | + )); |
|
241 | + $data->setLegend(__('Donations', 'give')); |
|
242 | + $data->setColor('ff6c1c'); |
|
243 | + $chart->addData($data); |
|
244 | + |
|
245 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
246 | + |
|
247 | + $chart->setScale(0, $max_earnings); |
|
248 | + |
|
249 | + $y_axis = new GoogleChartAxis('y'); |
|
250 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
251 | + $chart->addAxis($y_axis); |
|
252 | + |
|
253 | + $x_axis = new GoogleChartAxis('x'); |
|
254 | + $x_axis->setTickMarks(5); |
|
255 | + $x_axis->setLabels(array( |
|
256 | + __('Jan', 'give'), |
|
257 | + __('Feb', 'give'), |
|
258 | + __('Mar', 'give'), |
|
259 | + __('Apr', 'give'), |
|
260 | + __('May', 'give'), |
|
261 | + __('June', 'give'), |
|
262 | + __('July', 'give'), |
|
263 | + __('Aug', 'give'), |
|
264 | + __('Sept', 'give'), |
|
265 | + __('Oct', 'give'), |
|
266 | + __('Nov', 'give'), |
|
267 | + __('Dec', 'give') |
|
268 | + )); |
|
269 | + $chart->addAxis($x_axis); |
|
270 | + |
|
271 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
272 | + $shape_marker->setSize(6); |
|
273 | + $shape_marker->setBorder(2); |
|
274 | + $shape_marker->setData($data); |
|
275 | + $chart->addMarker($shape_marker); |
|
276 | + |
|
277 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
278 | + $value_marker->setData($data); |
|
279 | + $chart->addMarker($value_marker); |
|
280 | 280 | |
281 | 281 | return $chart->getUrl(); |
282 | 282 | } |
@@ -124,8 +124,10 @@ |
||
124 | 124 | |
125 | 125 | $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
126 | 126 | endforeach; |
127 | - else: |
|
127 | + else { |
|
128 | + : |
|
128 | 129 | $pdf->SetWidths( array( 280 ) ); |
130 | + } |
|
129 | 131 | $title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) ); |
130 | 132 | $pdf->Row( array( $title ) ); |
131 | 133 | endif; |