Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mets.corals.io/wp-content/plugins/give/src/MultiFormGoals/ProgressBar/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mets.corals.io/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;
    }

    /**
     * @return string
     */
    public function getSQL()
    {
        global $wpdb;

        $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
            WHERE
                payment.post_type = 'give_payment'
                AND
                payment.post_status IN ( 'publish', 'give_subscription' )
        ";

        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);
    }
}

Spamworldpro Mini