PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
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
← All changes | templates/donation-stats.php +55 -23 1.6.9 → 1.8.13 View file →
@@ -1,5 +1,11 @@
1 1 <?php
2 +
3 +// Exit if accessed directly.
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +
2 8 /**
3 9 * Display the site donation stats.
4 10 *
5 11 * Override this template by copying it to yourtheme/charitable/donation-stats.php
@@ -4,19 +10,31 @@
4 10 *
5 11 * Override this template by copying it to yourtheme/charitable/donation-stats.php
6 12 *
7 13 * @package Charitable/Templates/Widgets
8 - * @author Studio 164a
14 + * @author WP Charitable LLC
9 15 * @since 1.5.0
10 - * @version 1.5.0
16 + * @version 1.6.57
17 + * @version 1.8.8.6
11 18 */
12 19
13 -$campaigns_count = Charitable_Campaigns::query( array(
14 - 'posts_per_page' => -1,
15 - 'fields' => 'ids',
16 -) )->found_posts;
17 -$campaigns_text = 1 == $campaigns_count ? __( 'Campaign', 'charitable' ) : __( 'Campaigns', 'charitable' );
20 +/**
21 + * Do something before displaying the donation stats.
22 + *
23 + * @since 1.6.57
24 + *
25 + * @param array $view_args The view arguments.
26 + */
27 +do_action( 'charitable_donation_stats_before', $view_args );
18 28
29 +$charitable_campaigns_count = Charitable_Campaigns::query(
30 + array(
31 + 'posts_per_page' => -1,
32 + 'fields' => 'ids',
33 + )
34 +)->found_posts;
35 +$charitable_campaigns_text = 1 === $charitable_campaigns_count ? __( 'Campaign', 'charitable' ) : __( 'Campaigns', 'charitable' );
36 +
19 37 /**
20 38 * Filter the donation stats to show.
21 39 *
22 40 * @since 1.5.0
@@ -23,27 +41,41 @@
23 41 *
24 42 * @param array $donation_stats The default stats to show.
25 43 * @param array $view_args All arguments passed to the view.
26 44 */
27 -$donation_stats = apply_filters( 'charitable_donation_stats', array(
28 - 'campaign_count' => array(
29 - 'amount' => $campaigns_count,
30 - 'description' => $campaigns_text,
45 +$charitable_donation_stats = apply_filters(
46 + 'charitable_donation_stats',
47 + array(
48 + 'campaign_count' => array(
49 + 'amount' => $charitable_campaigns_count,
50 + 'description' => $charitable_campaigns_text,
51 + ),
52 + 'donated' => array(
53 + 'amount' => charitable_format_money( charitable_get_table( 'campaign_donations' )->get_total() ),
54 + 'description' => __( 'Donated', 'charitable' ),
55 + ),
56 + 'donor_count' => array(
57 + 'amount' => charitable_get_table( 'donors' )->count_donors_with_donations(),
58 + 'description' => __( 'Donors', 'charitable' ),
59 + ),
31 60 ),
32 - 'donated' => array(
33 - 'amount' => charitable_format_money( charitable_get_table( 'campaign_donations' )->get_total() ),
34 - 'description' => __( 'Donated', 'charitable' ),
35 - ),
36 - 'donor_count' => array(
37 - 'amount' => charitable_get_table( 'donors' )->count_donors_with_donations(),
38 - 'description' => __( 'Donors', 'charitable' ),
39 - ),
40 -), $view_args );
61 + $view_args
62 +);
41 63
42 64 ?>
43 65 <ul class="donation-stats">
44 66 <?php
45 -foreach ( $donation_stats as $stat ) :
46 - printf( '<li><span class="figure">%s</span> %s</li>', $stat['amount'], $stat['description'] );
67 +foreach ( $charitable_donation_stats as $charitable_stat ) :
68 + printf( '<li><span class="figure">%s</span> %s</li>', esc_html( $charitable_stat['amount'] ), esc_html( $charitable_stat['description'] ) );
47 69 endforeach;
48 70 ?>
49 -</ul><!-- .donation-stats -->
71 +</ul><!-- .donation-stats -->
72 +<?php
73 +
74 +/**
75 + * Do something after displaying the donation stats.
76 + *
77 + * @since 1.6.57
78 + *
79 + * @param array $view_args The view arguments.
80 + */
81 +do_action( 'charitable_donation_stats_after', $view_args );