PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.2
GiveWP – Donation Plugin and Fundraising Platform v4.15.2
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / DonationForms / AsyncData / AsyncDataHelpers.php
AsyncDataHelpers.php
43 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonationForms\AsyncData;
4
5 use Give\DonationForms\DataTransferObjects\DonationFormGoalData;
6 use Give\DonationForms\V2\Models\DonationForm;
7 use Give\MultiFormGoals\ProgressBar\Model as ProgressBarModel;
8
9 /**
10 * @since 3.16.0
11 */
12 class AsyncDataHelpers
13 {
14 /**
15 * @since 3.16.0
16 */
17 public static function getFormDonationsCountValue($formId): int
18 {
19 return (new ProgressBarModel(['ids' => [$formId], 'statusList' => ['any']]))->getDonationCount();
20 }
21
22 /**
23 * @since 4.2.0 return float value
24 * @since 3.16.0
25 */
26 public static function getFormRevenueValue($formId): float
27 {
28 $donationForm = DonationForm::find($formId);
29 $form = $donationForm->toV3Form();
30 $goalData = new DonationFormGoalData($form->id, $form->settings);
31
32 return $goalData->getCurrentAmount();
33 }
34
35 /**
36 * @since 3.16.0
37 */
38 public static function getSkeletonPlaceholder($width = '100%', $height = '0.7rem'): string
39 {
40 return '<span class="give-skeleton js-give-async-data" style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';"></span>';
41 }
42 }
43