403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.144.230.177
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/Form/LegacyConsumer/Commands/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/give/src/Form/LegacyConsumer/Commands/SetupFieldReceipt.php
<?php

namespace Give\Form\LegacyConsumer\Commands;

use Give\Framework\FieldsAPI\Field;
use Give\Framework\FieldsAPI\Group;
use Give\Receipt\DonationReceipt;

/**
 * @since 2.10.2
 */
class SetupFieldReceipt
{
    /**
     * @var DonationReceipt
     */
    protected $receipt;

    /**
     * @since 2.10.2
     *
     * @param DonationReceipt $receipt
     */
    public function __construct(DonationReceipt $receipt)
    {
        $this->receipt = $receipt;
    }

    /**
     * @since 2.10.2
     *
     * @param string $hook
     *
     * @return void
     */
    public function __invoke($hook)
    {
        $formID = give_get_payment_meta($this->receipt->donationId, '_give_payment_form_id');

        $collection = Group::make($hook);
        do_action("give_fields_{$hook}", $collection, $formID);

        $collection->walkFields([$this, 'apply']);
    }

    /**
     * @since 2.10.2
     *
     * @param Field $field
     *
     * @return void
     */
    public function apply(Field $field)
    {
        if ( ! $field->shouldShowInReceipt()) {
            return;
        }

        if ($field->shouldStoreAsDonorMeta()) {
            $this->addDonorLineItem($field);
        } else {
            $this->addAdditionalLineItems($field);
        }
    }

    /**
     * @since 2.10.2
     *
     * @param Field $field
     *
     * @return void
     */
    protected function addDonorLineItem(Field $field)
    {
        $donorID = give_get_payment_meta($this->receipt->donationId, '_give_payment_donor_id');
        if ($value = Give()->donor_meta->get_meta($donorID, $field->getName(), true)) {
            $this->receipt
                ->getSections()[DonationReceipt::DONORSECTIONID]
                ->addLineItem(
                    [
                        'id' => $field->getName(),
                        'label' => $field->getLabel(),
                        'value' => $value,
                    ]
                );
        }
    }

    /**
     * @since 2.10.2
     *
     * @param Field $field
     *
     * @return void
     */
    protected function addAdditionalLineItems(Field $field)
    {
        if ($value = give_get_payment_meta($this->receipt->donationId, $field->getName())) {
            $this->receipt
                ->getSections()[DonationReceipt::ADDITIONALINFORMATIONSECTIONID]
                ->addLineItem(
                    [
                        'id' => $field->getName(),
                        'label' => $field->getLabel(),
                        'value' => $value,
                    ]
                );
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit