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/reports.php +42 -18 2.3.14.16.9 View file →
@@ -38,19 +38,38 @@
38 38 <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1>
39 39
40 40 <h2 class="nav-tab-wrapper">
41 41 <?php foreach ( $views as $tab => $label ) { ?>
42 - <a href="<?php echo esc_url( add_query_arg( array(
43 - 'tab' => $tab,
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>
42 + <a href="
43 + <?php
44 + echo esc_url(
45 + add_query_arg(
46 + [
47 + 'tab' => $tab,
48 + 'settings-updated' => false,
49 + ],
50 + $current_page
51 + )
52 + );
53 + ?>
54 + " class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a>
46 55 <?php } ?>
47 56 <?php if ( current_user_can( 'export_give_reports' ) ) { ?>
48 - <a href="<?php echo esc_url( add_query_arg( array(
49 - 'tab' => 'export',
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>
52 - <?php }
57 + <a href="
58 + <?php
59 + echo esc_url(
60 + add_query_arg(
61 + [
62 + 'tab' => 'export',
63 + 'settings-updated' => false,
64 + ],
65 + $current_page
66 + )
67 + );
68 + ?>
69 + " class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
70 + <?php
71 + }
53 72 /**
54 73 * Fires in the report tabs.
55 74 *
56 75 * Allows you to add new report tabs.
@@ -98,13 +117,13 @@
98 117 * @since 1.0
99 118 * @return array $views Report Views
100 119 */
101 120 function give_reports_default_views() {
102 - $views = array(
103 - 'earnings' => esc_html__( 'Income', 'give' ),
121 + $views = [
122 + 'earnings' => esc_html__( 'Revenue', 'give' ),
104 123 'forms' => esc_html__( 'Forms', 'give' ),
105 124 'gateways' => esc_html__( 'Donation Methods', 'give' ),
106 - );
125 + ];
107 126
108 127 $views = apply_filters( 'give_report_views', $views );
109 128
110 129 return $views;
@@ -138,10 +157,10 @@
138 157 * @return void
139 158 */
140 159 function give_reports_tab_reports() {
141 160
142 - if( ! current_user_can( 'view_give_reports' ) ) {
143 - wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
161 + if ( ! current_user_can( 'view_give_reports' ) ) {
162 + wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), [ 'response' => 403 ] );
144 163 }
145 164
146 165 $current_view = 'earnings';
147 166 $views = give_reports_default_views();
@@ -278,15 +297,20 @@
278 297
279 298 /**
280 299 * Renders the Reports Earnings Graphs
281 300 *
301 + * @since 3.22.1 added permissions check
282 302 * @since 1.0
283 303 * @return void
284 304 */
285 305 function give_reports_earnings() {
306 + if (!current_user_can('view_give_reports')){
307 + wp_die(__('You do not have permission to access this report', 'give'), __('Error', 'give'), ['response' => 403]);
308 + }
309 +
286 310 ?>
287 311 <div class="tablenav top reports-table-nav">
288 - <h2 class="reports-earnings-title screen-reader-text"><?php _e( 'Income Report', 'give' ); ?></h2>
312 + <h2 class="reports-earnings-title screen-reader-text"><?php _e( 'Revenue Report', 'give' ); ?></h2>
289 313 </div>
290 314 <?php
291 315 give_reports_graph();
292 316 }
@@ -305,14 +329,14 @@
305 329 $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true );
306 330
307 331 if ( false === $estimated ) {
308 332
309 - $estimated = array(
333 + $estimated = [
310 334 'earnings' => 0,
311 335 'sales' => 0,
312 - );
336 + ];
313 337
314 - $stats = new Give_Payment_Stats;
338 + $stats = new Give_Payment_Stats();
315 339
316 340 $to_date_earnings = $stats->get_earnings( 0, 'this_month' );
317 341 $to_date_sales = $stats->get_sales( 0, 'this_month' );
318 342