PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.2
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.2
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / includes / admin / views / dashboard-widgets / donations-widget.php

donations-widget.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.2, at includes/admin/views/dashboard-widgets/donations-widget.php

106 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Display the donations widget on the dashboard.
4 *
5 * @author WP Charitable LLC
6 * @package Charitable/Admin View/Dashboard Widgets
7 * @since 1.2.0
8 * @version 1.6.55
9 */
10
11 $statuses = charitable_get_valid_donation_statuses();
12
13 $donations = get_posts( array(
14 'post_type' => Charitable::DONATION_POST_TYPE,
15 'posts_per_page' => 5,
16 'post_status' => array_keys( $statuses ),
17 'fields' => 'ids',
18 ) );
19
20 $table = charitable_get_table( 'campaign_donations' );
21
22 $today = $table->get_donations_summary_by_period( date( 'Y-m-d%' ) );
23 $this_month = $table->get_donations_summary_by_period( date( 'Y-m%' ) );
24 $last_month = $table->get_donations_summary_by_period( date( 'Y-m%', strtotime( '-1 month' ) ) );
25 $this_year = $table->get_donations_summary_by_period( date( 'Y-%' ) );
26
27 ?>
28 <div class="charitable-donation-statistics">
29 <div class="cell">
30 <h3 class="amount">
31 <?php echo charitable_format_money( $today->amount ); ?>
32 </h3>
33 <p class="summary">
34 <?php
35 printf(
36 /* translators: %d: number of donations */
37 _n( '%d donation <span class="time-period">today</span>', '%d donations <span class="time-period">today</span>', $today->count, 'charitable' ),
38 $today->count
39 );
40 ?>
41 </p>
42 </div>
43 <div class="cell">
44 <h3 class="amount">
45 <?php echo charitable_format_money( $this_month->amount ); ?>
46 </h3>
47 <p class="summary">
48 <?php
49 printf(
50 /* translators: %d: number of donations */
51 _n( '%d donation <span class="time-period">this month</span>', '%d donations <span class="time-period">this month</span>', $this_month->count, 'charitable' ),
52 $this_month->count
53 );
54 ?>
55 </p>
56 </div>
57 <div class="cell">
58 <h3 class="amount">
59 <?php echo charitable_format_money( $last_month->amount ); ?>
60 </h3>
61 <p class="summary">
62 <?php
63 printf(
64 /* translators: %d: number of donations */
65 _n( '%d donation <span class="time-period">last month</span>', '%d donations <span class="time-period">last month</span>', $last_month->count, 'charitable' ),
66 $last_month->count
67 );
68 ?>
69 </p>
70 </div>
71 <div class="cell">
72 <h3 class="amount">
73 <?php echo charitable_format_money( $this_year->amount ); ?>
74 </h3>
75 <p class="summary">
76 <?php
77 printf(
78 /* translators: %d: number of donations */
79 _n( '%d donation <span class="time-period">this year</span>', '%d donations <span class="time-period">this year</span>', $this_year->count, 'charitable' ),
80 $this_year->count
81 );
82 ?>
83 </p>
84 </div>
85 </div>
86 <?php if ( count( $donations ) ) : ?>
87 <div class="recent-donations">
88 <table>
89 <caption><h3><?php _e( 'Recent Donations', 'charitable' ); ?></h3></caption>
90 <?php
91 foreach ( $donations as $donation_id ) :
92 $donation = charitable_get_donation( $donation_id );
93 ?>
94 <tr>
95 <td class="donation-date"><?php echo $donation->get_date(); ?></td>
96 <td class="donation-id">#<?php echo $donation->get_number(); ?></td>
97 <td class="donation-status"><?php echo $donation->get_status_label(); ?></td>
98 <td class="donation-total"><?php echo charitable_format_money( $donation->get_total(), false, true, $donation->get_currency() ); ?></td>
99 </tr>
100 <?php
101 endforeach;
102 ?>
103 </table>
104 </div>
105 <?php endif ?>
106