PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | includes/admin/reports/graphing.php +52 -50 2.3.24.16.9 View file →
@@ -51,10 +51,10 @@
51 51
52 52 $earnings_totals = 0.00; // Total earnings for time period shown.
53 53 $sales_totals = 0; // Total sales for time period shown.
54 54
55 - $earnings_data = array();
56 - $sales_data = array();
55 + $earnings_data = [];
56 + $sales_data = [];
57 57
58 58 if ( 'today' === $dates['range'] || 'yesterday' === $dates['range'] ) {
59 59
60 60 // Hour by hour.
@@ -69,10 +69,10 @@
69 69
70 70 $sales_totals += $sales;
71 71 $earnings_totals += $earnings;
72 72
73 - $sales_data[] = array( $start_date * 1000, $sales );
74 - $earnings_data[] = array( $start_date * 1000, $earnings );
73 + $sales_data[] = [ $start_date * 1000, $sales ];
74 + $earnings_data[] = [ $start_date * 1000, $earnings ];
75 75
76 76 $hour ++;
77 77 endwhile;
78 78
@@ -91,10 +91,10 @@
91 91
92 92 $sales_totals += $sales;
93 93 $earnings_totals += $earnings;
94 94
95 - $sales_data[] = array( $start_date * 1000, $sales );
96 - $earnings_data[] = array( $start_date * 1000, $earnings );
95 + $sales_data[] = [ $start_date * 1000, $sales ];
96 + $earnings_data[] = [ $start_date * 1000, $earnings ];
97 97 $day ++;
98 98 endwhile;
99 99
100 100 } else {
@@ -142,10 +142,10 @@
142 142
143 143 $sales_totals += $sales;
144 144 $earnings_totals += $earnings;
145 145
146 - $sales_data[] = array( $start_date * 1000, $sales );
147 - $earnings_data[] = array( $start_date * 1000, $earnings );
146 + $sales_data[] = [ $start_date * 1000, $sales ];
147 + $earnings_data[] = [ $start_date * 1000, $earnings ];
148 148
149 149 $d ++;
150 150
151 151 endwhile;
@@ -160,10 +160,10 @@
160 160
161 161 $sales_totals += $sales;
162 162 $earnings_totals += $earnings;
163 163
164 - $sales_data[] = array( $start_date * 1000, $sales );
165 - $earnings_data[] = array( $start_date * 1000, $earnings );
164 + $sales_data[] = [ $start_date * 1000, $sales ];
165 + $earnings_data[] = [ $start_date * 1000, $earnings ];
166 166
167 167 }
168 168
169 169 $i ++;
@@ -174,12 +174,12 @@
174 174 endwhile;
175 175
176 176 }
177 177
178 - $data = array(
179 - __( 'Income', 'give' ) => $earnings_data,
178 + $data = [
179 + __( 'Revenue', 'give' ) => $earnings_data,
180 180 __( 'Donations', 'give' ) => $sales_data,
181 - );
181 + ];
182 182
183 183 // start our own output buffer.
184 184 ob_start();
185 185 ?>
@@ -189,9 +189,9 @@
189 189 <div class="postbox">
190 190 <div class="inside">
191 191 <?php give_reports_graph_controls(); ?>
192 192 <?php
193 - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
193 + $graph = new Give_Graph( $data, [ 'dataType' => [ 'amount', 'count' ] ] );
194 194 $graph->set( 'x_mode', 'time' );
195 195 $graph->set( 'multiple_y_axes', true );
196 196 $graph->display();
197 197
@@ -203,10 +203,10 @@
203 203 </div>
204 204 <table class="widefat reports-table alignleft" style="max-width:450px">
205 205 <tbody>
206 206 <tr>
207 - <th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
208 - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
207 + <th scope="row"><strong><?php _e( 'Total revenue for period:', 'give' ); ?></strong></th>
208 + <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, [ 'sanitize' => false ] ) ); ?></td>
209 209 </tr>
210 210 <tr class="alternate">
211 211 <th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?><strong></th>
212 212 <td><?php echo $sales_totals; ?></td>
@@ -212,10 +212,10 @@
212 212 <td><?php echo $sales_totals; ?></td>
213 213 </tr>
214 214 <?php if ( 'this_month' === $dates['range'] ) : ?>
215 215 <tr>
216 - <th scope="row"><strong><?php _e( 'Estimated monthly income:', 'give' ); ?></strong></th>
217 - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td>
216 + <th scope="row"><strong><?php _e( 'Estimated monthly revenue:', 'give' ); ?></strong></th>
217 + <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], [ 'sanitize' => false ] ) ); ?></td>
218 218 </tr>
219 219 <tr class="alternate">
220 220 <th scope="row"><strong><?php _e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
221 221 <td><?php echo floor( $estimated['sales'] ); ?></td>
@@ -289,10 +289,10 @@
289 289
290 290 $earnings_totals = (float) 0.00; // Total earnings for time period shown.
291 291 $sales_totals = 0; // Total sales for time period shown.
292 292
293 - $earnings_data = array();
294 - $sales_data = array();
293 + $earnings_data = [];
294 + $sales_data = [];
295 295 $stats = new Give_Payment_Stats();
296 296
297 297 if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
298 298
@@ -315,10 +315,10 @@
315 315
316 316 $earnings = $stats->get_earnings( $form_id, $date, $date_end );
317 317 $earnings_totals += $earnings;
318 318
319 - $sales_data[] = array( $date * 1000, $sales );
320 - $earnings_data[] = array( $date * 1000, $earnings );
319 + $sales_data[] = [ $date * 1000, $sales ];
320 + $earnings_data[] = [ $date * 1000, $earnings ];
321 321
322 322 $hour ++;
323 323 endwhile;
324 324
@@ -337,10 +337,10 @@
337 337
338 338 $earnings = $stats->get_earnings( $form_id, $date, $date_end );
339 339 $earnings_totals += $earnings;
340 340
341 - $sales_data[] = array( $date * 1000, $sales );
342 - $earnings_data[] = array( $date * 1000, $earnings );
341 + $sales_data[] = [ $date * 1000, $sales ];
342 + $earnings_data[] = [ $date * 1000, $earnings ];
343 343
344 344 $day ++;
345 345 endwhile;
346 346
@@ -390,10 +390,10 @@
390 390
391 391 $earnings = $stats->get_earnings( $form_id, $date, $end_date );
392 392 $earnings_totals += $earnings;
393 393
394 - $sales_data[] = array( $date * 1000, $sales );
395 - $earnings_data[] = array( $date * 1000, $earnings );
394 + $sales_data[] = [ $date * 1000, $sales ];
395 + $earnings_data[] = [ $date * 1000, $earnings ];
396 396 $d ++;
397 397
398 398 endwhile;
399 399
@@ -409,10 +409,10 @@
409 409
410 410 $earnings = $stats->get_earnings( $form_id, $date, $end_date );
411 411 $earnings_totals += $earnings;
412 412
413 - $sales_data[] = array( $date * 1000, $sales );
414 - $earnings_data[] = array( $date * 1000, $earnings );
413 + $sales_data[] = [ $date * 1000, $sales ];
414 + $earnings_data[] = [ $date * 1000, $earnings ];
415 415
416 416 }
417 417
418 418 $i ++;
@@ -423,12 +423,12 @@
423 423 endwhile;
424 424
425 425 }
426 426
427 - $data = array(
428 - __( 'Income', 'give' ) => $earnings_data,
427 + $data = [
428 + __( 'Revenue', 'give' ) => $earnings_data,
429 429 __( 'Donations', 'give' ) => $sales_data,
430 - );
430 + ];
431 431
432 432 ?>
433 433 <h3><span>
434 434 <?php
@@ -433,12 +433,12 @@
433 433 <h3><span>
434 434 <?php
435 435 printf(
436 436 /* translators: %s: form title */
437 - esc_html__( 'Income Report for %s', 'give' ),
437 + esc_html__( 'Revenue Report for %s', 'give' ),
438 438 get_the_title( $form_id )
439 439 );
440 - ?>
440 + ?>
441 441 </span></h3>
442 442 <div id="give-dashboard-widgets-wrap">
443 443 <div class="metabox-holder" style="padding-top: 0;">
444 444 <div class="postbox">
@@ -444,9 +444,9 @@
444 444 <div class="postbox">
445 445 <div class="inside">
446 446 <?php give_reports_graph_controls(); ?>
447 447 <?php
448 - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
448 + $graph = new Give_Graph( $data, [ 'dataType' => [ 'amount', 'count' ] ] );
449 449 $graph->set( 'x_mode', 'time' );
450 450 $graph->set( 'multiple_y_axes', true );
451 451 $graph->display();
452 452 ?>
@@ -455,10 +455,10 @@
455 455 <!--/.postbox -->
456 456 <table class="widefat reports-table alignleft" style="max-width:450px">
457 457 <tbody>
458 458 <tr>
459 - <th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
460 - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
459 + <th scope="row"><strong><?php _e( 'Total revenue for period:', 'give' ); ?></strong></th>
460 + <td><?php echo give_currency_filter( give_format_amount( $earnings_totals, [ 'sanitize' => false ] ) ); ?></td>
461 461 </tr>
462 462 <tr class="alternate">
463 463 <th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th>
464 464 <td><?php echo $sales_totals; ?></td>
@@ -463,10 +463,10 @@
463 463 <th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th>
464 464 <td><?php echo $sales_totals; ?></td>
465 465 </tr>
466 466 <tr>
467 - <th scope="row"><strong><?php _e( 'Average monthly income:', 'give' ); ?></strong></th>
468 - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td>
467 + <th scope="row"><strong><?php _e( 'Average monthly revenue:', 'give' ); ?></strong></th>
468 + <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), [ 'sanitize' => false ] ) ); ?></td>
469 469 </tr>
470 470 <tr class="alternate">
471 471 <th scope="row"><strong><?php _e( 'Average monthly donations:', 'give' ); ?></strong></th>
472 472 <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
@@ -500,9 +500,10 @@
500 500 * @return void
501 501 */
502 502 function give_reports_graph_controls() {
503 503 $date_options = apply_filters(
504 - 'give_report_date_options', array(
504 + 'give_report_date_options',
505 + [
505 506 'today' => __( 'Today', 'give' ),
506 507 'yesterday' => __( 'Yesterday', 'give' ),
507 508 'this_week' => __( 'This Week', 'give' ),
508 509 'last_week' => __( 'Last Week', 'give' ),
@@ -512,9 +513,9 @@
512 513 'last_quarter' => __( 'Last Quarter', 'give' ),
513 514 'this_year' => __( 'This Year', 'give' ),
514 515 'last_year' => __( 'Last Year', 'give' ),
515 516 'other' => __( 'Custom', 'give' ),
516 - )
517 + ]
517 518 );
518 519
519 520 $dates = give_get_report_dates();
520 521 $display = $dates['range'] == 'other' ? '' : 'display: none;';
@@ -612,9 +613,9 @@
612 613 *
613 614 * @return array
614 615 */
615 616 function give_get_report_dates() {
616 - $dates = array();
617 + $dates = [];
617 618
618 619 $current_time = current_time( 'timestamp' );
619 620
620 621 $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
@@ -807,9 +808,9 @@
807 808 $view = give_get_reporting_view();
808 809 $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
809 810 $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
810 811
811 - 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 ) ) ) );
812 + wp_redirect( esc_url_raw(add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&legacy=true&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ) );
812 813 give_die();
813 814 }
814 815
815 816 add_action( 'give_filter_reports', 'give_parse_report_dates' );
@@ -825,25 +826,26 @@
825 826 function give_reports_refresh_button() {
826 827
827 828 $url = wp_nonce_url(
828 829 add_query_arg(
829 - array(
830 + [
830 831 'give_action' => 'refresh_reports_transients',
831 832 'give-messages[]' => 'refreshed-reports',
832 - )
833 - ), 'give-refresh-reports'
833 + ]
834 + ),
835 + 'give-refresh-reports'
834 836 );
835 837
836 838 echo Give()->tooltips->render_link(
837 - array(
839 + [
838 840 'label' => esc_attr__( 'Clicking this will clear the reports cache.', 'give' ),
839 841 'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' . esc_html__( 'Refresh Report Data', 'give' ),
840 - 'link' => $url,
842 + 'link' => esc_url( $url ),
841 843 'position' => 'left',
842 - 'attributes' => array(
844 + 'attributes' => [
843 845 'class' => 'button alignright give-admin-button',
844 - ),
845 - )
846 + ],
847 + ]
846 848 );
847 849 }
848 850
849 851 add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );