HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/give/src/DonationForms/AsyncData/AsyncDataHelpers.php
<?php

namespace Give\DonationForms\AsyncData;

use Give\DonationForms\DataTransferObjects\DonationFormGoalData;
use Give\DonationForms\V2\Models\DonationForm;
use Give\MultiFormGoals\ProgressBar\Model as ProgressBarModel;

/**
 * @since 3.16.0
 */
class AsyncDataHelpers
{
    /**
     * @since 3.16.0
     */
    public static function getFormDonationsCountValue($formId): int
    {
        return (new ProgressBarModel(['ids' => [$formId], 'statusList' => ['any']]))->getDonationCount();
    }

    /**
     * @since 4.2.0 return float value
     * @since 3.16.0
     */
    public static function getFormRevenueValue($formId): float
    {
        $donationForm = DonationForm::find($formId);
        $form = $donationForm->toV3Form();
        $goalData = new DonationFormGoalData($form->id, $form->settings);

        return $goalData->getCurrentAmount();
    }

    /**
     * @since 3.16.0
     */
    public static function getSkeletonPlaceholder($width = '100%', $height = '0.7rem'): string
    {
        return '<span class="give-skeleton js-give-async-data" style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';"></span>';
    }
}