@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.0 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
21 | + do_action('give_tools_tab_export_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat export-options-table give-table"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,42 +38,42 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
41 | + do_action('give_tools_tab_export_table_top'); |
|
42 | 42 | ?> |
43 | 43 | <tr class="give-export-pdf-sales-earnings"> |
44 | 44 | <td scope="row" class="row-title"> |
45 | 45 | <h3> |
46 | - <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
46 | + <span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
47 | 47 | </h3> |
48 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
48 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
49 | 49 | </td> |
50 | 50 | <td> |
51 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
|
52 | - <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
|
51 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"> |
|
52 | + <?php esc_html_e('Generate PDF', 'give'); ?> |
|
53 | 53 | </a> |
54 | 54 | </td> |
55 | 55 | </tr> |
56 | 56 | <tr class="alternate give-export-sales-earnings"> |
57 | 57 | <td scope="row" class="row-title"> |
58 | 58 | <h3> |
59 | - <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
59 | + <span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span> |
|
60 | 60 | </h3> |
61 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
61 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
62 | 62 | </td> |
63 | 63 | <td> |
64 | 64 | <form method="post"> |
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: 1: start date dropdown 2: end date dropdown */ |
68 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
69 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
70 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
68 | + esc_html__('%1$s to %2$s', 'give'), |
|
69 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
70 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
71 | 71 | ); |
72 | 72 | ?> |
73 | 73 | <input type="hidden" name="give-action" |
74 | 74 | value="earnings_export"/> |
75 | 75 | <input type="submit" |
76 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
76 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
77 | 77 | class="button-secondary"/> |
78 | 78 | </form> |
79 | 79 | </td> |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | <tr class="give-export-payment-history"> |
82 | 82 | <td scope="row" class="row-title"> |
83 | 83 | <h3> |
84 | - <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
|
84 | + <span><?php esc_html_e('Export Donation History', 'give'); ?></span> |
|
85 | 85 | </h3> |
86 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
86 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | <td> |
89 | 89 | <form id="give-export-payments" |
90 | 90 | class="give-export-form" method="post"> |
91 | 91 | <?php |
92 | - echo Give()->html->date_field( array( |
|
92 | + echo Give()->html->date_field(array( |
|
93 | 93 | 'id' => 'give-payment-export-start', |
94 | 94 | 'name' => 'start', |
95 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
96 | - ) ); |
|
95 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
96 | + )); |
|
97 | 97 | |
98 | - echo Give()->html->date_field( array( |
|
98 | + echo Give()->html->date_field(array( |
|
99 | 99 | 'id' => 'give-payment-export-end', |
100 | 100 | 'name' => 'end', |
101 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
102 | - ) ); |
|
101 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
102 | + )); |
|
103 | 103 | ?> |
104 | 104 | <select name="status"> |
105 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
105 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
106 | 106 | <?php |
107 | 107 | $statuses = give_get_payment_statuses(); |
108 | - foreach ( $statuses as $status => $label ) { |
|
109 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
108 | + foreach ($statuses as $status => $label) { |
|
109 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 | </select> |
113 | 113 | <?php |
114 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
114 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
115 | 115 | echo Give()->html->category_dropdown( |
116 | 116 | 'give_forms_categories[]', |
117 | 117 | 0, |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | 'multiple' => true, |
122 | 122 | 'selected' => array(), |
123 | 123 | 'show_option_all' => false, |
124 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
124 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
129 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
129 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
130 | 130 | echo Give()->html->tags_dropdown( |
131 | 131 | 'give_forms_tags[]', |
132 | 132 | 0, |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | 'multiple' => true, |
137 | 137 | 'selected' => array(), |
138 | 138 | 'show_option_all' => false, |
139 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
139 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
144 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
145 | 145 | ?> |
146 | 146 | <input type="hidden" name="give-export-class" |
147 | 147 | value="Give_Batch_Payments_Export"/> |
148 | 148 | <span> |
149 | 149 | <input type="submit" |
150 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
150 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
151 | 151 | class="button-secondary"/> |
152 | 152 | <span class="spinner"></span> |
153 | 153 | </span> |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | <tr class="alternate give-export-donors"> |
158 | 158 | <td scope="row" class="row-title"> |
159 | 159 | <h3> |
160 | - <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
|
160 | + <span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span> |
|
161 | 161 | </h3> |
162 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
162 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
163 | 163 | </td> |
164 | 164 | <td> |
165 | 165 | <form method="post" id="give_donor_export" |
@@ -167,99 +167,99 @@ discard block |
||
167 | 167 | |
168 | 168 | <?php |
169 | 169 | // Start Date form field for donors |
170 | - echo Give()->html->date_field( array( |
|
170 | + echo Give()->html->date_field(array( |
|
171 | 171 | 'id' => 'give_donor_export_start_date', |
172 | 172 | 'name' => 'donor_export_start_date', |
173 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
174 | - ) ); |
|
173 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
174 | + )); |
|
175 | 175 | |
176 | 176 | // End Date form field for donors |
177 | - echo Give()->html->date_field( array( |
|
177 | + echo Give()->html->date_field(array( |
|
178 | 178 | 'id' => 'give_donor_export_end_date', |
179 | 179 | 'name' => 'donor_export_end_date', |
180 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
181 | - ) ); |
|
180 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
181 | + )); |
|
182 | 182 | |
183 | 183 | // Donation forms dropdown for donors export |
184 | - echo Give()->html->forms_dropdown( array( |
|
184 | + echo Give()->html->forms_dropdown(array( |
|
185 | 185 | 'name' => 'forms', |
186 | 186 | 'id' => 'give_donor_export_form', |
187 | 187 | 'chosen' => true, |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | ?> |
190 | 190 | |
191 | 191 | <input type="submit" |
192 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
192 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
193 | 193 | class="button-secondary"/> |
194 | 194 | |
195 | 195 | <div id="export-donor-options-wrap" |
196 | 196 | class="give-clearfix"> |
197 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
197 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
198 | 198 | <ul id="give-export-option-ul"> |
199 | 199 | <li> |
200 | 200 | <label for="give-export-fullname"> |
201 | 201 | <input type="checkbox" checked |
202 | 202 | name="give_export_option[full_name]" |
203 | - id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
203 | + id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
204 | 204 | </label> |
205 | 205 | </li> |
206 | 206 | <li> |
207 | 207 | <label for="give-export-email"> |
208 | 208 | <input type="checkbox" checked |
209 | 209 | name="give_export_option[email]" |
210 | - id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
210 | + id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
211 | 211 | </label> |
212 | 212 | </li> |
213 | 213 | <li> |
214 | 214 | <label for="give-export-address"> |
215 | 215 | <input type="checkbox" checked |
216 | 216 | name="give_export_option[address]" |
217 | - id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
217 | + id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
218 | 218 | </label> |
219 | 219 | </li> |
220 | 220 | <li> |
221 | 221 | <label for="give-export-userid"> |
222 | 222 | <input type="checkbox" checked |
223 | 223 | name="give_export_option[userid]" |
224 | - id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
224 | + id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
225 | 225 | </label> |
226 | 226 | </li> |
227 | 227 | <li> |
228 | 228 | <label for="give-export-donation-form"> |
229 | 229 | <input type="checkbox" checked |
230 | 230 | name="give_export_option[donation_form]" |
231 | - id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?> |
|
231 | + id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?> |
|
232 | 232 | </label> |
233 | 233 | </li> |
234 | 234 | <li> |
235 | 235 | <label for="give-export-first-donation-date"> |
236 | 236 | <input type="checkbox" checked |
237 | 237 | name="give_export_option[date_first_donated]" |
238 | - id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
238 | + id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
239 | 239 | </label> |
240 | 240 | </li> |
241 | 241 | <li> |
242 | 242 | <label for="give-export-donation-number"> |
243 | 243 | <input type="checkbox" checked |
244 | 244 | name="give_export_option[donations]" |
245 | - id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
245 | + id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
246 | 246 | </label> |
247 | 247 | </li> |
248 | 248 | <li> |
249 | 249 | <label for="give-export-donation-sum"> |
250 | 250 | <input type="checkbox" checked |
251 | 251 | name="give_export_option[donation_sum]" |
252 | - id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
252 | + id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
253 | 253 | </label> |
254 | 254 | </li> |
255 | 255 | </ul> |
256 | 256 | </div> |
257 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
257 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
258 | 258 | <input type="hidden" name="give-export-class" |
259 | 259 | value="Give_Batch_Donors_Export"/> |
260 | 260 | <input type="hidden" |
261 | 261 | name="give_export_option[query_id]" |
262 | - value="<?php echo uniqid( 'give_' ); ?>"/> |
|
262 | + value="<?php echo uniqid('give_'); ?>"/> |
|
263 | 263 | </form> |
264 | 264 | </td> |
265 | 265 | </tr> |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @since 1.0 |
274 | 274 | */ |
275 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
275 | + do_action('give_tools_tab_export_table_bottom'); |
|
276 | 276 | ?> |
277 | 277 | </tbody> |
278 | 278 | </table> |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @since 1.0 |
285 | 285 | */ |
286 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
286 | + do_action('give_tools_tab_export_content_bottom'); |
|
287 | 287 | ?> |
288 | 288 | |
289 | 289 | </div> |
@@ -514,16 +514,16 @@ |
||
514 | 514 | <p> |
515 | 515 | <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
516 | 516 | <?php |
517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | - |
|
520 | - // Check whether the donor name and WP_User name is same or not. |
|
521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | - }else{ |
|
524 | - echo $donor_name; |
|
525 | - } |
|
526 | - ?> |
|
517 | + $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | + |
|
520 | + // Check whether the donor name and WP_User name is same or not. |
|
521 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | + echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | + }else{ |
|
524 | + echo $donor_name; |
|
525 | + } |
|
526 | + ?> |
|
527 | 527 | </p> |
528 | 528 | <p> |
529 | 529 | <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
@@ -520,7 +520,7 @@ |
||
520 | 520 | // Check whether the donor name and WP_User name is same or not. |
521 | 521 | if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
522 | 522 | echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
523 | - }else{ |
|
523 | + } else{ |
|
524 | 524 | echo $donor_name; |
525 | 525 | } |
526 | 526 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $donor_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $currency_code = $payment->currency; |
46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading" class="wp-heading-inline"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: donation number */ |
55 | - esc_html__( 'Donation %s', 'give' ), |
|
55 | + esc_html__('Donation %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param int $payment_id Payment id. |
70 | 70 | */ |
71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
71 | + do_action('give_view_order_details_before', $payment_id); |
|
72 | 72 | ?> |
73 | 73 | |
74 | 74 | <hr class="wp-header-end"> |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param int $payment_id Payment id. |
84 | 84 | */ |
85 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
85 | + do_action('give_view_order_details_form_top', $payment_id); |
|
86 | 86 | ?> |
87 | 87 | <div id="poststuff"> |
88 | 88 | <div id="give-dashboard-widgets-wrap"> |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param int $payment_id Payment id. |
100 | 100 | */ |
101 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
101 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
102 | 102 | ?> |
103 | 103 | |
104 | 104 | <div id="give-order-update" class="postbox give-order-data"> |
105 | 105 | |
106 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
106 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
107 | 107 | |
108 | 108 | <div class="inside"> |
109 | 109 | <div class="give-admin-box"> |
@@ -116,33 +116,33 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param int $payment_id Payment id. |
118 | 118 | */ |
119 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
119 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
120 | 120 | ?> |
121 | 121 | |
122 | 122 | <div class="give-admin-box-inside"> |
123 | 123 | <p> |
124 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
124 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
125 | 125 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
126 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
127 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
126 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
127 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
128 | 128 | <?php endforeach; ?> |
129 | 129 | </select> |
130 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
130 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
131 | 131 | </p> |
132 | 132 | </div> |
133 | 133 | |
134 | 134 | <div class="give-admin-box-inside"> |
135 | 135 | <p> |
136 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
137 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
136 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
137 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
138 | 138 | </p> |
139 | 139 | </div> |
140 | 140 | |
141 | 141 | <div class="give-admin-box-inside"> |
142 | 142 | <p> |
143 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
144 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
145 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
143 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
144 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
145 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
146 | 146 | </p> |
147 | 147 | </div> |
148 | 148 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param int $payment_id Payment id. |
158 | 158 | */ |
159 | - do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
159 | + do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
160 | 160 | |
161 | 161 | <div class="give-order-payment give-admin-box-inside"> |
162 | 162 | <p> |
163 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
164 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
165 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ), false, false ) ); ?>"/> |
|
163 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
164 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
165 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id), false, false)); ?>"/> |
|
166 | 166 | </p> |
167 | 167 | </div> |
168 | 168 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @param int $payment_id Payment id. |
176 | 176 | */ |
177 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
177 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
178 | 178 | ?> |
179 | 179 | |
180 | 180 | </div> |
@@ -192,17 +192,17 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param int $payment_id Payment id. |
194 | 194 | */ |
195 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
195 | + do_action('give_view_order_details_update_before', $payment_id); |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | <div id="major-publishing-actions"> |
199 | 199 | <div id="publishing-action"> |
200 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
201 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
202 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
200 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
201 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
202 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
203 | 203 | 'give-action' => 'email_links', |
204 | 204 | 'purchase_id' => $payment_id, |
205 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
205 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
206 | 206 | <?php endif; ?> |
207 | 207 | </div> |
208 | 208 | <div class="clear"></div> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param int $payment_id Payment id. |
218 | 218 | */ |
219 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
219 | + do_action('give_view_order_details_update_after', $payment_id); |
|
220 | 220 | ?> |
221 | 221 | |
222 | 222 | </div> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | <div id="give-order-details" class="postbox give-order-data"> |
229 | 229 | |
230 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
230 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
231 | 231 | |
232 | 232 | <div class="inside"> |
233 | 233 | <div class="give-admin-box"> |
@@ -240,44 +240,44 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param int $payment_id Payment id. |
242 | 242 | */ |
243 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
243 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
244 | 244 | |
245 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
246 | - if ( $gateway ) : ?> |
|
245 | + $gateway = give_get_payment_gateway($payment_id); |
|
246 | + if ($gateway) : ?> |
|
247 | 247 | <div class="give-order-gateway give-admin-box-inside"> |
248 | 248 | <p> |
249 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
250 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
249 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
250 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
251 | 251 | </p> |
252 | 252 | </div> |
253 | 253 | <?php endif; ?> |
254 | 254 | |
255 | 255 | <div class="give-order-payment-key give-admin-box-inside"> |
256 | 256 | <p> |
257 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
258 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
257 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
258 | + <?php echo give_get_payment_key($payment_id); ?> |
|
259 | 259 | </p> |
260 | 260 | </div> |
261 | 261 | |
262 | 262 | <div class="give-order-ip give-admin-box-inside"> |
263 | 263 | <p> |
264 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
265 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
264 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
265 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
266 | 266 | </p> |
267 | 267 | </div> |
268 | 268 | |
269 | - <?php if ( $transaction_id ) : ?> |
|
269 | + <?php if ($transaction_id) : ?> |
|
270 | 270 | <div class="give-order-tx-id give-admin-box-inside"> |
271 | 271 | <p> |
272 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
273 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
272 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
273 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
274 | 274 | </p> |
275 | 275 | </div> |
276 | 276 | <?php endif; ?> |
277 | 277 | |
278 | 278 | <div class="give-admin-box-inside"> |
279 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
280 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
279 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
280 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
281 | 281 | </p> |
282 | 282 | </div> |
283 | 283 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @param int $payment_id Payment id. |
291 | 291 | */ |
292 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
292 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
293 | 293 | ?> |
294 | 294 | |
295 | 295 | </div> |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @param int $payment_id Payment id. |
311 | 311 | */ |
312 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
312 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
313 | 313 | ?> |
314 | 314 | |
315 | 315 | </div> |
@@ -329,56 +329,56 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @param int $payment_id Payment id. |
331 | 331 | */ |
332 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
332 | + do_action('give_view_order_details_main_before', $payment_id); |
|
333 | 333 | ?> |
334 | 334 | |
335 | 335 | <?php $column_count = 'columns-3'; ?> |
336 | 336 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
337 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
337 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
338 | 338 | |
339 | 339 | <div class="inside"> |
340 | 340 | |
341 | 341 | <div class="column-container"> |
342 | 342 | <div class="column"> |
343 | 343 | <p> |
344 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
344 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
345 | 345 | <?php |
346 | - if ( $payment_meta['form_id'] ) : |
|
346 | + if ($payment_meta['form_id']) : |
|
347 | 347 | printf( |
348 | 348 | '<a href="%1$s">#%2$s</a>', |
349 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
349 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
350 | 350 | $payment_meta['form_id'] |
351 | 351 | ); |
352 | 352 | endif; |
353 | 353 | ?> |
354 | 354 | </p> |
355 | 355 | <p> |
356 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
357 | - <?php echo Give()->html->forms_dropdown( array( |
|
356 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
357 | + <?php echo Give()->html->forms_dropdown(array( |
|
358 | 358 | 'selected' => $payment_meta['form_id'], |
359 | 359 | 'name' => 'give-payment-form-select', |
360 | 360 | 'id' => 'give-payment-form-select', |
361 | 361 | 'chosen' => true, |
362 | - ) ); ?> |
|
362 | + )); ?> |
|
363 | 363 | </p> |
364 | 364 | </div> |
365 | 365 | <div class="column"> |
366 | 366 | <p> |
367 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
368 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
367 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
368 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
369 | 369 | </p> |
370 | 370 | <p> |
371 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
371 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
372 | 372 | <span class="give-donation-level"> |
373 | 373 | <?php |
374 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
375 | - if ( empty( $var_prices ) ) { |
|
376 | - esc_html_e( 'n/a', 'give' ); |
|
374 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
375 | + if (empty($var_prices)) { |
|
376 | + esc_html_e('n/a', 'give'); |
|
377 | 377 | } else { |
378 | 378 | $prices_atts = ''; |
379 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
380 | - foreach ( $variable_prices as $variable_price ) { |
|
381 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
379 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
380 | + foreach ($variable_prices as $variable_price) { |
|
381 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | // Variable price dropdown options. |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | 'name' => 'give-variable-price', |
388 | 388 | 'chosen' => true, |
389 | 389 | 'show_option_all' => '', |
390 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
391 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
390 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
391 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
392 | 392 | 'selected' => $payment_meta['price_id'], |
393 | 393 | ); |
394 | 394 | // Render variable prices select tag html. |
395 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
395 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
396 | 396 | } |
397 | 397 | ?> |
398 | 398 | </span> |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | </div> |
401 | 401 | <div class="column"> |
402 | 402 | <p> |
403 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
404 | - <?php echo give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
403 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
404 | + <?php echo give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); ?> |
|
405 | 405 | </p> |
406 | 406 | <p> |
407 | 407 | <?php |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @param int $payment_id Payment id. |
416 | 416 | */ |
417 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
417 | + do_action('give_donation_details_thead_before', $payment_id); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * |
427 | 427 | * @param int $payment_id Payment id. |
428 | 428 | */ |
429 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
429 | + do_action('give_donation_details_thead_after', $payment_id); |
|
430 | 430 | |
431 | 431 | /** |
432 | 432 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @param int $payment_id Payment id. |
439 | 439 | */ |
440 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
440 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
441 | 441 | |
442 | 442 | /** |
443 | 443 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @param int $payment_id Payment id. |
450 | 450 | */ |
451 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
451 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
452 | 452 | ?> |
453 | 453 | </p> |
454 | 454 | </div> |
@@ -468,67 +468,67 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @param int $payment_id Payment id. |
470 | 470 | */ |
471 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
471 | + do_action('give_view_order_details_files_after', $payment_id); |
|
472 | 472 | ?> |
473 | 473 | |
474 | 474 | <div id="give-donor-details" class="postbox"> |
475 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
475 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
476 | 476 | |
477 | 477 | <div class="inside"> |
478 | 478 | |
479 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
479 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
480 | 480 | |
481 | 481 | <div class="column-container donor-info"> |
482 | 482 | <div class="column"> |
483 | 483 | <p> |
484 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
484 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
485 | 485 | <?php |
486 | - if ( ! empty( $donor->id ) ) { |
|
486 | + if ( ! empty($donor->id)) { |
|
487 | 487 | printf( |
488 | 488 | '<a href="%1$s">#%2$s</a>', |
489 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
489 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
490 | 490 | $donor->id |
491 | 491 | ); |
492 | 492 | } |
493 | 493 | ?> |
494 | 494 | </p> |
495 | 495 | <p> |
496 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
497 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
496 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
497 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
498 | 498 | </p> |
499 | 499 | </div> |
500 | 500 | <div class="column"> |
501 | 501 | <p> |
502 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
502 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
503 | 503 | <?php |
504 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
505 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
504 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
505 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
506 | 506 | |
507 | 507 | // Check whether the donor name and WP_User name is same or not. |
508 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
509 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
510 | - }else{ |
|
508 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
509 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
510 | + } else { |
|
511 | 511 | echo $donor_name; |
512 | 512 | } |
513 | 513 | ?> |
514 | 514 | </p> |
515 | 515 | <p> |
516 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
516 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
517 | 517 | <?php echo $donor->email; ?> |
518 | 518 | </p> |
519 | 519 | </div> |
520 | 520 | <div class="column"> |
521 | 521 | <p> |
522 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
522 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
523 | 523 | <?php |
524 | - echo Give()->html->donor_dropdown( array( |
|
524 | + echo Give()->html->donor_dropdown(array( |
|
525 | 525 | 'selected' => $donor->id, |
526 | 526 | 'name' => 'donor-id', |
527 | - ) ); |
|
527 | + )); |
|
528 | 528 | ?> |
529 | 529 | </p> |
530 | 530 | <p> |
531 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
531 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
532 | 532 | </p> |
533 | 533 | </div> |
534 | 534 | </div> |
@@ -536,13 +536,13 @@ discard block |
||
536 | 536 | <div class="column-container new-donor" style="display: none"> |
537 | 537 | <div class="column"> |
538 | 538 | <p> |
539 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
539 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
540 | 540 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
541 | 541 | </p> |
542 | 542 | </div> |
543 | 543 | <div class="column"> |
544 | 544 | <p> |
545 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
545 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
546 | 546 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
547 | 547 | </p> |
548 | 548 | </div> |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | <p> |
551 | 551 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
552 | 552 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
553 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
553 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
554 | 554 | <br> |
555 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
555 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
556 | 556 | </p> |
557 | 557 | </div> |
558 | 558 | </div> |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * @param array $payment_meta Payment meta. |
569 | 569 | * @param array $user_info User information. |
570 | 570 | */ |
571 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
571 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
572 | 572 | |
573 | 573 | /** |
574 | 574 | * Fires on the donation details page, in the donor-details metabox. |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * |
578 | 578 | * @param int $payment_id Payment id. |
579 | 579 | */ |
580 | - do_action( 'give_payment_view_details', $payment_id ); |
|
580 | + do_action('give_payment_view_details', $payment_id); |
|
581 | 581 | ?> |
582 | 582 | |
583 | 583 | </div> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | * |
594 | 594 | * @param int $payment_id Payment id. |
595 | 595 | */ |
596 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
596 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
597 | 597 | ?> |
598 | 598 | |
599 | 599 | <div id="give-billing-details" class="postbox"> |
600 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
600 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
601 | 601 | |
602 | 602 | <div class="inside"> |
603 | 603 | |
@@ -607,9 +607,9 @@ discard block |
||
607 | 607 | <div class="data column-container"> |
608 | 608 | |
609 | 609 | <?php |
610 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
610 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
611 | 611 | |
612 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
612 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
613 | 613 | |
614 | 614 | // Get the country list that does not have any states init. |
615 | 615 | $no_states_country = give_no_states_country_list(); |
@@ -617,55 +617,55 @@ discard block |
||
617 | 617 | |
618 | 618 | <div class="row"> |
619 | 619 | <div id="give-order-address-country-wrap"> |
620 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
620 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
621 | 621 | <?php |
622 | - echo Give()->html->select( array( |
|
622 | + echo Give()->html->select(array( |
|
623 | 623 | 'options' => give_get_country_list(), |
624 | 624 | 'name' => 'give-payment-address[0][country]', |
625 | 625 | 'selected' => $address['country'], |
626 | 626 | 'show_option_all' => false, |
627 | 627 | 'show_option_none' => false, |
628 | 628 | 'chosen' => true, |
629 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
630 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
631 | - ) ); |
|
629 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
630 | + 'data' => array('search-type' => 'no_ajax'), |
|
631 | + )); |
|
632 | 632 | ?> |
633 | 633 | </div> |
634 | 634 | </div> |
635 | 635 | |
636 | 636 | <div class="row"> |
637 | 637 | <div class="give-wrap-address-line1"> |
638 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
639 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
638 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
639 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
640 | 640 | </div> |
641 | 641 | </div> |
642 | 642 | |
643 | 643 | <div class="row"> |
644 | 644 | <div class="give-wrap-address-line2"> |
645 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
646 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
645 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
646 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
647 | 647 | </div> |
648 | 648 | </div> |
649 | 649 | |
650 | 650 | <div class="row"> |
651 | - <div id="give-order-address-state-wrap" class="<?php echo ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? 'give-hidden' : '' ); ?>"> |
|
652 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
651 | + <div id="give-order-address-state-wrap" class="<?php echo ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? 'give-hidden' : ''); ?>"> |
|
652 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
653 | 653 | <?php |
654 | - $states = give_get_states( $address['country'] ); |
|
655 | - if ( ! empty( $states ) ) { |
|
656 | - echo Give()->html->select( array( |
|
654 | + $states = give_get_states($address['country']); |
|
655 | + if ( ! empty($states)) { |
|
656 | + echo Give()->html->select(array( |
|
657 | 657 | 'options' => $states, |
658 | 658 | 'name' => 'give-payment-address[0][state]', |
659 | 659 | 'selected' => $address['state'], |
660 | 660 | 'show_option_all' => false, |
661 | 661 | 'show_option_none' => false, |
662 | 662 | 'chosen' => true, |
663 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
664 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
665 | - ) ); |
|
663 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
664 | + 'data' => array('search-type' => 'no_ajax'), |
|
665 | + )); |
|
666 | 666 | } else { |
667 | 667 | ?> |
668 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
668 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
669 | 669 | <?php |
670 | 670 | } ?> |
671 | 671 | </div> |
@@ -674,15 +674,15 @@ discard block |
||
674 | 674 | <div class="row"> |
675 | 675 | <div class="column"> |
676 | 676 | <div class="give-wrap-address-city"> |
677 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
678 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
677 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
678 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
679 | 679 | </div> |
680 | 680 | </div> |
681 | 681 | |
682 | 682 | <div class="column"> |
683 | 683 | <div class="give-wrap-address-zip"> |
684 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
685 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
684 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
685 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
686 | 686 | </div> |
687 | 687 | </div> |
688 | 688 | </div> |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * |
702 | 702 | * @param int $payment_id Payment id. |
703 | 703 | */ |
704 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
704 | + do_action('give_payment_billing_details', $payment_id); |
|
705 | 705 | ?> |
706 | 706 | |
707 | 707 | </div> |
@@ -717,32 +717,32 @@ discard block |
||
717 | 717 | * |
718 | 718 | * @param int $payment_id Payment id. |
719 | 719 | */ |
720 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
720 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
721 | 721 | ?> |
722 | 722 | |
723 | 723 | <div id="give-payment-notes" class="postbox"> |
724 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
724 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
725 | 725 | |
726 | 726 | <div class="inside"> |
727 | 727 | <div id="give-payment-notes-inner"> |
728 | 728 | <?php |
729 | - $notes = give_get_payment_notes( $payment_id ); |
|
730 | - if ( ! empty( $notes ) ) { |
|
729 | + $notes = give_get_payment_notes($payment_id); |
|
730 | + if ( ! empty($notes)) { |
|
731 | 731 | $no_notes_display = ' style="display:none;"'; |
732 | - foreach ( $notes as $note ) : |
|
732 | + foreach ($notes as $note) : |
|
733 | 733 | |
734 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
734 | + echo give_get_payment_note_html($note, $payment_id); |
|
735 | 735 | |
736 | 736 | endforeach; |
737 | 737 | } else { |
738 | 738 | $no_notes_display = ''; |
739 | 739 | } |
740 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
740 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
741 | 741 | </div> |
742 | 742 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
743 | 743 | |
744 | 744 | <div class="give-clearfix"> |
745 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
745 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
746 | 746 | </div> |
747 | 747 | |
748 | 748 | </div> |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @param int $payment_id Payment id. |
760 | 760 | */ |
761 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
761 | + do_action('give_view_order_details_main_after', $payment_id); |
|
762 | 762 | ?> |
763 | 763 | |
764 | 764 | </div> |
@@ -780,11 +780,11 @@ discard block |
||
780 | 780 | * |
781 | 781 | * @param int $payment_id Payment id. |
782 | 782 | */ |
783 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
783 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
784 | 784 | |
785 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
785 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
786 | 786 | ?> |
787 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
787 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
788 | 788 | <input type="hidden" name="give_action" value="update_payment_details"/> |
789 | 789 | </form> |
790 | 790 | <?php |
@@ -795,6 +795,6 @@ discard block |
||
795 | 795 | * |
796 | 796 | * @param int $payment_id Payment id. |
797 | 797 | */ |
798 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
798 | + do_action('give_view_order_details_after', $payment_id); |
|
799 | 799 | ?> |
800 | 800 | </div><!-- /.wrap --> |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return string Donations dropdown. |
37 | 37 | */ |
38 | - public function donations_dropdown( $args = array() ) { |
|
38 | + public function donations_dropdown($args = array()) { |
|
39 | 39 | |
40 | 40 | $defaults = array( |
41 | 41 | 'name' => 'donations', |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | 'selected' => 0, |
46 | 46 | 'chosen' => false, |
47 | 47 | 'number' => 30, |
48 | - 'placeholder' => __( 'Select a donation', 'give' ), |
|
48 | + 'placeholder' => __('Select a donation', 'give'), |
|
49 | 49 | ); |
50 | 50 | |
51 | - $args = wp_parse_args( $args, $defaults ); |
|
51 | + $args = wp_parse_args($args, $defaults); |
|
52 | 52 | |
53 | - $payments = new Give_Payments_Query( array( |
|
53 | + $payments = new Give_Payments_Query(array( |
|
54 | 54 | 'number' => $args['number'], |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | $payments = $payments->get_payments(); |
58 | 58 | |
59 | 59 | $options = array(); |
60 | 60 | |
61 | 61 | // Provide nice human readable options. |
62 | - if ( $payments ) { |
|
62 | + if ($payments) { |
|
63 | 63 | $options[0] = $args['placeholder']; |
64 | - foreach ( $payments as $payment ) { |
|
64 | + foreach ($payments as $payment) { |
|
65 | 65 | |
66 | - $options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
66 | + $options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | } else { |
70 | - $options[0] = __( 'No donations found.', 'give' ); |
|
70 | + $options[0] = __('No donations found.', 'give'); |
|
71 | 71 | } |
72 | 72 | |
73 | - $output = $this->select( array( |
|
73 | + $output = $this->select(array( |
|
74 | 74 | 'name' => $args['name'], |
75 | 75 | 'selected' => $args['selected'], |
76 | 76 | 'id' => $args['id'], |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'select_atts' => $args['select_atts'], |
83 | 83 | 'show_option_all' => false, |
84 | 84 | 'show_option_none' => false, |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | |
87 | 87 | return $output; |
88 | 88 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return string Give forms dropdown. |
101 | 101 | */ |
102 | - public function forms_dropdown( $args = array() ) { |
|
102 | + public function forms_dropdown($args = array()) { |
|
103 | 103 | |
104 | 104 | $defaults = array( |
105 | 105 | 'name' => 'forms', |
@@ -109,39 +109,39 @@ discard block |
||
109 | 109 | 'selected' => 0, |
110 | 110 | 'chosen' => false, |
111 | 111 | 'number' => 30, |
112 | - 'placeholder' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
112 | + 'placeholder' => esc_attr__('Select a Donation Form', 'give'), |
|
113 | 113 | 'data' => array( |
114 | 114 | 'search-type' => 'form', |
115 | 115 | ), |
116 | 116 | ); |
117 | 117 | |
118 | - $args = wp_parse_args( $args, $defaults ); |
|
118 | + $args = wp_parse_args($args, $defaults); |
|
119 | 119 | |
120 | - $forms = get_posts( array( |
|
120 | + $forms = get_posts(array( |
|
121 | 121 | 'post_type' => 'give_forms', |
122 | 122 | 'orderby' => 'title', |
123 | 123 | 'order' => 'ASC', |
124 | 124 | 'posts_per_page' => $args['number'], |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $options = array(); |
128 | 128 | |
129 | 129 | // Ensure the selected. |
130 | - if ( false !== $args['selected'] && $args['selected'] !== 0 ) { |
|
131 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
130 | + if (false !== $args['selected'] && $args['selected'] !== 0) { |
|
131 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
132 | 132 | } |
133 | 133 | |
134 | - if ( $forms ) { |
|
134 | + if ($forms) { |
|
135 | 135 | $options[0] = $args['placeholder']; |
136 | - foreach ( $forms as $form ) { |
|
137 | - $form_title = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title; |
|
138 | - $options[ absint( $form->ID ) ] = esc_html( $form_title ); |
|
136 | + foreach ($forms as $form) { |
|
137 | + $form_title = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title; |
|
138 | + $options[absint($form->ID)] = esc_html($form_title); |
|
139 | 139 | } |
140 | 140 | } else { |
141 | - $options[0] = esc_html__( 'No forms found.', 'give' ); |
|
141 | + $options[0] = esc_html__('No forms found.', 'give'); |
|
142 | 142 | } |
143 | 143 | |
144 | - $output = $this->select( array( |
|
144 | + $output = $this->select(array( |
|
145 | 145 | 'name' => $args['name'], |
146 | 146 | 'selected' => $args['selected'], |
147 | 147 | 'id' => $args['id'], |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'show_option_all' => false, |
154 | 154 | 'show_option_none' => false, |
155 | 155 | 'data' => $args['data'], |
156 | - ) ); |
|
156 | + )); |
|
157 | 157 | |
158 | 158 | return $output; |
159 | 159 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return string Donors dropdown. |
172 | 172 | */ |
173 | - public function donor_dropdown( $args = array() ) { |
|
173 | + public function donor_dropdown($args = array()) { |
|
174 | 174 | |
175 | 175 | $defaults = array( |
176 | 176 | 'name' => 'donors', |
@@ -179,57 +179,57 @@ discard block |
||
179 | 179 | 'multiple' => false, |
180 | 180 | 'selected' => 0, |
181 | 181 | 'chosen' => true, |
182 | - 'placeholder' => esc_attr__( 'Select a Donor', 'give' ), |
|
182 | + 'placeholder' => esc_attr__('Select a Donor', 'give'), |
|
183 | 183 | 'number' => 30, |
184 | 184 | 'data' => array( |
185 | 185 | 'search-type' => 'donor', |
186 | 186 | ), |
187 | 187 | ); |
188 | 188 | |
189 | - $args = wp_parse_args( $args, $defaults ); |
|
189 | + $args = wp_parse_args($args, $defaults); |
|
190 | 190 | |
191 | - $donors = Give()->donors->get_donors( array( |
|
191 | + $donors = Give()->donors->get_donors(array( |
|
192 | 192 | 'number' => $args['number'] |
193 | - ) ); |
|
193 | + )); |
|
194 | 194 | |
195 | 195 | $options = array(); |
196 | 196 | |
197 | - if ( $donors ) { |
|
198 | - $options[0] = esc_html__( 'No donor attached', 'give' ); |
|
199 | - foreach ( $donors as $donor ) { |
|
200 | - $options[ absint( $donor->id ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' ); |
|
197 | + if ($donors) { |
|
198 | + $options[0] = esc_html__('No donor attached', 'give'); |
|
199 | + foreach ($donors as $donor) { |
|
200 | + $options[absint($donor->id)] = esc_html($donor->name.' ('.$donor->email.')'); |
|
201 | 201 | } |
202 | 202 | } else { |
203 | - $options[0] = esc_html__( 'No donors found.', 'give' ); |
|
203 | + $options[0] = esc_html__('No donors found.', 'give'); |
|
204 | 204 | } |
205 | 205 | |
206 | - if ( ! empty( $args['selected'] ) ) { |
|
206 | + if ( ! empty($args['selected'])) { |
|
207 | 207 | |
208 | 208 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed. |
209 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
209 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
210 | 210 | |
211 | - $donor = new Give_Donor( $args['selected'] ); |
|
211 | + $donor = new Give_Donor($args['selected']); |
|
212 | 212 | |
213 | - if ( $donor ) { |
|
213 | + if ($donor) { |
|
214 | 214 | |
215 | - $options[ absint( $args['selected'] ) ] = esc_html( $donor->name . ' (' . $donor->email . ')' ); |
|
215 | + $options[absint($args['selected'])] = esc_html($donor->name.' ('.$donor->email.')'); |
|
216 | 216 | |
217 | 217 | } |
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | - $output = $this->select( array( |
|
221 | + $output = $this->select(array( |
|
222 | 222 | 'name' => $args['name'], |
223 | 223 | 'selected' => $args['selected'], |
224 | 224 | 'id' => $args['id'], |
225 | - 'class' => $args['class'] . ' give-customer-select', |
|
225 | + 'class' => $args['class'].' give-customer-select', |
|
226 | 226 | 'options' => $options, |
227 | 227 | 'multiple' => $args['multiple'], |
228 | 228 | 'chosen' => $args['chosen'], |
229 | 229 | 'show_option_all' => false, |
230 | 230 | 'show_option_none' => false, |
231 | 231 | 'data' => $args['data'], |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | |
234 | 234 | return $output; |
235 | 235 | } |
@@ -248,21 +248,21 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return string Categories dropdown. |
250 | 250 | */ |
251 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) { |
|
252 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
251 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) { |
|
252 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
253 | 253 | $options = array(); |
254 | 254 | |
255 | - foreach ( $categories as $category ) { |
|
256 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
255 | + foreach ($categories as $category) { |
|
256 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
257 | 257 | } |
258 | 258 | |
259 | - $output = $this->select( wp_parse_args( $args, array( |
|
259 | + $output = $this->select(wp_parse_args($args, array( |
|
260 | 260 | 'name' => $name, |
261 | 261 | 'selected' => $selected, |
262 | 262 | 'options' => $options, |
263 | - 'show_option_all' => esc_html__( 'All Categories', 'give' ), |
|
263 | + 'show_option_all' => esc_html__('All Categories', 'give'), |
|
264 | 264 | 'show_option_none' => false, |
265 | - ) ) ); |
|
265 | + ))); |
|
266 | 266 | |
267 | 267 | return $output; |
268 | 268 | } |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string Tags dropdown. |
283 | 283 | */ |
284 | - public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) { |
|
285 | - $tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) ); |
|
284 | + public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) { |
|
285 | + $tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array())); |
|
286 | 286 | $options = array(); |
287 | 287 | |
288 | - foreach ( $tags as $tag ) { |
|
289 | - $options[ absint( $tag->term_id ) ] = esc_html( $tag->name ); |
|
288 | + foreach ($tags as $tag) { |
|
289 | + $options[absint($tag->term_id)] = esc_html($tag->name); |
|
290 | 290 | } |
291 | 291 | |
292 | - $output = $this->select( wp_parse_args( $args, array( |
|
292 | + $output = $this->select(wp_parse_args($args, array( |
|
293 | 293 | 'name' => $name, |
294 | 294 | 'selected' => $selected, |
295 | 295 | 'options' => $options, |
296 | - 'show_option_all' => esc_html__( 'All Tags', 'give' ), |
|
296 | + 'show_option_all' => esc_html__('All Tags', 'give'), |
|
297 | 297 | 'show_option_none' => false, |
298 | - ) ) ); |
|
298 | + ))); |
|
299 | 299 | |
300 | 300 | return $output; |
301 | 301 | } |
@@ -315,25 +315,25 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Years dropdown. |
317 | 317 | */ |
318 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
319 | - $current = date( 'Y' ); |
|
320 | - $start_year = $current - absint( $years_before ); |
|
321 | - $end_year = $current + absint( $years_after ); |
|
322 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
318 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
319 | + $current = date('Y'); |
|
320 | + $start_year = $current - absint($years_before); |
|
321 | + $end_year = $current + absint($years_after); |
|
322 | + $selected = empty($selected) ? date('Y') : $selected; |
|
323 | 323 | $options = array(); |
324 | 324 | |
325 | - while ( $start_year <= $end_year ) { |
|
326 | - $options[ absint( $start_year ) ] = $start_year; |
|
327 | - $start_year ++; |
|
325 | + while ($start_year <= $end_year) { |
|
326 | + $options[absint($start_year)] = $start_year; |
|
327 | + $start_year++; |
|
328 | 328 | } |
329 | 329 | |
330 | - $output = $this->select( array( |
|
330 | + $output = $this->select(array( |
|
331 | 331 | 'name' => $name, |
332 | 332 | 'selected' => $selected, |
333 | 333 | 'options' => $options, |
334 | 334 | 'show_option_all' => false, |
335 | 335 | 'show_option_none' => false, |
336 | - ) ); |
|
336 | + )); |
|
337 | 337 | |
338 | 338 | return $output; |
339 | 339 | } |
@@ -351,23 +351,23 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @return string Months dropdown. |
353 | 353 | */ |
354 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
354 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
355 | 355 | $month = 1; |
356 | 356 | $options = array(); |
357 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
357 | + $selected = empty($selected) ? date('n') : $selected; |
|
358 | 358 | |
359 | - while ( $month <= 12 ) { |
|
360 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
361 | - $month ++; |
|
359 | + while ($month <= 12) { |
|
360 | + $options[absint($month)] = give_month_num_to_name($month); |
|
361 | + $month++; |
|
362 | 362 | } |
363 | 363 | |
364 | - $output = $this->select( array( |
|
364 | + $output = $this->select(array( |
|
365 | 365 | 'name' => $name, |
366 | 366 | 'selected' => $selected, |
367 | 367 | 'options' => $options, |
368 | 368 | 'show_option_all' => false, |
369 | 369 | 'show_option_none' => false, |
370 | - ) ); |
|
370 | + )); |
|
371 | 371 | |
372 | 372 | return $output; |
373 | 373 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @return string The dropdown. |
386 | 386 | */ |
387 | - public function select( $args = array() ) { |
|
387 | + public function select($args = array()) { |
|
388 | 388 | $defaults = array( |
389 | 389 | 'options' => array(), |
390 | 390 | 'name' => null, |
@@ -395,67 +395,67 @@ discard block |
||
395 | 395 | 'placeholder' => null, |
396 | 396 | 'multiple' => false, |
397 | 397 | 'select_atts' => false, |
398 | - 'show_option_all' => __( 'All', 'give' ), |
|
399 | - 'show_option_none' => __( 'None', 'give' ), |
|
398 | + 'show_option_all' => __('All', 'give'), |
|
399 | + 'show_option_none' => __('None', 'give'), |
|
400 | 400 | 'data' => array(), |
401 | 401 | 'readonly' => false, |
402 | 402 | 'disabled' => false, |
403 | 403 | ); |
404 | 404 | |
405 | - $args = wp_parse_args( $args, $defaults ); |
|
405 | + $args = wp_parse_args($args, $defaults); |
|
406 | 406 | |
407 | 407 | $data_elements = ''; |
408 | - foreach ( $args['data'] as $key => $value ) { |
|
409 | - $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
|
408 | + foreach ($args['data'] as $key => $value) { |
|
409 | + $data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"'; |
|
410 | 410 | } |
411 | 411 | |
412 | - if ( $args['multiple'] ) { |
|
412 | + if ($args['multiple']) { |
|
413 | 413 | $multiple = ' MULTIPLE'; |
414 | 414 | } else { |
415 | 415 | $multiple = ''; |
416 | 416 | } |
417 | 417 | |
418 | - if ( $args['chosen'] ) { |
|
418 | + if ($args['chosen']) { |
|
419 | 419 | $args['class'] .= ' give-select-chosen'; |
420 | 420 | } |
421 | 421 | |
422 | - if ( $args['placeholder'] ) { |
|
422 | + if ($args['placeholder']) { |
|
423 | 423 | $placeholder = $args['placeholder']; |
424 | 424 | } else { |
425 | 425 | $placeholder = ''; |
426 | 426 | } |
427 | 427 | |
428 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
428 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'"'.$data_elements.'>'; |
|
429 | 429 | |
430 | - if ( $args['show_option_all'] ) { |
|
431 | - if ( $args['multiple'] ) { |
|
432 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
430 | + if ($args['show_option_all']) { |
|
431 | + if ($args['multiple']) { |
|
432 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
433 | 433 | } else { |
434 | - $selected = selected( $args['selected'], 0, false ); |
|
434 | + $selected = selected($args['selected'], 0, false); |
|
435 | 435 | } |
436 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
436 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
437 | 437 | } |
438 | 438 | |
439 | - if ( ! empty( $args['options'] ) ) { |
|
439 | + if ( ! empty($args['options'])) { |
|
440 | 440 | |
441 | - if ( $args['show_option_none'] ) { |
|
442 | - if ( $args['multiple'] ) { |
|
443 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
441 | + if ($args['show_option_none']) { |
|
442 | + if ($args['multiple']) { |
|
443 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
444 | 444 | } else { |
445 | - $selected = selected( $args['selected'], - 1, false ); |
|
445 | + $selected = selected($args['selected'], - 1, false); |
|
446 | 446 | } |
447 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
447 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
448 | 448 | } |
449 | 449 | |
450 | - foreach ( $args['options'] as $key => $option ) { |
|
450 | + foreach ($args['options'] as $key => $option) { |
|
451 | 451 | |
452 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
453 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
452 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
453 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
454 | 454 | } else { |
455 | - $selected = selected( $args['selected'], $key, false ); |
|
455 | + $selected = selected($args['selected'], $key, false); |
|
456 | 456 | } |
457 | 457 | |
458 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
458 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * |
477 | 477 | * @return string The checkbox. |
478 | 478 | */ |
479 | - public function checkbox( $args = array() ) { |
|
479 | + public function checkbox($args = array()) { |
|
480 | 480 | $defaults = array( |
481 | 481 | 'name' => null, |
482 | 482 | 'current' => null, |
@@ -487,16 +487,16 @@ discard block |
||
487 | 487 | ), |
488 | 488 | ); |
489 | 489 | |
490 | - $args = wp_parse_args( $args, $defaults ); |
|
490 | + $args = wp_parse_args($args, $defaults); |
|
491 | 491 | |
492 | 492 | $options = ''; |
493 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
493 | + if ( ! empty($args['options']['disabled'])) { |
|
494 | 494 | $options .= ' disabled="disabled"'; |
495 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
495 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
496 | 496 | $options .= ' readonly'; |
497 | 497 | } |
498 | 498 | |
499 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
499 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
500 | 500 | |
501 | 501 | return $output; |
502 | 502 | } |
@@ -513,22 +513,22 @@ discard block |
||
513 | 513 | * |
514 | 514 | * @return string The text field. |
515 | 515 | */ |
516 | - public function text( $args = array() ) { |
|
516 | + public function text($args = array()) { |
|
517 | 517 | // Backwards compatibility. |
518 | - if ( func_num_args() > 1 ) { |
|
518 | + if (func_num_args() > 1) { |
|
519 | 519 | $args = func_get_args(); |
520 | 520 | |
521 | 521 | $name = $args[0]; |
522 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
523 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
524 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
522 | + $value = isset($args[1]) ? $args[1] : ''; |
|
523 | + $label = isset($args[2]) ? $args[2] : ''; |
|
524 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | $defaults = array( |
528 | - 'name' => isset( $name ) ? $name : 'text', |
|
529 | - 'value' => isset( $value ) ? $value : null, |
|
530 | - 'label' => isset( $label ) ? $label : null, |
|
531 | - 'desc' => isset( $desc ) ? $desc : null, |
|
528 | + 'name' => isset($name) ? $name : 'text', |
|
529 | + 'value' => isset($value) ? $value : null, |
|
530 | + 'label' => isset($label) ? $label : null, |
|
531 | + 'desc' => isset($desc) ? $desc : null, |
|
532 | 532 | 'placeholder' => '', |
533 | 533 | 'class' => 'regular-text', |
534 | 534 | 'disabled' => false, |
@@ -536,29 +536,29 @@ discard block |
||
536 | 536 | 'data' => false, |
537 | 537 | ); |
538 | 538 | |
539 | - $args = wp_parse_args( $args, $defaults ); |
|
539 | + $args = wp_parse_args($args, $defaults); |
|
540 | 540 | |
541 | 541 | $disabled = ''; |
542 | - if ( $args['disabled'] ) { |
|
542 | + if ($args['disabled']) { |
|
543 | 543 | $disabled = ' disabled="disabled"'; |
544 | 544 | } |
545 | 545 | |
546 | 546 | $data = ''; |
547 | - if ( ! empty( $args['data'] ) ) { |
|
548 | - foreach ( $args['data'] as $key => $value ) { |
|
549 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
547 | + if ( ! empty($args['data'])) { |
|
548 | + foreach ($args['data'] as $key => $value) { |
|
549 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
553 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
553 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
554 | 554 | |
555 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
555 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
556 | 556 | |
557 | - if ( ! empty( $args['desc'] ) ) { |
|
558 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
557 | + if ( ! empty($args['desc'])) { |
|
558 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
559 | 559 | } |
560 | 560 | |
561 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
561 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
562 | 562 | |
563 | 563 | $output .= '</span>'; |
564 | 564 | |
@@ -577,15 +577,15 @@ discard block |
||
577 | 577 | * |
578 | 578 | * @return string The date picker. |
579 | 579 | */ |
580 | - public function date_field( $args = array() ) { |
|
580 | + public function date_field($args = array()) { |
|
581 | 581 | |
582 | - if ( empty( $args['class'] ) ) { |
|
582 | + if (empty($args['class'])) { |
|
583 | 583 | $args['class'] = 'give_datepicker'; |
584 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
584 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
585 | 585 | $args['class'] .= ' give_datepicker'; |
586 | 586 | } |
587 | 587 | |
588 | - return $this->text( $args ); |
|
588 | + return $this->text($args); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @return string The textarea. |
602 | 602 | */ |
603 | - public function textarea( $args = array() ) { |
|
603 | + public function textarea($args = array()) { |
|
604 | 604 | $defaults = array( |
605 | 605 | 'name' => 'textarea', |
606 | 606 | 'value' => null, |
@@ -610,21 +610,21 @@ discard block |
||
610 | 610 | 'disabled' => false, |
611 | 611 | ); |
612 | 612 | |
613 | - $args = wp_parse_args( $args, $defaults ); |
|
613 | + $args = wp_parse_args($args, $defaults); |
|
614 | 614 | |
615 | 615 | $disabled = ''; |
616 | - if ( $args['disabled'] ) { |
|
616 | + if ($args['disabled']) { |
|
617 | 617 | $disabled = ' disabled="disabled"'; |
618 | 618 | } |
619 | 619 | |
620 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
620 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
621 | 621 | |
622 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
622 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
623 | 623 | |
624 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
624 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
625 | 625 | |
626 | - if ( ! empty( $args['desc'] ) ) { |
|
627 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
626 | + if ( ! empty($args['desc'])) { |
|
627 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | $output .= '</span>'; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | * |
645 | 645 | * @return string The text field with ajax search. |
646 | 646 | */ |
647 | - public function ajax_user_search( $args = array() ) { |
|
647 | + public function ajax_user_search($args = array()) { |
|
648 | 648 | |
649 | 649 | $defaults = array( |
650 | 650 | 'name' => 'users', |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | 'chosen' => true, |
656 | 656 | 'number' => 30, |
657 | 657 | 'select_atts' => '', |
658 | - 'placeholder' => __( 'Select a user', 'give' ), |
|
658 | + 'placeholder' => __('Select a user', 'give'), |
|
659 | 659 | 'data' => array( |
660 | 660 | 'search-type' => 'user', |
661 | 661 | ), |
662 | 662 | ); |
663 | 663 | |
664 | - $args = wp_parse_args( $args, $defaults ); |
|
664 | + $args = wp_parse_args($args, $defaults); |
|
665 | 665 | |
666 | 666 | // Set initial args. |
667 | 667 | $get_users_args = array( |
@@ -670,31 +670,31 @@ discard block |
||
670 | 670 | |
671 | 671 | // Ensure selected user is not included in initial query. |
672 | 672 | // This is because sites with many users, it's not a guarantee the selected user will be returned. |
673 | - if ( ! empty( $args['selected'] ) ) { |
|
673 | + if ( ! empty($args['selected'])) { |
|
674 | 674 | $get_users_args['exclude'] = $args['selected']; |
675 | 675 | } |
676 | 676 | |
677 | 677 | // Initial users array. |
678 | - $users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args ); |
|
678 | + $users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args); |
|
679 | 679 | |
680 | 680 | // Now add the selected user to the $users array if the arg is present. |
681 | - if ( ! empty( $args['selected'] ) ) { |
|
682 | - $selected_user = apply_filters( 'give_ajax_user_search_selected_results', get_users( "include={$args['selected']}" ), $args );; |
|
683 | - $users = array_merge( $users, $selected_user ); |
|
681 | + if ( ! empty($args['selected'])) { |
|
682 | + $selected_user = apply_filters('give_ajax_user_search_selected_results', get_users("include={$args['selected']}"), $args); ; |
|
683 | + $users = array_merge($users, $selected_user); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | $options = array(); |
687 | 687 | |
688 | - if ( $users ) { |
|
688 | + if ($users) { |
|
689 | 689 | $options[0] = $args['placeholder']; |
690 | - foreach ( $users as $user ) { |
|
691 | - $options[ absint( $user->ID ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' ); |
|
690 | + foreach ($users as $user) { |
|
691 | + $options[absint($user->ID)] = esc_html($user->user_login.' ('.$user->user_email.')'); |
|
692 | 692 | } |
693 | 693 | } else { |
694 | - $options[0] = __( 'No users found.', 'give' ); |
|
694 | + $options[0] = __('No users found.', 'give'); |
|
695 | 695 | } |
696 | 696 | |
697 | - $output = $this->select( array( |
|
697 | + $output = $this->select(array( |
|
698 | 698 | 'name' => $args['name'], |
699 | 699 | 'selected' => $args['selected'], |
700 | 700 | 'id' => $args['id'], |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | 'show_option_all' => false, |
708 | 708 | 'show_option_none' => false, |
709 | 709 | 'data' => $args['data'], |
710 | - ) ); |
|
710 | + )); |
|
711 | 711 | |
712 | 712 | return $output; |
713 | 713 |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | 'posts_per_page' => $this->per_page, |
182 | 182 | ); |
183 | 183 | |
184 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
184 | + $logs = $give_logs->get_connected_logs($log_query); |
|
185 | 185 | |
186 | - if ( $logs ) { |
|
187 | - foreach ( $logs as $log ) { |
|
186 | + if ($logs) { |
|
187 | + foreach ($logs as $log) { |
|
188 | 188 | |
189 | 189 | $logs_data[] = array( |
190 | 190 | 'ID' => $log->ID, |
191 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
191 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
192 | 192 | 'payment_id' => $log->post_parent, |
193 | 193 | 'error' => 'error', |
194 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
194 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
195 | 195 | 'date' => $log->post_date |
196 | 196 | ); |
197 | 197 | } |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @param string $which |
215 | 215 | */ |
216 | - protected function display_tablenav( $which ) { |
|
217 | - if ( 'top' === $which ) { |
|
218 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
216 | + protected function display_tablenav($which) { |
|
217 | + if ('top' === $which) { |
|
218 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
219 | 219 | } |
220 | 220 | ?> |
221 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
221 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
222 | 222 | |
223 | 223 | <div class="alignleft actions bulkactions"> |
224 | - <?php $this->bulk_actions( $which ); ?> |
|
224 | + <?php $this->bulk_actions($which); ?> |
|
225 | 225 | </div> |
226 | 226 | <?php |
227 | - $this->extra_tablenav( $which ); |
|
228 | - $this->pagination( $which ); |
|
227 | + $this->extra_tablenav($which); |
|
228 | + $this->pagination($which); |
|
229 | 229 | ?> |
230 | 230 | |
231 | 231 | <br class="clear"/> |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | $columns = $this->get_columns(); |
253 | 253 | $hidden = array(); // No hidden columns |
254 | 254 | $sortable = $this->get_sortable_columns(); |
255 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
255 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
256 | 256 | $this->items = $this->get_logs(); |
257 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
257 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
258 | 258 | |
259 | - $this->set_pagination_args( array( |
|
259 | + $this->set_pagination_args(array( |
|
260 | 260 | 'total_items' => $total_items, |
261 | 261 | 'per_page' => $this->per_page, |
262 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
262 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | } |
@@ -143,7 +143,7 @@ |
||
143 | 143 | * |
144 | 144 | * @access public |
145 | 145 | * @since 1.0 |
146 | - * @return mixed string If search is present, false otherwise |
|
146 | + * @return string|false string If search is present, false otherwise |
|
147 | 147 | */ |
148 | 148 | public function get_search() { |
149 | 149 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -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' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
68 | - 'ajax' => false,// Does this table support ajax? |
|
69 | - ) ); |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
68 | + 'ajax' => false, // Does this table support ajax? |
|
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 false; |
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" role="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,33 +124,33 @@ 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 | - <?php if ( 'top' === $which ) { ?> |
|
135 | + <?php if ('top' === $which) { ?> |
|
136 | 136 | <h2 class="alignleft reports-earnings-title"> |
137 | - <?php esc_html_e( 'Donors Report', 'give' ); ?> |
|
137 | + <?php esc_html_e('Donors Report', 'give'); ?> |
|
138 | 138 | </h2> |
139 | 139 | <?php } ?> |
140 | 140 | |
141 | 141 | <div class="alignright tablenav-right"> |
142 | 142 | <div class="actions bulkactions"> |
143 | 143 | <?php |
144 | - if ( 'top' === $which ) { |
|
145 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
144 | + if ('top' === $which) { |
|
145 | + $this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); |
|
146 | 146 | } |
147 | 147 | |
148 | - $this->bulk_actions( $which ); ?> |
|
148 | + $this->bulk_actions($which); ?> |
|
149 | 149 | |
150 | 150 | </div> |
151 | 151 | <?php |
152 | - $this->extra_tablenav( $which ); |
|
153 | - $this->pagination( $which ); |
|
152 | + $this->extra_tablenav($which); |
|
153 | + $this->pagination($which); |
|
154 | 154 | ?> |
155 | 155 | </div> |
156 | 156 | |
@@ -172,35 +172,35 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string Column Name |
174 | 174 | */ |
175 | - public function column_default( $item, $column_name ) { |
|
175 | + public function column_default($item, $column_name) { |
|
176 | 176 | |
177 | - switch ( $column_name ) { |
|
177 | + switch ($column_name) { |
|
178 | 178 | |
179 | 179 | case 'name' : |
180 | - $name = '#' . $item['id'] . ' '; |
|
181 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
182 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
183 | - $value = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>'; |
|
180 | + $name = '#'.$item['id'].' '; |
|
181 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
182 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
183 | + $value = '<a href="'.esc_url($view_url).'">'.$name.'</a>'; |
|
184 | 184 | break; |
185 | 185 | |
186 | 186 | case 'num_donations' : |
187 | 187 | $value = sprintf( |
188 | 188 | '<a href="%s">%s</a>', |
189 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $item['id'] ) ), |
|
190 | - esc_html( $item['num_donations'] ) |
|
189 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($item['id'])), |
|
190 | + esc_html($item['num_donations']) |
|
191 | 191 | ); |
192 | 192 | break; |
193 | 193 | |
194 | 194 | case 'amount_spent' : |
195 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
195 | + $value = give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
196 | 196 | break; |
197 | 197 | |
198 | 198 | default: |
199 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
199 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
200 | 200 | break; |
201 | 201 | } |
202 | 202 | |
203 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
203 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function get_columns() { |
214 | 214 | $columns = array( |
215 | - 'name' => __( 'Name', 'give' ), |
|
216 | - 'email' => __( 'Email', 'give' ), |
|
217 | - 'num_donations' => __( 'Donations', 'give' ), |
|
218 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
215 | + 'name' => __('Name', 'give'), |
|
216 | + 'email' => __('Email', 'give'), |
|
217 | + 'num_donations' => __('Donations', 'give'), |
|
218 | + 'amount_spent' => __('Total Donated', 'give'), |
|
219 | 219 | ); |
220 | 220 | |
221 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
221 | + return apply_filters('give_report_donor_columns', $columns); |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function get_sortable_columns() { |
233 | 233 | return array( |
234 | - 'id' => array( 'id', true ), |
|
235 | - 'name' => array( 'name', true ), |
|
236 | - 'num_donations' => array( 'purchase_count', false ), |
|
237 | - 'amount_spent' => array( 'purchase_value', false ), |
|
234 | + 'id' => array('id', true), |
|
235 | + 'name' => array('name', true), |
|
236 | + 'num_donations' => array('purchase_count', false), |
|
237 | + 'amount_spent' => array('purchase_value', false), |
|
238 | 238 | ); |
239 | 239 | } |
240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @since 1.0 |
246 | 246 | * @return void |
247 | 247 | */ |
248 | - public function bulk_actions( $which = '' ) { |
|
248 | + public function bulk_actions($which = '') { |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return int Current page number |
258 | 258 | */ |
259 | 259 | public function get_paged() { |
260 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
260 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return mixed string If search is present, false otherwise |
269 | 269 | */ |
270 | 270 | public function get_search() { |
271 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
271 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | |
288 | 288 | // Get donor query. |
289 | 289 | $args = $this->get_donor_query(); |
290 | - $donors = Give()->donors->get_donors( $args ); |
|
290 | + $donors = Give()->donors->get_donors($args); |
|
291 | 291 | |
292 | - if ( $donors ) { |
|
292 | + if ($donors) { |
|
293 | 293 | |
294 | - $this->count = count( $donors ); |
|
294 | + $this->count = count($donors); |
|
295 | 295 | |
296 | - foreach ( $donors as $donor ) { |
|
296 | + foreach ($donors as $donor) { |
|
297 | 297 | |
298 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
298 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
299 | 299 | |
300 | 300 | $data[] = array( |
301 | 301 | 'id' => $donor->id, |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | |
324 | 324 | $_donor_query['number'] = -1; |
325 | 325 | $_donor_query['offset'] = 0; |
326 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
326 | + $donors = Give()->donors->get_donors($_donor_query); |
|
327 | 327 | |
328 | - return count( $donors ); |
|
328 | + return count($donors); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function get_donor_query() { |
339 | 339 | $paged = $this->get_paged(); |
340 | - $offset = $this->per_page * ( $paged - 1 ); |
|
340 | + $offset = $this->per_page * ($paged - 1); |
|
341 | 341 | $search = $this->get_search(); |
342 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
343 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
342 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
343 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
344 | 344 | |
345 | 345 | $args = array( |
346 | 346 | 'number' => $this->per_page, |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | 'orderby' => $orderby, |
350 | 350 | ); |
351 | 351 | |
352 | - if( $search ) { |
|
353 | - if ( is_email( $search ) ) { |
|
352 | + if ($search) { |
|
353 | + if (is_email($search)) { |
|
354 | 354 | $args['email'] = $search; |
355 | - } elseif ( is_numeric( $search ) ) { |
|
355 | + } elseif (is_numeric($search)) { |
|
356 | 356 | $args['id'] = $search; |
357 | 357 | } else { |
358 | 358 | $args['name'] = $search; |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | $hidden = array(); // No hidden columns |
380 | 380 | $sortable = $this->get_sortable_columns(); |
381 | 381 | |
382 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
382 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
383 | 383 | |
384 | 384 | $this->items = $this->reports_data(); |
385 | 385 | |
386 | 386 | $this->total = $this->get_donor_count(); |
387 | 387 | |
388 | - $this->set_pagination_args( array( |
|
388 | + $this->set_pagination_args(array( |
|
389 | 389 | 'total_items' => $this->total, |
390 | 390 | 'per_page' => $this->per_page, |
391 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
392 | - ) ); |
|
391 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
392 | + )); |
|
393 | 393 | } |
394 | 394 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Gateways_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Gateways_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Gateways_Report. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'gateways'; |
46 | - $this->label = esc_html__( 'Donation Methods', 'give' ); |
|
46 | + $this->label = esc_html__('Donation Methods', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_reports_gateways', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'gateways', |
98 | - 'name' => esc_html__( 'Gateways', 'give' ), |
|
98 | + 'name' => esc_html__('Gateways', 'give'), |
|
99 | 99 | 'type' => 'report_gateways', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_gateways_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_gateways'); |
|
134 | + public function render_report_gateways_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_gateways'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -814,12 +814,12 @@ |
||
814 | 814 | ) ), 'give-refresh-reports' ); |
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
819 | - . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
|
820 | - . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
|
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
822 | - . '</a>'; |
|
817 | + . esc_url_raw( $url ) |
|
818 | + . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
819 | + . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
|
820 | + . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
|
821 | + . esc_html__( 'Refresh Report Data', 'give' ) |
|
822 | + . '</a>'; |
|
823 | 823 | |
824 | 824 | } |
825 | 825 |
@@ -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,7 +25,7 @@ discard block |
||
25 | 25 | $dates = give_get_report_dates(); |
26 | 26 | |
27 | 27 | // Determine graph options |
28 | - switch ( $dates['range'] ) : |
|
28 | + switch ($dates['range']) : |
|
29 | 29 | case 'today' : |
30 | 30 | case 'yesterday' : |
31 | 31 | $day_by_day = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $day_by_day = false; |
38 | 38 | break; |
39 | 39 | case 'other' : |
40 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
40 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
41 | 41 | $day_by_day = false; |
42 | 42 | } else { |
43 | 43 | $day_by_day = true; |
@@ -49,61 +49,61 @@ discard block |
||
49 | 49 | endswitch; |
50 | 50 | |
51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown |
52 | - $sales_totals = 0; // Total sales for time period shown |
|
52 | + $sales_totals = 0; // Total sales for time period shown |
|
53 | 53 | |
54 | 54 | $earnings_data = array(); |
55 | 55 | $sales_data = array(); |
56 | 56 | |
57 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
57 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
58 | 58 | // Hour by hour |
59 | 59 | $hour = 1; |
60 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
61 | - while ( $hour <= 23 ) : |
|
60 | + $month = date('n', current_time('timestamp')); |
|
61 | + while ($hour <= 23) : |
|
62 | 62 | |
63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); |
|
64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); |
|
65 | 65 | |
66 | 66 | $sales_totals += $sales; |
67 | 67 | $earnings_totals += $earnings; |
68 | 68 | |
69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; |
|
70 | - $sales_data[] = array( $date, $sales ); |
|
71 | - $earnings_data[] = array( $date, $earnings ); |
|
69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; |
|
70 | + $sales_data[] = array($date, $sales); |
|
71 | + $earnings_data[] = array($date, $earnings); |
|
72 | 72 | |
73 | - $hour ++; |
|
73 | + $hour++; |
|
74 | 74 | endwhile; |
75 | 75 | |
76 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
76 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
77 | 77 | |
78 | 78 | // Day by day |
79 | 79 | $day = $dates['day']; |
80 | 80 | $day_end = $dates['day_end']; |
81 | 81 | $month = $dates['m_start']; |
82 | - while ( $day <= $day_end ) : |
|
83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); |
|
82 | + while ($day <= $day_end) : |
|
83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); |
|
84 | 84 | $sales_totals += $sales; |
85 | 85 | |
86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); |
|
86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); |
|
87 | 87 | $earnings_totals += $earnings; |
88 | 88 | |
89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; |
|
90 | - $sales_data[] = array( $date, $sales ); |
|
91 | - $earnings_data[] = array( $date, $earnings ); |
|
92 | - $day ++; |
|
89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; |
|
90 | + $sales_data[] = array($date, $sales); |
|
91 | + $earnings_data[] = array($date, $earnings); |
|
92 | + $day++; |
|
93 | 93 | endwhile; |
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
97 | 97 | $y = $dates['year']; |
98 | - while ( $y <= $dates['year_end'] ) : |
|
98 | + while ($y <= $dates['year_end']) : |
|
99 | 99 | |
100 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
100 | + if ($dates['year'] == $dates['year_end']) { |
|
101 | 101 | $month_start = $dates['m_start']; |
102 | 102 | $month_end = $dates['m_end']; |
103 | - } elseif ( $y == $dates['year'] ) { |
|
103 | + } elseif ($y == $dates['year']) { |
|
104 | 104 | $month_start = $dates['m_start']; |
105 | 105 | $month_end = 12; |
106 | - } elseif ( $y == $dates['year_end'] ) { |
|
106 | + } elseif ($y == $dates['year_end']) { |
|
107 | 107 | $month_start = 1; |
108 | 108 | $month_end = $dates['m_end']; |
109 | 109 | } else { |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $i = $month_start; |
115 | - while ( $i <= $month_end ) : |
|
115 | + while ($i <= $month_end) : |
|
116 | 116 | |
117 | - if ( $day_by_day ) { |
|
117 | + if ($day_by_day) { |
|
118 | 118 | |
119 | - if ( $i == $month_end ) { |
|
119 | + if ($i == $month_end) { |
|
120 | 120 | |
121 | 121 | $num_of_days = $dates['day_end']; |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | $d = $dates['day']; |
130 | 130 | |
131 | - while ( $d <= $num_of_days ) : |
|
131 | + while ($d <= $num_of_days) : |
|
132 | 132 | |
133 | - $sales = give_get_sales_by_date( $d, $i, $y ); |
|
133 | + $sales = give_get_sales_by_date($d, $i, $y); |
|
134 | 134 | $sales_totals += $sales; |
135 | 135 | |
136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); |
|
136 | + $earnings = give_get_earnings_by_date($d, $i, $y); |
|
137 | 137 | $earnings_totals += $earnings; |
138 | 138 | |
139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; |
|
140 | - $sales_data[] = array( $date, $sales ); |
|
141 | - $earnings_data[] = array( $date, $earnings ); |
|
142 | - $d ++; |
|
139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; |
|
140 | + $sales_data[] = array($date, $sales); |
|
141 | + $earnings_data[] = array($date, $earnings); |
|
142 | + $d++; |
|
143 | 143 | |
144 | 144 | endwhile; |
145 | 145 | |
146 | 146 | } else { |
147 | 147 | |
148 | - $sales = give_get_sales_by_date( null, $i, $y ); |
|
148 | + $sales = give_get_sales_by_date(null, $i, $y); |
|
149 | 149 | $sales_totals += $sales; |
150 | 150 | |
151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); |
|
151 | + $earnings = give_get_earnings_by_date(null, $i, $y); |
|
152 | 152 | $earnings_totals += $earnings; |
153 | 153 | |
154 | - if ( $i == $month_end ) { |
|
154 | + if ($i == $month_end) { |
|
155 | 155 | |
156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; |
|
165 | - $sales_data[] = array( $date, $sales ); |
|
166 | - $earnings_data[] = array( $date, $earnings ); |
|
164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; |
|
165 | + $sales_data[] = array($date, $sales); |
|
166 | + $earnings_data[] = array($date, $earnings); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | - $i ++; |
|
170 | + $i++; |
|
171 | 171 | |
172 | 172 | endwhile; |
173 | 173 | |
174 | - $y ++; |
|
174 | + $y++; |
|
175 | 175 | endwhile; |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | $data = array( |
180 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
181 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
180 | + esc_html__('Income', 'give') => $earnings_data, |
|
181 | + esc_html__('Donations', 'give') => $sales_data |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | // start our own output buffer |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | <div class="inside"> |
192 | 192 | <?php give_reports_graph_controls(); ?> |
193 | 193 | <?php |
194 | - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) ); |
|
195 | - $graph->set( 'x_mode', 'time' ); |
|
196 | - $graph->set( 'multiple_y_axes', true ); |
|
194 | + $graph = new Give_Graph($data, array('dataType' => array('amount', 'count'))); |
|
195 | + $graph->set('x_mode', 'time'); |
|
196 | + $graph->set('multiple_y_axes', true); |
|
197 | 197 | $graph->display(); |
198 | 198 | |
199 | - if ( 'this_month' == $dates['range'] ) { |
|
199 | + if ('this_month' == $dates['range']) { |
|
200 | 200 | $estimated = give_estimated_monthly_stats(); |
201 | 201 | } |
202 | 202 | ?> |
@@ -205,21 +205,21 @@ discard block |
||
205 | 205 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
209 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td> |
|
208 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
209 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td> |
|
210 | 210 | </tr> |
211 | 211 | <tr class="alternate"> |
212 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th> |
|
212 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th> |
|
213 | 213 | <td><?php echo $sales_totals; ?></td> |
214 | 214 | </tr> |
215 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
215 | + <?php if ('this_month' == $dates['range']) : ?> |
|
216 | 216 | <tr> |
217 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th> |
|
218 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td> |
|
217 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th> |
|
218 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'], array('sanitize' => false))); ?></td> |
|
219 | 219 | </tr> |
220 | 220 | <tr class="alternate"> |
221 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th> |
|
222 | - <td><?php echo floor( $estimated['sales'] ); ?></td> |
|
221 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th> |
|
222 | + <td><?php echo floor($estimated['sales']); ?></td> |
|
223 | 223 | </tr> |
224 | 224 | <?php endif; ?> |
225 | 225 | </table> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0 |
234 | 234 | */ |
235 | - do_action( 'give_reports_graph_additional_stats' ); |
|
235 | + do_action('give_reports_graph_additional_stats'); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | </div> |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @since 1.0 |
252 | 252 | * @return void |
253 | 253 | */ |
254 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
254 | +function give_reports_graph_of_form($form_id = 0) { |
|
255 | 255 | // Retrieve the queried dates |
256 | 256 | $dates = give_get_report_dates(); |
257 | 257 | |
258 | 258 | // Determine graph options |
259 | - switch ( $dates['range'] ) : |
|
259 | + switch ($dates['range']) : |
|
260 | 260 | case 'today' : |
261 | 261 | case 'yesterday' : |
262 | 262 | $day_by_day = true; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $day_by_day = false; |
275 | 275 | break; |
276 | 276 | case 'other' : |
277 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
277 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
278 | 278 | $day_by_day = false; |
279 | 279 | } else { |
280 | 280 | $day_by_day = true; |
@@ -286,75 +286,75 @@ discard block |
||
286 | 286 | endswitch; |
287 | 287 | |
288 | 288 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
289 | - $sales_totals = 0; // Total sales for time period shown |
|
289 | + $sales_totals = 0; // Total sales for time period shown |
|
290 | 290 | |
291 | 291 | $earnings_data = array(); |
292 | 292 | $sales_data = array(); |
293 | 293 | $stats = new Give_Payment_Stats; |
294 | 294 | |
295 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
295 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
296 | 296 | |
297 | 297 | // Hour by hour |
298 | 298 | $month = $dates['m_start']; |
299 | 299 | $hour = 1; |
300 | 300 | $minute = 0; |
301 | 301 | $second = 0; |
302 | - while ( $hour <= 23 ) : |
|
302 | + while ($hour <= 23) : |
|
303 | 303 | |
304 | - if ( $hour == 23 ) { |
|
304 | + if ($hour == 23) { |
|
305 | 305 | $minute = $second = 59; |
306 | 306 | } |
307 | 307 | |
308 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
309 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
308 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
309 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
310 | 310 | |
311 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
311 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
312 | 312 | $sales_totals += $sales; |
313 | 313 | |
314 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
314 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
315 | 315 | $earnings_totals += $earnings; |
316 | 316 | |
317 | - $sales_data[] = array( $date * 1000, $sales ); |
|
318 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
317 | + $sales_data[] = array($date * 1000, $sales); |
|
318 | + $earnings_data[] = array($date * 1000, $earnings); |
|
319 | 319 | |
320 | - $hour ++; |
|
320 | + $hour++; |
|
321 | 321 | endwhile; |
322 | 322 | |
323 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
323 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
324 | 324 | |
325 | 325 | //Day by day |
326 | 326 | $day = $dates['day']; |
327 | 327 | $day_end = $dates['day_end']; |
328 | 328 | $month = $dates['m_start']; |
329 | - while ( $day <= $day_end ) : |
|
329 | + while ($day <= $day_end) : |
|
330 | 330 | |
331 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
332 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
333 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
331 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
332 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
333 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
334 | 334 | $sales_totals += $sales; |
335 | 335 | |
336 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
336 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
337 | 337 | $earnings_totals += $earnings; |
338 | 338 | |
339 | - $sales_data[] = array( $date * 1000, $sales ); |
|
340 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
339 | + $sales_data[] = array($date * 1000, $sales); |
|
340 | + $earnings_data[] = array($date * 1000, $earnings); |
|
341 | 341 | |
342 | - $day ++; |
|
342 | + $day++; |
|
343 | 343 | endwhile; |
344 | 344 | |
345 | 345 | } else { |
346 | 346 | |
347 | 347 | $y = $dates['year']; |
348 | 348 | |
349 | - while ( $y <= $dates['year_end'] ) : |
|
349 | + while ($y <= $dates['year_end']) : |
|
350 | 350 | |
351 | 351 | $last_year = false; |
352 | 352 | |
353 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
353 | + if ($dates['year'] == $dates['year_end']) { |
|
354 | 354 | $month_start = $dates['m_start']; |
355 | 355 | $month_end = $dates['m_end']; |
356 | 356 | $last_year = true; |
357 | - } elseif ( $y == $dates['year'] ) { |
|
357 | + } elseif ($y == $dates['year']) { |
|
358 | 358 | $month_start = $dates['m_start']; |
359 | 359 | $month_end = 12; |
360 | 360 | } else { |
@@ -363,76 +363,76 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | $i = $month_start; |
366 | - while ( $i <= $month_end ) : |
|
366 | + while ($i <= $month_end) : |
|
367 | 367 | |
368 | - if ( $day_by_day ) { |
|
368 | + if ($day_by_day) { |
|
369 | 369 | |
370 | - if ( $i == $month_end && $last_year ) { |
|
370 | + if ($i == $month_end && $last_year) { |
|
371 | 371 | |
372 | 372 | $num_of_days = $dates['day_end']; |
373 | 373 | |
374 | 374 | } else { |
375 | 375 | |
376 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
376 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
377 | 377 | |
378 | 378 | } |
379 | 379 | |
380 | 380 | $d = $dates['day']; |
381 | - while ( $d <= $num_of_days ) : |
|
381 | + while ($d <= $num_of_days) : |
|
382 | 382 | |
383 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
384 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
383 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
384 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
385 | 385 | |
386 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
386 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
387 | 387 | $sales_totals += $sales; |
388 | 388 | |
389 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
389 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
390 | 390 | $earnings_totals += $earnings; |
391 | 391 | |
392 | - $sales_data[] = array( $date * 1000, $sales ); |
|
393 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
394 | - $d ++; |
|
392 | + $sales_data[] = array($date * 1000, $sales); |
|
393 | + $earnings_data[] = array($date * 1000, $earnings); |
|
394 | + $d++; |
|
395 | 395 | |
396 | 396 | endwhile; |
397 | 397 | |
398 | 398 | } else { |
399 | 399 | |
400 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
400 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
401 | 401 | |
402 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
403 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
402 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
403 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
404 | 404 | |
405 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
405 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
406 | 406 | $sales_totals += $sales; |
407 | 407 | |
408 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
408 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
409 | 409 | $earnings_totals += $earnings; |
410 | 410 | |
411 | - $sales_data[] = array( $date * 1000, $sales ); |
|
412 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
411 | + $sales_data[] = array($date * 1000, $sales); |
|
412 | + $earnings_data[] = array($date * 1000, $earnings); |
|
413 | 413 | |
414 | 414 | } |
415 | 415 | |
416 | - $i ++; |
|
416 | + $i++; |
|
417 | 417 | |
418 | 418 | endwhile; |
419 | 419 | |
420 | - $y ++; |
|
420 | + $y++; |
|
421 | 421 | endwhile; |
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | 425 | $data = array( |
426 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
427 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
426 | + esc_html__('Income', 'give') => $earnings_data, |
|
427 | + esc_html__('Donations', 'give') => $sales_data |
|
428 | 428 | ); |
429 | 429 | |
430 | 430 | ?> |
431 | 431 | <h3><span><?php |
432 | 432 | printf( |
433 | 433 | /* translators: %s: form title */ |
434 | - esc_html__( 'Income Report for %s', 'give' ), |
|
435 | - get_the_title( $form_id ) |
|
434 | + esc_html__('Income Report for %s', 'give'), |
|
435 | + get_the_title($form_id) |
|
436 | 436 | ); |
437 | 437 | ?></span></h3> |
438 | 438 | <div id="give-dashboard-widgets-wrap"> |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | <div class="inside"> |
442 | 442 | <?php give_reports_graph_controls(); ?> |
443 | 443 | <?php |
444 | - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) ); |
|
445 | - $graph->set( 'x_mode', 'time' ); |
|
446 | - $graph->set( 'multiple_y_axes', true ); |
|
444 | + $graph = new Give_Graph($data, array('dataType' => array('amount', 'count'))); |
|
445 | + $graph->set('x_mode', 'time'); |
|
446 | + $graph->set('multiple_y_axes', true); |
|
447 | 447 | $graph->display(); |
448 | 448 | ?> |
449 | 449 | </div> |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
453 | 453 | <tbody> |
454 | 454 | <tr> |
455 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
456 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td> |
|
455 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
456 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <tr class="alternate"> |
459 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th> |
|
459 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th> |
|
460 | 460 | <td><?php echo $sales_totals; ?></td> |
461 | 461 | </tr> |
462 | 462 | <tr> |
463 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th> |
|
464 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td> |
|
463 | + <th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th> |
|
464 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id), array('sanitize' => false))); ?></td> |
|
465 | 465 | </tr> |
466 | 466 | <tr class="alternate"> |
467 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th> |
|
468 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
467 | + <th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th> |
|
468 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
469 | 469 | </tr> |
470 | 470 | </tbody> |
471 | 471 | </table> |
@@ -484,26 +484,26 @@ discard block |
||
484 | 484 | * @return void |
485 | 485 | */ |
486 | 486 | function give_reports_graph_controls() { |
487 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
488 | - 'today' => esc_html__( 'Today', 'give' ), |
|
489 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
490 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
491 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
492 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
493 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
494 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
495 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
496 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
497 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
498 | - 'other' => esc_html__( 'Custom', 'give' ) |
|
499 | - ) ); |
|
487 | + $date_options = apply_filters('give_report_date_options', array( |
|
488 | + 'today' => esc_html__('Today', 'give'), |
|
489 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
490 | + 'this_week' => esc_html__('This Week', 'give'), |
|
491 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
492 | + 'this_month' => esc_html__('This Month', 'give'), |
|
493 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
494 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
495 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
496 | + 'this_year' => esc_html__('This Year', 'give'), |
|
497 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
498 | + 'other' => esc_html__('Custom', 'give') |
|
499 | + )); |
|
500 | 500 | |
501 | 501 | $dates = give_get_report_dates(); |
502 | 502 | $display = $dates['range'] == 'other' ? '' : 'display: none;'; |
503 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
503 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
504 | 504 | |
505 | - if ( empty( $dates['day_end'] ) ) { |
|
506 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
505 | + if (empty($dates['day_end'])) { |
|
506 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * |
512 | 512 | * @since 1.0 |
513 | 513 | */ |
514 | - do_action( 'give_report_graph_controls_before' ); |
|
514 | + do_action('give_report_graph_controls_before'); |
|
515 | 515 | ?> |
516 | 516 | <form id="give-graphs-filter" method="get"> |
517 | 517 | <div class="tablenav top"> |
@@ -519,56 +519,56 @@ discard block |
||
519 | 519 | |
520 | 520 | <input type="hidden" name="post_type" value="give_forms" /> |
521 | 521 | <input type="hidden" name="page" value="give-reports" /> |
522 | - <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> |
|
522 | + <input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" /> |
|
523 | 523 | |
524 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
525 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
524 | + <?php if (isset($_GET['form-id'])) : ?> |
|
525 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
526 | 526 | <?php endif; ?> |
527 | 527 | |
528 | 528 | <div id="give-graphs-date-options-wrap"> |
529 | 529 | <select id="give-graphs-date-options" name="range"> |
530 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
531 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> |
|
530 | + <?php foreach ($date_options as $key => $option) : ?> |
|
531 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> |
|
532 | 532 | <?php endforeach; ?> |
533 | 533 | </select> |
534 | 534 | |
535 | - <div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>"> |
|
536 | - <span class="screen-reader-text"><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <div id="give-date-range-options" style="<?php echo esc_attr($display); ?>"> |
|
536 | + <span class="screen-reader-text"><?php esc_html_e('From', 'give'); ?> </span> |
|
537 | 537 | <select id="give-graphs-month-start" name="m_start" aria-label="Start Month"> |
538 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
539 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
538 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
539 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
540 | 540 | <?php endfor; ?> |
541 | 541 | </select> |
542 | 542 | <select id="give-graphs-day-start" name="day" aria-label="Start Day"> |
543 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
544 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
543 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
544 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option> |
|
545 | 545 | <?php endfor; ?> |
546 | 546 | </select> |
547 | 547 | <select id="give-graphs-year-start" name="year" aria-label="Start Year"> |
548 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
549 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
548 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
549 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option> |
|
550 | 550 | <?php endfor; ?> |
551 | 551 | </select> |
552 | - <span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
552 | + <span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?> </span> |
|
553 | 553 | <span>–</span> |
554 | 554 | <select id="give-graphs-month-end" name="m_end" aria-label="End Month"> |
555 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
556 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
555 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
556 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
557 | 557 | <?php endfor; ?> |
558 | 558 | </select> |
559 | 559 | <select id="give-graphs-day-end" name="day_end" aria-label="End Day"> |
560 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
561 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
560 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
561 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option> |
|
562 | 562 | <?php endfor; ?> |
563 | 563 | </select> |
564 | 564 | <select id="give-graphs-year-end" name="year_end" aria-label="End Year"> |
565 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
566 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
565 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
566 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option> |
|
567 | 567 | <?php endfor; ?> |
568 | 568 | </select> |
569 | 569 | </div> |
570 | 570 | |
571 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
571 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
572 | 572 | </div> |
573 | 573 | |
574 | 574 | <input type="hidden" name="give_action" value="filter_reports" /> |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @since 1.0 |
583 | 583 | */ |
584 | - do_action( 'give_report_graph_controls_after' ); |
|
584 | + do_action('give_report_graph_controls_after'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -596,65 +596,65 @@ discard block |
||
596 | 596 | function give_get_report_dates() { |
597 | 597 | $dates = array(); |
598 | 598 | |
599 | - $current_time = current_time( 'timestamp' ); |
|
599 | + $current_time = current_time('timestamp'); |
|
600 | 600 | |
601 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
602 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
603 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
604 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
605 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
606 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
607 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
601 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
602 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
603 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
604 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
605 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
606 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
607 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
608 | 608 | |
609 | 609 | // Modify dates based on predefined ranges |
610 | - switch ( $dates['range'] ) : |
|
610 | + switch ($dates['range']) : |
|
611 | 611 | |
612 | 612 | case 'this_month' : |
613 | - $dates['m_start'] = date( 'n', $current_time ); |
|
614 | - $dates['m_end'] = date( 'n', $current_time ); |
|
613 | + $dates['m_start'] = date('n', $current_time); |
|
614 | + $dates['m_end'] = date('n', $current_time); |
|
615 | 615 | $dates['day'] = 1; |
616 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
617 | - $dates['year'] = date( 'Y' ); |
|
618 | - $dates['year_end'] = date( 'Y' ); |
|
616 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
617 | + $dates['year'] = date('Y'); |
|
618 | + $dates['year_end'] = date('Y'); |
|
619 | 619 | break; |
620 | 620 | |
621 | 621 | case 'last_month' : |
622 | - if ( date( 'n' ) == 1 ) { |
|
622 | + if (date('n') == 1) { |
|
623 | 623 | $dates['m_start'] = 12; |
624 | 624 | $dates['m_end'] = 12; |
625 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
626 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
625 | + $dates['year'] = date('Y', $current_time) - 1; |
|
626 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
627 | 627 | } else { |
628 | - $dates['m_start'] = date( 'n' ) - 1; |
|
629 | - $dates['m_end'] = date( 'n' ) - 1; |
|
628 | + $dates['m_start'] = date('n') - 1; |
|
629 | + $dates['m_end'] = date('n') - 1; |
|
630 | 630 | $dates['year_end'] = $dates['year']; |
631 | 631 | } |
632 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
632 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
633 | 633 | break; |
634 | 634 | |
635 | 635 | case 'today' : |
636 | - $dates['day'] = date( 'd', $current_time ); |
|
637 | - $dates['m_start'] = date( 'n', $current_time ); |
|
638 | - $dates['m_end'] = date( 'n', $current_time ); |
|
639 | - $dates['year'] = date( 'Y', $current_time ); |
|
636 | + $dates['day'] = date('d', $current_time); |
|
637 | + $dates['m_start'] = date('n', $current_time); |
|
638 | + $dates['m_end'] = date('n', $current_time); |
|
639 | + $dates['year'] = date('Y', $current_time); |
|
640 | 640 | break; |
641 | 641 | |
642 | 642 | case 'yesterday' : |
643 | 643 | |
644 | - $year = date( 'Y', $current_time ); |
|
645 | - $month = date( 'n', $current_time ); |
|
646 | - $day = date( 'd', $current_time ); |
|
644 | + $year = date('Y', $current_time); |
|
645 | + $month = date('n', $current_time); |
|
646 | + $day = date('d', $current_time); |
|
647 | 647 | |
648 | - if ( $month == 1 && $day == 1 ) { |
|
648 | + if ($month == 1 && $day == 1) { |
|
649 | 649 | |
650 | 650 | $year -= 1; |
651 | 651 | $month = 12; |
652 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
652 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
653 | 653 | |
654 | - } elseif ( $month > 1 && $day == 1 ) { |
|
654 | + } elseif ($month > 1 && $day == 1) { |
|
655 | 655 | |
656 | 656 | $month -= 1; |
657 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
657 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
658 | 658 | |
659 | 659 | } else { |
660 | 660 | |
@@ -670,91 +670,91 @@ discard block |
||
670 | 670 | break; |
671 | 671 | |
672 | 672 | case 'this_week' : |
673 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
674 | - $dates['day'] += get_option( 'start_of_week' ); |
|
673 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
674 | + $dates['day'] += get_option('start_of_week'); |
|
675 | 675 | $dates['day_end'] = $dates['day'] + 6; |
676 | - $dates['m_start'] = date( 'n', $current_time ); |
|
677 | - $dates['m_end'] = date( 'n', $current_time ); |
|
678 | - $dates['year'] = date( 'Y', $current_time ); |
|
676 | + $dates['m_start'] = date('n', $current_time); |
|
677 | + $dates['m_end'] = date('n', $current_time); |
|
678 | + $dates['year'] = date('Y', $current_time); |
|
679 | 679 | break; |
680 | 680 | |
681 | 681 | case 'last_week' : |
682 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
683 | - $dates['day'] += get_option( 'start_of_week' ); |
|
682 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
683 | + $dates['day'] += get_option('start_of_week'); |
|
684 | 684 | $dates['day_end'] = $dates['day'] + 6; |
685 | - $dates['year'] = date( 'Y' ); |
|
686 | - |
|
687 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
688 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
689 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
690 | - if ( $dates['m_start'] <= 1 ) { |
|
691 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
692 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
685 | + $dates['year'] = date('Y'); |
|
686 | + |
|
687 | + if (date('j', $current_time) <= 7) { |
|
688 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
689 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
690 | + if ($dates['m_start'] <= 1) { |
|
691 | + $dates['year'] = date('Y', $current_time) - 1; |
|
692 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
693 | 693 | } |
694 | 694 | } else { |
695 | - $dates['m_start'] = date( 'n', $current_time ); |
|
696 | - $dates['m_end'] = date( 'n', $current_time ); |
|
695 | + $dates['m_start'] = date('n', $current_time); |
|
696 | + $dates['m_end'] = date('n', $current_time); |
|
697 | 697 | } |
698 | 698 | break; |
699 | 699 | |
700 | 700 | case 'this_quarter' : |
701 | - $month_now = date( 'n', $current_time ); |
|
701 | + $month_now = date('n', $current_time); |
|
702 | 702 | |
703 | - if ( $month_now <= 3 ) { |
|
703 | + if ($month_now <= 3) { |
|
704 | 704 | |
705 | 705 | $dates['m_start'] = 1; |
706 | 706 | $dates['m_end'] = 4; |
707 | - $dates['year'] = date( 'Y', $current_time ); |
|
707 | + $dates['year'] = date('Y', $current_time); |
|
708 | 708 | |
709 | - } else if ( $month_now <= 6 ) { |
|
709 | + } else if ($month_now <= 6) { |
|
710 | 710 | |
711 | 711 | $dates['m_start'] = 4; |
712 | 712 | $dates['m_end'] = 7; |
713 | - $dates['year'] = date( 'Y', $current_time ); |
|
713 | + $dates['year'] = date('Y', $current_time); |
|
714 | 714 | |
715 | - } else if ( $month_now <= 9 ) { |
|
715 | + } else if ($month_now <= 9) { |
|
716 | 716 | |
717 | 717 | $dates['m_start'] = 7; |
718 | 718 | $dates['m_end'] = 10; |
719 | - $dates['year'] = date( 'Y', $current_time ); |
|
719 | + $dates['year'] = date('Y', $current_time); |
|
720 | 720 | |
721 | 721 | } else { |
722 | 722 | |
723 | 723 | $dates['m_start'] = 10; |
724 | 724 | $dates['m_end'] = 1; |
725 | - $dates['year'] = date( 'Y', $current_time ); |
|
726 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
725 | + $dates['year'] = date('Y', $current_time); |
|
726 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | break; |
730 | 730 | |
731 | 731 | case 'last_quarter' : |
732 | - $month_now = date( 'n' ); |
|
732 | + $month_now = date('n'); |
|
733 | 733 | |
734 | - if ( $month_now <= 3 ) { |
|
734 | + if ($month_now <= 3) { |
|
735 | 735 | |
736 | 736 | $dates['m_start'] = 10; |
737 | 737 | $dates['m_end'] = 12; |
738 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
739 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
738 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
739 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
740 | 740 | |
741 | - } else if ( $month_now <= 6 ) { |
|
741 | + } else if ($month_now <= 6) { |
|
742 | 742 | |
743 | 743 | $dates['m_start'] = 1; |
744 | 744 | $dates['m_end'] = 3; |
745 | - $dates['year'] = date( 'Y', $current_time ); |
|
745 | + $dates['year'] = date('Y', $current_time); |
|
746 | 746 | |
747 | - } else if ( $month_now <= 9 ) { |
|
747 | + } else if ($month_now <= 9) { |
|
748 | 748 | |
749 | 749 | $dates['m_start'] = 4; |
750 | 750 | $dates['m_end'] = 6; |
751 | - $dates['year'] = date( 'Y', $current_time ); |
|
751 | + $dates['year'] = date('Y', $current_time); |
|
752 | 752 | |
753 | 753 | } else { |
754 | 754 | |
755 | 755 | $dates['m_start'] = 7; |
756 | 756 | $dates['m_end'] = 9; |
757 | - $dates['year'] = date( 'Y', $current_time ); |
|
757 | + $dates['year'] = date('Y', $current_time); |
|
758 | 758 | |
759 | 759 | } |
760 | 760 | break; |
@@ -762,19 +762,19 @@ discard block |
||
762 | 762 | case 'this_year' : |
763 | 763 | $dates['m_start'] = 1; |
764 | 764 | $dates['m_end'] = 12; |
765 | - $dates['year'] = date( 'Y', $current_time ); |
|
765 | + $dates['year'] = date('Y', $current_time); |
|
766 | 766 | break; |
767 | 767 | |
768 | 768 | case 'last_year' : |
769 | 769 | $dates['m_start'] = 1; |
770 | 770 | $dates['m_end'] = 12; |
771 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
772 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
771 | + $dates['year'] = date('Y', $current_time) - 1; |
|
772 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
773 | 773 | break; |
774 | 774 | |
775 | 775 | endswitch; |
776 | 776 | |
777 | - return apply_filters( 'give_report_dates', $dates ); |
|
777 | + return apply_filters('give_report_dates', $dates); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -785,18 +785,18 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @param $data |
787 | 787 | */ |
788 | -function give_parse_report_dates( $data ) { |
|
788 | +function give_parse_report_dates($data) { |
|
789 | 789 | $dates = give_get_report_dates(); |
790 | 790 | |
791 | 791 | $view = give_get_reporting_view(); |
792 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
793 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
792 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
793 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
794 | 794 | |
795 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
795 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
796 | 796 | give_die(); |
797 | 797 | } |
798 | 798 | |
799 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
799 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
800 | 800 | |
801 | 801 | |
802 | 802 | /** |
@@ -808,22 +808,22 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function give_reports_refresh_button() { |
810 | 810 | |
811 | - $url = wp_nonce_url( add_query_arg( array( |
|
811 | + $url = wp_nonce_url(add_query_arg(array( |
|
812 | 812 | 'give_action' => 'refresh_reports_transients', |
813 | 813 | 'give-message' => 'refreshed-reports' |
814 | - ) ), 'give-refresh-reports' ); |
|
814 | + )), 'give-refresh-reports'); |
|
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
817 | + . esc_url_raw($url) |
|
818 | + . '" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give') |
|
819 | 819 | . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
820 | 820 | . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
821 | + . esc_html__('Refresh Report Data', 'give') |
|
822 | 822 | . '</a>'; |
823 | 823 | |
824 | 824 | } |
825 | 825 | |
826 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
826 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
827 | 827 | |
828 | 828 | /** |
829 | 829 | * Trigger the refresh of reports transients |
@@ -834,20 +834,20 @@ discard block |
||
834 | 834 | * |
835 | 835 | * @return void |
836 | 836 | */ |
837 | -function give_run_refresh_reports_transients( $data ) { |
|
837 | +function give_run_refresh_reports_transients($data) { |
|
838 | 838 | |
839 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
839 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
840 | 840 | return; |
841 | 841 | } |
842 | 842 | |
843 | 843 | // Monthly stats. |
844 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
844 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
845 | 845 | |
846 | 846 | // Total earning. |
847 | - delete_option( 'give_earnings_total' ); |
|
847 | + delete_option('give_earnings_total'); |
|
848 | 848 | |
849 | 849 | // @todo: Refresh only range related stat cache |
850 | 850 | give_delete_donation_stats(); |
851 | 851 | } |
852 | 852 | |
853 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
854 | 853 | \ No newline at end of file |
854 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
855 | 855 | \ No newline at end of file |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Earnings_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Earnings_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Earnings_Report. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'earnings'; |
46 | - $this->label = esc_html__( 'Income', 'give' ); |
|
46 | + $this->label = esc_html__('Income', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_tools_earnings', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'earnings', |
98 | - 'name' => esc_html__( 'Income', 'give' ), |
|
98 | + 'name' => esc_html__('Income', 'give'), |
|
99 | 99 | 'type' => 'report_earnings', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_earnings_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_earnings' ); |
|
134 | + public function render_report_earnings_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_earnings'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Forms_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Forms_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Forms_Report. |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'forms'; |
46 | - $this->label = esc_html__( 'Forms', 'give' ); |
|
46 | + $this->label = esc_html__('Forms', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param array $pages List of pages. |
59 | 59 | * @return array |
60 | 60 | */ |
61 | - public function add_settings_page( $pages ) { |
|
62 | - $pages[ $this->id ] = $this->label; |
|
61 | + public function add_settings_page($pages) { |
|
62 | + $pages[$this->id] = $this->label; |
|
63 | 63 | |
64 | 64 | return $pages; |
65 | 65 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param array $settings |
82 | 82 | */ |
83 | 83 | $settings = apply_filters( |
84 | - 'give_get_settings_' . $this->id, |
|
84 | + 'give_get_settings_'.$this->id, |
|
85 | 85 | array( |
86 | 86 | array( |
87 | 87 | 'id' => 'give_reports_forms', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ), |
91 | 91 | array( |
92 | 92 | 'id' => 'forms', |
93 | - 'name' => esc_html__( 'Forms', 'give' ), |
|
93 | + 'name' => esc_html__('Forms', 'give'), |
|
94 | 94 | 'type' => 'report_forms', |
95 | 95 | ), |
96 | 96 | array( |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function output() { |
115 | 115 | $settings = $this->get_settings(); |
116 | 116 | |
117 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
117 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @param $field |
127 | 127 | * @param $option_value |
128 | 128 | */ |
129 | - public function render_report_forms_field( $field, $option_value ) { |
|
130 | - do_action( 'give_reports_view_forms'); |
|
129 | + public function render_report_forms_field($field, $option_value) { |
|
130 | + do_action('give_reports_view_forms'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 |