403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.189.188.113
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/give/src/Framework/PaymentGateways/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/give/src/Framework/PaymentGateways/DonationSummary.php
<?php

namespace Give\Framework\PaymentGateways;

use Give\Donations\Models\Donation;

/**
 * @since 2.19.0
 */
class DonationSummary
{
    /** @var int */
    protected $length = 255;

    /** @var Donation */
    protected $donation;

    /**
     * @since 2.19.0
     */
    public function __construct(Donation $donation)
    {
        $this->donation = $donation;
    }

    /**
     * @since 2.19.0
     *
     * @param int $length
     */
    public function setLength(int $length)
    {
        $this->length = $length;
    }

    /**
     * @since 2.19.0
     *
     * @return string
     */
    public function getSummaryWithDonor(): string
    {
        return $this->trim(
            implode(' - ', [
                $this->getSummary(),
                $this->getDonorLabel(),
            ])
        );
    }

    /**
     * @since 2.19.0
     *
     * @return string
     */
    public function getSummary(): string
    {
        return $this->trimAndFilter(
            implode(
                ': ',
                array_filter([
                    $this->getLabel(),
                    $this->getPriceLabel(),
                ])
            )
        );
    }

    /**
     * @since 2.19.0
     *
     * @return string
     */
    protected function getLabel(): string
    {
        $formId = give_get_payment_form_id($this->donation->id);
        $formTitle = get_the_title($formId);
        return $formTitle ?: sprintf(__('Donation Form ID: %d', 'give'), $formId);
    }

    /**
     * @since 2.19.0
     * @return string
     */
    protected function getPriceLabel(): string
    {
        $priceId = $this->donation->levelId;

        return is_numeric($priceId)
            ? give_get_price_option_name($this->donation->formId, $this->donation->levelId)
            : '';
    }

    /**
     * @since 2.19.0
     */
    protected function getDonorLabel(): string
    {
        return sprintf(
            '%s %s (%s)',
            $this->donation->firstName,
            $this->donation->lastName,
            $this->donation->email
        );
    }

    /**
     * @since 2.19.0
     *
     * @param string $text
     *
     * @return string
     */
    protected function trimAndFilter(string $text): string
    {
        /**
         * @since 2.25.0 Re-use trim method for text.
         * @since 1.8.12
         */
        return apply_filters('give_payment_gateway_donation_summary', $this->trim($text));
    }

    /**
     * @since 2.25.0
     *
     * @param string $text
     *
     * @return string
     */
    protected function trim(string $text): string
    {
        return substr($text, 0, $this->length);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit