@@ -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 |
@@ -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_Donors_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Donors_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Donors_Report. |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'donors'; |
46 | - $this->label = esc_html__( 'Donors', 'give' ); |
|
46 | + $this->label = esc_html__('Donors', '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_donors', array( $this, 'render_report_donors_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_donors', array($this, 'render_report_donors_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_donors', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ), |
91 | 91 | array( |
92 | 92 | 'id' => 'donors', |
93 | - 'name' => esc_html__( 'Donors', 'give' ), |
|
93 | + 'name' => esc_html__('Donors', 'give'), |
|
94 | 94 | 'type' => 'report_donors', |
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_donors_field( $field, $option_value ) { |
|
130 | - do_action( 'give_reports_view_donors'); |
|
129 | + public function render_report_donors_field($field, $option_value) { |
|
130 | + do_action('give_reports_view_donors'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'donors' => esc_html__('Donors', 'give'), |
|
106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
107 | 107 | ); |
108 | 108 | |
109 | - $views = apply_filters( 'give_report_views', $views ); |
|
109 | + $views = apply_filters('give_report_views', $views); |
|
110 | 110 | |
111 | 111 | return $views; |
112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * @since 1.0 |
122 | 122 | * @return string $view Report View |
123 | 123 | */ |
124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
124 | +function give_get_reporting_view($default = 'earnings') { |
|
125 | 125 | |
126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
127 | 127 | $view = $default; |
128 | 128 | } else { |
129 | 129 | $view = $_GET['view']; |
130 | 130 | } |
131 | 131 | |
132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
132 | + return apply_filters('give_get_reporting_view', $view); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $current_view = 'earnings'; |
143 | 143 | $views = give_reports_default_views(); |
144 | 144 | |
145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
146 | 146 | $current_view = $_GET['tab']; |
147 | 147 | } |
148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( "give_reports_view_{$current_view}" ); |
|
154 | + do_action("give_reports_view_{$current_view}"); |
|
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function give_report_views() { |
166 | 166 | $views = give_reports_default_views(); |
167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
168 | 168 | /** |
169 | 169 | * Fires before the report page actions form. |
170 | 170 | * |
171 | 171 | * @since 1.0 |
172 | 172 | */ |
173 | - do_action( 'give_report_view_actions_before' ); |
|
173 | + do_action('give_report_view_actions_before'); |
|
174 | 174 | ?> |
175 | 175 | <form id="give-reports-filter" method="get"> |
176 | 176 | <select id="give-reports-view" name="view"> |
177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
180 | 180 | <?php endforeach; ?> |
181 | 181 | </select> |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_report_view_actions' ); |
|
191 | + do_action('give_report_view_actions'); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
197 | 197 | </form> |
198 | 198 | <?php |
199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @since 1.0 |
203 | 203 | */ |
204 | - do_action( 'give_report_view_actions_after' ); |
|
204 | + do_action('give_report_view_actions_after'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function give_reports_forms_table() { |
216 | 216 | |
217 | - if ( isset( $_GET['form-id'] ) ) { |
|
217 | + if (isset($_GET['form-id'])) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
222 | 222 | |
223 | 223 | $give_table = new Give_Form_Reports_Table(); |
224 | 224 | $give_table->prepare_items(); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
233 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Renders the detailed report for a specific give form. |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | * @return void |
240 | 240 | */ |
241 | 241 | function give_reports_form_details() { |
242 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
242 | + if ( ! isset($_GET['form-id'])) { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | ?> |
246 | 246 | <div class="tablenav top reports-forms-details-wrap"> |
247 | 247 | <div class="actions bulkactions"> |
248 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
248 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
249 | 249 | </div> |
250 | 250 | </div> |
251 | 251 | <?php |
252 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
252 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
255 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Renders the Reports Donors Table |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return void |
264 | 264 | */ |
265 | 265 | function give_reports_donors_table() { |
266 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
266 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
267 | 267 | |
268 | 268 | $give_table = new Give_Donor_Reports_Table(); |
269 | 269 | $give_table->prepare_items(); |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @since 1.0 |
277 | 277 | */ |
278 | - do_action( 'give_logs_donors_table_top' ); |
|
278 | + do_action('give_logs_donors_table_top'); |
|
279 | 279 | |
280 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
280 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
281 | 281 | $give_table->display(); |
282 | 282 | ?> |
283 | 283 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @since 1.0 |
292 | 292 | */ |
293 | - do_action( 'give_logs_donors_table_bottom' ); |
|
293 | + do_action('give_logs_donors_table_bottom'); |
|
294 | 294 | ?> |
295 | 295 | </div> |
296 | 296 | <?php |
297 | 297 | } |
298 | 298 | |
299 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
299 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Renders the Gateways Table |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | * @return void |
308 | 308 | */ |
309 | 309 | function give_reports_gateways_table() { |
310 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
310 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
311 | 311 | |
312 | 312 | $give_table = new Give_Gateway_Reports_Table(); |
313 | 313 | $give_table->prepare_items(); |
314 | 314 | $give_table->display(); |
315 | 315 | } |
316 | 316 | |
317 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
317 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Renders the Reports Earnings Graphs |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | function give_reports_earnings() { |
326 | 326 | ?> |
327 | 327 | <div class="tablenav top reports-table-nav"> |
328 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
328 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
329 | 329 | </div> |
330 | 330 | <?php |
331 | 331 | give_reports_graph(); |
332 | 332 | } |
333 | 333 | |
334 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
334 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
335 | 335 | |
336 | 336 | |
337 | 337 | /** |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function give_estimated_monthly_stats() { |
344 | 344 | |
345 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
345 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
346 | 346 | |
347 | - if ( false === $estimated ) { |
|
347 | + if (false === $estimated) { |
|
348 | 348 | |
349 | 349 | $estimated = array( |
350 | 350 | 'earnings' => 0, |
@@ -353,22 +353,22 @@ discard block |
||
353 | 353 | |
354 | 354 | $stats = new Give_Payment_Stats; |
355 | 355 | |
356 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
357 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
356 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
357 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
358 | 358 | |
359 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
360 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
361 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
362 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
359 | + $current_day = date('d', current_time('timestamp')); |
|
360 | + $current_month = date('n', current_time('timestamp')); |
|
361 | + $current_year = date('Y', current_time('timestamp')); |
|
362 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
363 | 363 | |
364 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
365 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
364 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
365 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
366 | 366 | |
367 | 367 | // Cache for one day |
368 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
368 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
369 | 369 | } |
370 | 370 | |
371 | - return maybe_unserialize( $estimated ); |
|
371 | + return maybe_unserialize($estimated); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | function give_reports_set_form_method() { |
382 | 382 | return 'get'; |
383 | 383 | } |
384 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
385 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
384 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
385 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
386 | 386 | |
387 | 387 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
33 | 33 | |
34 | 34 | //Payments |
35 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
36 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
35 | + $give_payment = get_post_type_object('give_payment'); |
|
36 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
37 | 37 | |
38 | 38 | //Donors |
39 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
|
39 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page'); |
|
40 | 40 | |
41 | 41 | //Reports` |
42 | 42 | $give_reports_page = add_submenu_page( |
43 | 43 | 'edit.php?post_type=give_forms', |
44 | - esc_html__( 'Donation Reports', 'give' ), |
|
45 | - esc_html__( 'Reports', 'give' ), |
|
44 | + esc_html__('Donation Reports', 'give'), |
|
45 | + esc_html__('Reports', 'give'), |
|
46 | 46 | 'view_give_reports', |
47 | 47 | 'give-reports', |
48 | 48 | array( |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | //Settings |
55 | 55 | $give_settings_page = add_submenu_page( |
56 | 56 | 'edit.php?post_type=give_forms', |
57 | - esc_html__( 'Give Settings', 'give' ), |
|
58 | - esc_html__( 'Settings', 'give' ), |
|
57 | + esc_html__('Give Settings', 'give'), |
|
58 | + esc_html__('Settings', 'give'), |
|
59 | 59 | 'manage_give_settings', |
60 | 60 | 'give-settings', |
61 | 61 | array( |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | //Tools. |
68 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
68 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
69 | 69 | Give()->give_settings, |
70 | 70 | 'output' |
71 | - ) ); |
|
71 | + )); |
|
72 | 72 | |
73 | 73 | //Add-ons |
74 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
74 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
75 | 75 | } |
76 | 76 | |
77 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
77 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Determines whether the current admin page is a Give admin page. |
@@ -89,224 +89,224 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return bool True if Give admin page. |
91 | 91 | */ |
92 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
92 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
93 | 93 | |
94 | 94 | global $pagenow, $typenow; |
95 | 95 | |
96 | 96 | $found = false; |
97 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
98 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
99 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
100 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
101 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
102 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
103 | - |
|
104 | - switch ( $passed_page ) { |
|
97 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
98 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
99 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
100 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
101 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
102 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
103 | + |
|
104 | + switch ($passed_page) { |
|
105 | 105 | case 'give_forms': |
106 | - switch ( $passed_view ) { |
|
106 | + switch ($passed_view) { |
|
107 | 107 | case 'list-table': |
108 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
108 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
109 | 109 | $found = true; |
110 | 110 | } |
111 | 111 | break; |
112 | 112 | case 'edit': |
113 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
113 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
114 | 114 | $found = true; |
115 | 115 | } |
116 | 116 | break; |
117 | 117 | case 'new': |
118 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
118 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
119 | 119 | $found = true; |
120 | 120 | } |
121 | 121 | break; |
122 | 122 | default: |
123 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
123 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
124 | 124 | $found = true; |
125 | 125 | } |
126 | 126 | break; |
127 | 127 | } |
128 | 128 | break; |
129 | 129 | case 'categories': |
130 | - switch ( $passed_view ) { |
|
130 | + switch ($passed_view) { |
|
131 | 131 | case 'list-table': |
132 | 132 | case 'new': |
133 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
133 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
134 | 134 | $found = true; |
135 | 135 | } |
136 | 136 | break; |
137 | 137 | case 'edit': |
138 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
138 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
139 | 139 | $found = true; |
140 | 140 | } |
141 | 141 | break; |
142 | 142 | default: |
143 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
143 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
144 | 144 | $found = true; |
145 | 145 | } |
146 | 146 | break; |
147 | 147 | } |
148 | 148 | break; |
149 | 149 | case 'tags': |
150 | - switch ( $passed_view ) { |
|
150 | + switch ($passed_view) { |
|
151 | 151 | case 'list-table': |
152 | 152 | case 'new': |
153 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
153 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
154 | 154 | $found = true; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | case 'edit': |
158 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
158 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
159 | 159 | $found = true; |
160 | 160 | } |
161 | 161 | break; |
162 | 162 | default: |
163 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
163 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
164 | 164 | $found = true; |
165 | 165 | } |
166 | 166 | break; |
167 | 167 | } |
168 | 168 | break; |
169 | 169 | case 'payments': |
170 | - switch ( $passed_view ) { |
|
170 | + switch ($passed_view) { |
|
171 | 171 | case 'list-table': |
172 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
172 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
173 | 173 | $found = true; |
174 | 174 | } |
175 | 175 | break; |
176 | 176 | case 'edit': |
177 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
177 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
178 | 178 | $found = true; |
179 | 179 | } |
180 | 180 | break; |
181 | 181 | default: |
182 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
182 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
183 | 183 | $found = true; |
184 | 184 | } |
185 | 185 | break; |
186 | 186 | } |
187 | 187 | break; |
188 | 188 | case 'reports': |
189 | - switch ( $passed_view ) { |
|
189 | + switch ($passed_view) { |
|
190 | 190 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
191 | 191 | case 'earnings': |
192 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
192 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
193 | 193 | $found = true; |
194 | 194 | } |
195 | 195 | break; |
196 | 196 | case 'donors': |
197 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
197 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
198 | 198 | $found = true; |
199 | 199 | } |
200 | 200 | break; |
201 | 201 | case 'gateways': |
202 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
202 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
203 | 203 | $found = true; |
204 | 204 | } |
205 | 205 | break; |
206 | 206 | case 'export': |
207 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
207 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
208 | 208 | $found = true; |
209 | 209 | } |
210 | 210 | break; |
211 | 211 | case 'logs': |
212 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
212 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
213 | 213 | $found = true; |
214 | 214 | } |
215 | 215 | break; |
216 | 216 | default: |
217 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
217 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
218 | 218 | $found = true; |
219 | 219 | } |
220 | 220 | break; |
221 | 221 | } |
222 | 222 | break; |
223 | 223 | case 'settings': |
224 | - switch ( $passed_view ) { |
|
224 | + switch ($passed_view) { |
|
225 | 225 | case 'general': |
226 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
226 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
227 | 227 | $found = true; |
228 | 228 | } |
229 | 229 | break; |
230 | 230 | case 'gateways': |
231 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
231 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
232 | 232 | $found = true; |
233 | 233 | } |
234 | 234 | break; |
235 | 235 | case 'emails': |
236 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
236 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
237 | 237 | $found = true; |
238 | 238 | } |
239 | 239 | break; |
240 | 240 | case 'display': |
241 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
241 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
242 | 242 | $found = true; |
243 | 243 | } |
244 | 244 | break; |
245 | 245 | case 'licenses': |
246 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
246 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
247 | 247 | $found = true; |
248 | 248 | } |
249 | 249 | break; |
250 | 250 | case 'api': |
251 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
251 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
252 | 252 | $found = true; |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'advanced': |
256 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
256 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
257 | 257 | $found = true; |
258 | 258 | } |
259 | 259 | break; |
260 | 260 | case 'system_info': |
261 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
261 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
262 | 262 | $found = true; |
263 | 263 | } |
264 | 264 | break; |
265 | 265 | default: |
266 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
266 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
267 | 267 | $found = true; |
268 | 268 | } |
269 | 269 | break; |
270 | 270 | } |
271 | 271 | break; |
272 | 272 | case 'addons': |
273 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
273 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
274 | 274 | $found = true; |
275 | 275 | } |
276 | 276 | break; |
277 | 277 | case 'donors': |
278 | - switch ( $passed_view ) { |
|
278 | + switch ($passed_view) { |
|
279 | 279 | case 'list-table': |
280 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
280 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
281 | 281 | $found = true; |
282 | 282 | } |
283 | 283 | break; |
284 | 284 | case 'overview': |
285 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
285 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
286 | 286 | $found = true; |
287 | 287 | } |
288 | 288 | break; |
289 | 289 | case 'notes': |
290 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
290 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
291 | 291 | $found = true; |
292 | 292 | } |
293 | 293 | break; |
294 | 294 | default: |
295 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
295 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
296 | 296 | $found = true; |
297 | 297 | } |
298 | 298 | break; |
299 | 299 | } |
300 | 300 | break; |
301 | 301 | case 'reports': |
302 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
302 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
303 | 303 | $found = true; |
304 | 304 | } |
305 | 305 | break; |
306 | 306 | default: |
307 | 307 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
308 | 308 | |
309 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
309 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
310 | 310 | $give_payments_page, |
311 | 311 | $give_settings_page, |
312 | 312 | $give_reports_page, |
@@ -316,16 +316,16 @@ discard block |
||
316 | 316 | $give_donors_page, |
317 | 317 | $give_tools_page, |
318 | 318 | 'widgets.php' |
319 | - ) ); |
|
320 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
319 | + )); |
|
320 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
321 | 321 | $found = true; |
322 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
322 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
323 | 323 | $found = true; |
324 | 324 | } |
325 | 325 | break; |
326 | 326 | } |
327 | 327 | |
328 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
328 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
329 | 329 | |
330 | 330 | } |
331 | 331 | |
@@ -337,37 +337,37 @@ discard block |
||
337 | 337 | * @param array $settings |
338 | 338 | * @return array |
339 | 339 | */ |
340 | -function give_settings_page_pages( $settings ) { |
|
341 | - include( 'abstract-admin-settings-page.php' ); |
|
342 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
340 | +function give_settings_page_pages($settings) { |
|
341 | + include('abstract-admin-settings-page.php'); |
|
342 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
343 | 343 | |
344 | 344 | $settings = array( |
345 | 345 | // General settings. |
346 | - include( 'settings/class-settings-general.php' ), |
|
346 | + include('settings/class-settings-general.php'), |
|
347 | 347 | |
348 | 348 | // Payment Gateways Settings. |
349 | - include( 'settings/class-settings-gateways.php' ), |
|
349 | + include('settings/class-settings-gateways.php'), |
|
350 | 350 | |
351 | 351 | // Display settings. |
352 | - include( 'settings/class-settings-display.php' ), |
|
352 | + include('settings/class-settings-display.php'), |
|
353 | 353 | |
354 | 354 | // Emails settings. |
355 | - include( 'settings/class-settings-email.php' ), |
|
355 | + include('settings/class-settings-email.php'), |
|
356 | 356 | |
357 | 357 | // Addons settings. |
358 | - include( 'settings/class-settings-addon.php' ), |
|
358 | + include('settings/class-settings-addon.php'), |
|
359 | 359 | |
360 | 360 | // License settings. |
361 | - include( 'settings/class-settings-license.php' ), |
|
361 | + include('settings/class-settings-license.php'), |
|
362 | 362 | |
363 | 363 | // Advanced settinns. |
364 | - include( 'settings/class-settings-advanced.php' ) |
|
364 | + include('settings/class-settings-advanced.php') |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | // Output. |
368 | 368 | return $settings; |
369 | 369 | } |
370 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
370 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -377,28 +377,28 @@ discard block |
||
377 | 377 | * @param array $settings |
378 | 378 | * @return array |
379 | 379 | */ |
380 | -function give_reports_page_pages( $settings ) { |
|
381 | - include( 'abstract-admin-settings-page.php' ); |
|
380 | +function give_reports_page_pages($settings) { |
|
381 | + include('abstract-admin-settings-page.php'); |
|
382 | 382 | |
383 | 383 | $settings = array( |
384 | 384 | // Earnings. |
385 | - include( 'reports/class-earnings-report.php' ), |
|
385 | + include('reports/class-earnings-report.php'), |
|
386 | 386 | |
387 | 387 | // Forms. |
388 | - include( 'reports/class-forms-report.php' ), |
|
388 | + include('reports/class-forms-report.php'), |
|
389 | 389 | |
390 | 390 | // Donors. |
391 | - include( 'reports/class-donors-report.php' ), |
|
391 | + include('reports/class-donors-report.php'), |
|
392 | 392 | |
393 | 393 | // Gateways. |
394 | - include( 'reports/class-gateways-report.php' ), |
|
394 | + include('reports/class-gateways-report.php'), |
|
395 | 395 | |
396 | 396 | ); |
397 | 397 | |
398 | 398 | // Output. |
399 | 399 | return $settings; |
400 | 400 | } |
401 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
401 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
402 | 402 | |
403 | 403 | /** |
404 | 404 | * Add setting tab to give-settings page |
@@ -407,31 +407,31 @@ discard block |
||
407 | 407 | * @param array $settings |
408 | 408 | * @return array |
409 | 409 | */ |
410 | -function give_tools_page_pages( $settings ) { |
|
411 | - include( 'abstract-admin-settings-page.php' ); |
|
410 | +function give_tools_page_pages($settings) { |
|
411 | + include('abstract-admin-settings-page.php'); |
|
412 | 412 | |
413 | 413 | $settings = array( |
414 | 414 | // System Info. |
415 | - include( 'tools/class-settings-system-info.php' ), |
|
415 | + include('tools/class-settings-system-info.php'), |
|
416 | 416 | |
417 | 417 | // Logs. |
418 | - include( 'tools/class-settings-logs.php' ), |
|
418 | + include('tools/class-settings-logs.php'), |
|
419 | 419 | |
420 | 420 | // API. |
421 | - include( 'tools/class-settings-api.php' ), |
|
421 | + include('tools/class-settings-api.php'), |
|
422 | 422 | |
423 | 423 | // Data. |
424 | - include( 'tools/class-settings-data.php' ), |
|
424 | + include('tools/class-settings-data.php'), |
|
425 | 425 | |
426 | 426 | // Export. |
427 | - include( 'tools/class-settings-export.php' ), |
|
427 | + include('tools/class-settings-export.php'), |
|
428 | 428 | |
429 | 429 | ); |
430 | 430 | |
431 | 431 | // Output. |
432 | 432 | return $settings; |
433 | 433 | } |
434 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
434 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Set default tools page tab. |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | * @param string $default_tab Default tab name. |
441 | 441 | * @return string |
442 | 442 | */ |
443 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
443 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
444 | 444 | return 'system-info'; |
445 | 445 | } |
446 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
446 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
447 | 447 | |
448 | 448 | |
449 | 449 | /** |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param string $default_tab Default tab name. |
454 | 454 | * @return string |
455 | 455 | */ |
456 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
456 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
457 | 457 | return 'earnings'; |
458 | 458 | } |
459 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
460 | 459 | \ No newline at end of file |
460 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
461 | 461 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 1.8.12 |
61 | 61 | */ |
62 | - do_action( 'give_logs_donations_top' ); |
|
62 | + do_action('give_logs_donations_top'); |
|
63 | 63 | |
64 | 64 | $logs_table->display(); ?> |
65 | 65 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @since 1.8.12 |
75 | 75 | */ |
76 | - do_action( 'give_logs_donations_bottom' ); |
|
76 | + do_action('give_logs_donations_bottom'); |
|
77 | 77 | ?> |
78 | 78 | |
79 | 79 | </div> |
80 | 80 | <?php |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
83 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | function give_logs_view_gateway_errors() { |
95 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
95 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
96 | 96 | |
97 | 97 | $logs_table = new Give_Gateway_Error_Log_Table(); |
98 | 98 | $logs_table->prepare_items(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.8.12 |
107 | 107 | */ |
108 | - do_action( 'give_logs_payment_error_top' ); |
|
108 | + do_action('give_logs_payment_error_top'); |
|
109 | 109 | |
110 | 110 | $logs_table->display(); ?> |
111 | 111 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @since 1.8.12 |
121 | 121 | */ |
122 | - do_action( 'give_logs_payment_error_bottom' ); |
|
122 | + do_action('give_logs_payment_error_bottom'); |
|
123 | 123 | ?> |
124 | 124 | |
125 | 125 | </div> |
126 | 126 | <?php |
127 | 127 | } |
128 | 128 | |
129 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
129 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * API Request Logs |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return void |
139 | 139 | */ |
140 | 140 | function give_logs_view_api_requests() { |
141 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
141 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
142 | 142 | |
143 | 143 | $logs_table = new Give_API_Request_Log_Table(); |
144 | 144 | $logs_table->prepare_items(); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( 'give_logs_api_requests_top' ); |
|
154 | + do_action('give_logs_api_requests_top'); |
|
155 | 155 | |
156 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
156 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
157 | 157 | $logs_table->display(); |
158 | 158 | ?> |
159 | 159 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @since 1.0 |
169 | 169 | */ |
170 | - do_action( 'give_logs_api_requests_bottom' ); |
|
170 | + do_action('give_logs_api_requests_bottom'); |
|
171 | 171 | ?> |
172 | 172 | |
173 | 173 | </div> |
174 | 174 | <?php |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
177 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the log views drop down. |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | $current_section = give_get_current_setting_section(); |
187 | 187 | |
188 | 188 | // If there are not any event attach to action then do not show form. |
189 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
189 | + if ( ! has_action('give_log_view_actions')) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | ?> |
193 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
193 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
194 | 194 | <?php |
195 | 195 | /** |
196 | 196 | * Fires after displaying the reports page views drop down. |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @since 1.0 |
201 | 201 | */ |
202 | - do_action( 'give_log_view_actions' ); |
|
202 | + do_action('give_log_view_actions'); |
|
203 | 203 | ?> |
204 | 204 | |
205 | 205 | <input type="hidden" name="post_type" value="give_forms"/> |
206 | 206 | <input type="hidden" name="page" value="give-tools"/> |
207 | 207 | <input type="hidden" name="tab" value="logs"/> |
208 | 208 | |
209 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
209 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
210 | 210 | </form> |
211 | 211 | <?php |
212 | 212 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return string |
220 | 220 | */ |
221 | -function give_tools_set_form_method( $method ) { |
|
221 | +function give_tools_set_form_method($method) { |
|
222 | 222 | return 'get'; |
223 | 223 | } |
224 | -add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 ); |
|
224 | +add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10); |
@@ -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_Settings_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'logs'; |
46 | - $this->label = __( 'Logs', 'give' ); |
|
46 | + $this->label = __('Logs', 'give'); |
|
47 | 47 | |
48 | 48 | $this->default_tab = 'sales'; |
49 | 49 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public function add_settings_page( $pages ) { |
|
64 | - $pages[ $this->id ] = $this->label; |
|
63 | + public function add_settings_page($pages) { |
|
64 | + $pages[$this->id] = $this->label; |
|
65 | 65 | |
66 | 66 | return $pages; |
67 | 67 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $GLOBALS['give_hide_save_button'] = true; |
78 | 78 | |
79 | 79 | // Get settings. |
80 | - $settings = apply_filters( 'give_settings_logs', array( |
|
80 | + $settings = apply_filters('give_settings_logs', array( |
|
81 | 81 | array( |
82 | 82 | 'id' => 'give_tools_logs', |
83 | 83 | 'type' => 'title', |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ), |
86 | 86 | array( |
87 | 87 | 'id' => 'api', |
88 | - 'name' => __( 'Log', 'give' ), |
|
88 | + 'name' => __('Log', 'give'), |
|
89 | 89 | 'type' => 'logs', |
90 | 90 | |
91 | 91 | ), |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'type' => 'sectionend', |
95 | 95 | 'table_html' => false, |
96 | 96 | ), |
97 | - ) ); |
|
97 | + )); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Filter the settings. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param array $settings |
105 | 105 | */ |
106 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
106 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
107 | 107 | |
108 | 108 | // Output. |
109 | 109 | return $settings; |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function get_sections() { |
119 | 119 | $sections = array( |
120 | - 'sales' => __( 'Donations', 'give' ), |
|
121 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
122 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
120 | + 'sales' => __('Donations', 'give'), |
|
121 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
122 | + 'api_requests' => __('API Requests', 'give'), |
|
123 | 123 | ); |
124 | 124 | |
125 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
125 | + $sections = apply_filters('give_log_views', $sections); |
|
126 | 126 | |
127 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
127 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function output() { |
137 | 137 | $settings = $this->get_settings(); |
138 | 138 | |
139 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
139 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -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_Settings_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'system-info'; |
46 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
46 | + $this->label = esc_html__('System Info', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return array |
66 | 66 | */ |
67 | - public function add_settings_page( $pages ) { |
|
68 | - $pages[ $this->id ] = $this->label; |
|
67 | + public function add_settings_page($pages) { |
|
68 | + $pages[$this->id] = $this->label; |
|
69 | 69 | |
70 | 70 | return $pages; |
71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function output() { |
80 | 80 | $GLOBALS['give_hide_save_button'] = true; |
81 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
81 | + include_once('views/html-admin-page-system-info.php'); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 |