$21 GRAYBYTE WORDPRESS FILE MANAGER $76

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/itiministry.org/wp-content/plugins/give/src/MultiFormGoals/ProgressBar/

HOME
Current File : /home/bravrvjk/itiministry.org/wp-content/plugins/give/src/MultiFormGoals/ProgressBar//Query.php
<?php

namespace Give\MultiFormGoals\ProgressBar;

use wpdb;

/**
 * Get the Total, Count, and Average of the payment totals for published donations of a given set of forms.
 */
class Query
{
    /** @var array */
    protected $formIDs;

    /**
     * @var wpdb
     */
    protected $wpdb;

    /**
     * @var array $formIDs
     */
    public function __construct($formIDs)
    {
        global $wpdb;
        $this->wpdb = $wpdb;
        $this->formIDs = $formIDs;
    }

    /**
     * @since 4.14.0 Replace {$wpdb->paymentmeta} with {$wpdb->donationmeta}
     * @since 3.14.0 Consider the donation mode (test or live) instead of querying both modes together
     * @return string
     */
    public function getSQL()
    {
        global $wpdb;
        $mode = give_is_test_mode() ? 'test' : 'live';
        $sql = "
            SELECT
                sum( revenue.amount ) as total,
                count( payment.ID ) as count
            FROM {$wpdb->posts} as payment
                JOIN {$wpdb->give_revenue} as revenue
                    ON revenue.donation_id = payment.ID
                JOIN {$wpdb->donationmeta} paymentMode
                    ON payment.ID = paymentMode.donation_id AND paymentMode.meta_key = '_give_payment_mode'
            WHERE
                payment.post_type = 'give_payment'
                AND
                payment.post_status IN ( 'publish', 'give_subscription' )
                AND
                paymentMode.meta_value = '{$mode}'
        ";

        if (!empty($this->formIDs)) {
            $sql .= '
                AND
                revenue.form_id IN ( ' . $this->getFormsString() . ' )
            ';
        }

        return $sql;
    }

    /**
     * @return string
     */
    protected function getFormsString()
    {
        return implode(',', $this->formIDs);
    }

    /**
     * @return stdClass
     */
    public function getResults()
    {
        $sql = $this->getSQL();

        return $this->wpdb->get_row($sql);
    }
}


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Block.php
3.376 KB
2 Nov 2023 11.14 PM
bravrvjk / bravrvjk
0644
Model.php
8.243 KB
18 Dec 2024 12.10 AM
bravrvjk / bravrvjk
0644
Query.php
1.956 KB
28 Jan 2026 8.00 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF