Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.12.123.217
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/tacafoundation.org/wp-content/plugins/give/src/Revenue/Repositories/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/tacafoundation.org/wp-content/plugins/give/src/Revenue/Repositories/Revenue.php
<?php

namespace Give\Revenue\Repositories;

use Give\Donations\Models\Donation;
use Give\Framework\Database\DB;
use Give\Framework\Exceptions\Primitives\InvalidArgumentException;

/**
 * Class Revenue
 * @package    Give\Revenue\Repositories
 *
 * Use this class to get data from "give_revenue" table.
 *
 * @since      2.9.0
 * @since 2.22.1 Added the `updateRevenueAmount()` method
 */
class Revenue
{
    /**
     * Insert revenue.
     *
     * @since 2.9.0
     *
     * @param array $revenueData
     *
     * @return bool|int
     */
    public function insert($revenueData)
    {
        global $wpdb;

        // Validate revenue data
        $this->validateNewRevenueData($revenueData);

        /**
         * Filter revenue data before inserting to revenue table.
         *
         * @since 2.9.0
         */
        $revenueData = apply_filters('give_revenue_insert_data', $revenueData);

        return DB::insert(
            $wpdb->give_revenue,
            $revenueData,
            $this->getPlaceholderForPrepareQuery($revenueData)
        );
    }

    /**
     * Deletes revenue
     *
     * @param $revenueId
     *
     * @return false|int
     */
    public function deleteByDonationId($revenueId)
    {
        global $wpdb;

        return DB::delete(
            $wpdb->give_revenue,
            ['donation_id' => $revenueId],
            ['%d']
        );
    }

    /**
     * @since 2.22.1
     *
     * @param Donation $donation
     *
     * @return false|int
     */
    public function updateRevenueAmount(Donation $donation)
    {
        global $wpdb;

        return DB::update(
            $wpdb->give_revenue,
            ['amount' => $donation->amount->formatToMinorAmount()],
            ['donation_id' => $donation->id],
            ['%d'],
            ['%d']
        );
    }

    /**
     * Validate new revenue data.
     *
     * @since 2.9.0
     * @since 2.9.4 Mention donation id in exception message.
     *
     * @param array $array
     */
    protected function validateNewRevenueData($array)
    {
        $required = ['donation_id', 'form_id', 'amount'];

        if (empty($array['donation_id'])) {
            unset($array['donation_id']);
        }

        if (empty($array['form_id'])) {
            unset($array['form_id']);
        }

        if (!is_numeric($array['amount']) || (int)$array['amount'] < 0) {
            unset($array['amount']);
        }

        if (array_diff($required, array_keys($array))) {
            $errorMessage = '';
            if (isset($array['donation_id'])) {
                $errorMessage = "An error occurred when processing Donation #{$array['donation_id']}. ";
            }

            throw new InvalidArgumentException(
                sprintf(
                    '%2$sTo insert revenue, please provide valid %1$s.',
                    implode(', ', $required),
                    $errorMessage
                )
            );
        }
    }

    /**
     * Get placeholder for prepare query.
     *
     * @param array $data
     *
     * @return string[] Array of value format type
     */
    private function getPlaceholderForPrepareQuery($data)
    {
        $format = [];

        foreach ($data as $value) {
            $format[] = is_numeric($value) ? '%d' : '%s';
        }

        return $format;
    }

    /**
     * Return whether or not donation id exist in give_revenue table.
     *
     * @sicne 2.9.0
     *
     * @param int $donationId
     *
     * @return bool
     */
    public function isDonationExist($donationId)
    {
        global $wpdb;

        return (bool)DB::get_var(
            DB::prepare(
                "
				SELECT donation_id
				FROM {$wpdb->give_revenue}
				WHERE donation_id = %d
				",
                $donationId
            )
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit