PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.3.0
GiveWP – Donation Plugin and Fundraising Platform v3.3.0
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 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / src / FormMigration / FormMetaDecorator.php
give / src / FormMigration Last commit date
Actions 2 years ago Commands 2 years ago Concerns 2 years ago Contracts 2 years ago Controllers 2 years ago DataTransferObjects 2 years ago Steps 2 years ago FormMetaDecorator.php 2 years ago Pipeline.php 2 years ago ServiceProvider.php 2 years ago StepProcessor.php 2 years ago functions.php 2 years ago
FormMetaDecorator.php
688 lines
1 <?php
2
3 namespace Give\FormMigration;
4
5 use Give\DonationForms\V2\Models\DonationForm;
6 use Give\DonationForms\ValueObjects\GoalType;
7 use Give\FormMigration\Contracts\FormModelDecorator;
8 use Give\Log\Log;
9 use Give\PaymentGateways\Gateways\Stripe\StripePaymentElementGateway\StripePaymentElementGateway;
10 use Give_Email_Notification_Util;
11
12 class FormMetaDecorator extends FormModelDecorator
13 {
14 /**
15 * @var DonationForm
16 */
17 protected $form;
18
19 public function __construct(DonationForm $form)
20 {
21 $this->form = $form;
22 }
23
24 public function isLastNameRequired(): bool
25 {
26 return give_is_last_name_required($this->form->id);
27 }
28
29 public function isNameTitlePrefixEnabled(): bool
30 {
31 return give_is_name_title_prefix_enabled($this->form->id);
32 }
33
34 public function getNameTitlePrefixes(): array
35 {
36 return give_get_name_title_prefixes($this->form->id);
37 }
38
39 public function isUserRegistrationEnabled(): bool
40 {
41 // @note In v3 all donors are registered as users, so no need for a registration setting.
42 return in_array(
43 give_get_meta($this->form->id, '_give_show_register_form', true),
44 ['registration', 'login', 'both']
45 );
46 }
47
48 public function isUserLoginRequired(): bool
49 {
50 return !$this->isGuestDonationsEnabled();
51 }
52
53 public function isGuestDonationsEnabled(): bool
54 {
55 // @note The "Guest Donation" setting corresponds to the `_give_logged_in_only` meta, which seems backwards.
56 return give_is_setting_enabled(
57 give_get_meta($this->form->id, '_give_logged_in_only', true)
58 );
59 }
60
61 public function isCompanyFieldEnabled(): bool
62 {
63 return give_is_company_field_enabled($this->form->id);
64 }
65
66 public function isCompanyFieldRequired(): bool
67 {
68 // @note Forked from give/includes/process-donation.php:718
69 if (give_is_company_field_enabled($this->form->id)) {
70 $form_option = give_get_meta($this->form->id, '_give_company_field', true);
71 $global_setting = give_get_option('company_field');
72
73 if (!empty($form_option) && give_is_setting_enabled($form_option, ['required'])) {
74 return true;
75 } elseif ('global' === $form_option && give_is_setting_enabled($global_setting, ['required'])) {
76 return true;
77 } elseif (empty($form_option) && give_is_setting_enabled($global_setting, ['required'])) {
78 return true;
79 }
80 }
81
82 return false;
83 }
84
85 public function getFormTemplate(): string
86 {
87 return give_get_meta($this->form->id, '_give_form_template', true);
88 }
89
90 public function getFormTemplateSettings(): array
91 {
92 $template = $this->getFormTemplate();
93
94 return give_get_meta($this->form->id, "_give_{$template}_form_template_settings", true);
95 }
96
97 public function isDonationGoalEnabled(): bool
98 {
99 return give_is_setting_enabled(
100 give_get_meta($this->form->id, '_give_goal_option', true)
101 );
102 }
103
104 public function getDonationGoalType(): GoalType
105 {
106 $onlyRecurringEnabled = $this->isGoalCountingOnlyRecurringDonations();
107
108 switch (give_get_form_goal_format($this->form->id)) {
109 case 'donors':
110 return $onlyRecurringEnabled ? GoalType::DONORS_FROM_SUBSCRIPTIONS() : GoalType::DONORS();
111 case 'donation': // @note v2: Singular
112 return $onlyRecurringEnabled ? GoalType::SUBSCRIPTIONS() : GoalType::DONATIONS();
113 // @note v3: Plural
114 case 'amount':
115 case 'percentage': // @note `percentage` is not supported in v3 - defaulting to `amount`
116 default:
117 return $onlyRecurringEnabled ? GoalType::AMOUNT_FROM_SUBSCRIPTIONS() : GoalType::AMOUNT();
118 }
119 }
120
121 /**
122 * @return mixed Goal of the form
123 */
124 public function getDonationGoalAmount()
125 {
126 return give_get_form_goal($this->form->id);
127 }
128
129 public function isAutoClosedEnabled()
130 {
131 return give_is_setting_enabled(
132 give_get_meta($this->form->id, '_give_close_form_when_goal_achieved', true, 'disabled')
133 );
134 }
135
136 public function getGoalAchievedMessage()
137 {
138 return give_get_meta($this->form->id, '_give_form_goal_achieved_message', true);
139 }
140
141 public function isTermsEnabled()
142 {
143 return give_is_terms_enabled($this->form->id);
144 }
145
146 public function getTermsAgreementLabel()
147 {
148 // @note Forked from give/includes/forms/template.php:1845
149 return ($label = give_get_meta($this->form->id, '_give_agree_label', true))
150 ? stripslashes($label)
151 : esc_html__('Agree to Terms?', 'give');
152 }
153
154 public function getTermsAgreementText()
155 {
156 return give_get_meta($this->form->id, '_give_agree_text', true);
157 }
158
159 public function isOfflineDonationsCustomized()
160 {
161 return give_is_setting_enabled(
162 give_get_meta($this->form->id, '_give_customize_offline_donations', true),
163 'custom'
164 );
165 }
166
167 public function isOfflineDonationsBillingFieldEnabled()
168 {
169 return give_is_setting_enabled(
170 give_get_meta($this->form->id, '_give_offline_donation_enable_billing_fields_single', true)
171 );
172 }
173
174 public function getOfflineDonationInstructions()
175 {
176 return give_get_meta($this->form->id, '_give_offline_checkout_notes', true);
177 }
178
179 public function isFormGridCustomized()
180 {
181 return give_is_setting_enabled(
182 give_get_meta($this->form->id, '_give_form_grid_option', true),
183 'custom'
184 );
185 }
186
187 public function getFormGridRedirectUrl()
188 {
189 return give_get_meta($this->form->id, '_give_form_grid_redirect_url', true);
190 }
191
192 public function getFormGridDonateButtonText()
193 {
194 return give_get_meta($this->form->id, '_give_form_grid_donate_button_text', true);
195 }
196
197 public function getEmailOptionsStatus(): string
198 {
199 return give_get_meta($this->form->id, '_give_email_options', true);
200 }
201
202 public function getEmailTemplate(): string
203 {
204 return give_get_meta($this->form->id, '_give_email_template', true);
205 }
206
207 public function getEmailLogo(): string
208 {
209 return Give_Email_Notification_Util::get_email_logo($this->form->id);
210 }
211
212 public function getEmailFromName(): string
213 {
214 return give_get_meta($this->form->id, '_give_from_name', true);
215 }
216
217 public function getEmailFromEmail(): string
218 {
219 return give_get_meta($this->form->id, '_give_from_email', true);
220 }
221
222 /**
223 * @since 3.0.0
224 * @return string 'multi', 'set'
225 */
226 public function getDonationOption(): string
227 {
228 return give()->form_meta->get_meta($this->form->id, '_give_price_option', true);
229 }
230
231 /**
232 * @since 3.0.0
233 * @return string 'multi', 'set'
234 */
235 public function isDonationOptionMulti(): string
236 {
237 return 'multi' === $this->getDonationOption();
238 }
239
240 /**
241 * @return string 'multi', 'set'
242 */
243 public function isDonationOptionSet(): string
244 {
245 return 'set' === $this->getDonationOption();
246 }
247
248 /**
249 * @since 3.0.0
250 */
251 public function getDonationLevels(): array
252 {
253 return give()->form_meta->get_meta($this->form->id, '_give_donation_levels', true);
254 }
255
256 /**
257 * @since 3.0.0
258 */
259 public function isRecurringDonationsEnabled(): bool
260 {
261 $_give_recurring = $this->getRecurringDonationsOption();
262
263 return !empty($_give_recurring) && 'no' !== $_give_recurring;
264 }
265
266 /**
267 * Recurring Donations = 'no', 'yes_donor', 'yes_admin'
268 *
269 * @since 3.0.0
270 */
271 public function getRecurringDonationsOption(): string
272 {
273 return give()->form_meta->get_meta($this->form->id, '_give_recurring', true);
274 }
275
276 /**
277 * @since 3.0.0
278 */
279 public function isRecurringDefaultCheckboxEnabled(): bool
280 {
281 return 'yes' === $this->getRecurringDefaultCheckboxOption();
282 }
283
284 /**
285 * 'day', 'week', 'month', 'year'
286 *
287 * @since 3.0.0
288 */
289 public function getRecurringPeriod(): string
290 {
291 return give()->form_meta->get_meta($this->form->id, '_give_period', true);
292 }
293
294 /**
295 * 'day', 'week', 'month', 'year'
296 *
297 * @since 3.0.0
298 */
299 public function getRecurringPeriodDefaultDonorsChoice(): string
300 {
301 return give()->form_meta->get_meta($this->form->id, '_give_period_default_donor_choice', true);
302 }
303
304 /**
305 * @since 3.0.0
306 */
307 public function getRecurringLengthOfTime(): int
308 {
309 return (int)give()->form_meta->get_meta($this->form->id, '_give_times', true);
310 }
311
312 /**
313 * @since 3.0.0
314 */
315 public function getRecurringBillingInterval(): int
316 {
317 return (int)give()->form_meta->get_meta($this->form->id, '_give_period_interval', true);
318 }
319
320 /**
321 * 'yes', 'no'
322 *
323 * @since 3.0.0
324 */
325 public function getRecurringDefaultCheckboxOption(): string
326 {
327 return give()->form_meta->get_meta($this->form->id, '_give_checkbox_default', true);
328 }
329
330 /**
331 * 'donors_choice', 'admin_choice', 'custom' (The "Donor's Choice" option allows the donor to select the time period (commonly also referred as the "frequency") of their subscription. The "Preset Period" option provides only the selected period for the donor's subscription.)
332 *
333 * @since 3.0.0
334 */
335 public function getRecurringPeriodFunctionality(): string
336 {
337 return give()->form_meta->get_meta($this->form->id, '_give_period_functionality', true);
338 }
339
340 /**
341 * @since 3.0.0
342 * @return string 'enabled', 'disabled'
343 */
344 public function getCustomAmountOption(): string
345 {
346 return give()->form_meta->get_meta($this->form->id, '_give_custom_amount', true);
347 }
348
349 /**
350 * @since 3.0.0
351 */
352 public function isCustomAmountOptionEnabled(): bool
353 {
354 return 'enabled' === $this->getCustomAmountOption();
355 }
356
357 /**
358 * @since 3.0.0
359 */
360 public function isRecurringPeriodFunctionalityDonorsChoice(): bool
361 {
362 return 'donors_choice' === $this->getRecurringPeriodFunctionality();
363 }
364
365 /**
366 * @since 3.0.0
367 */
368 public function isRecurringPeriodFunctionalityAdminChoice(): bool
369 {
370 return 'admin_choice' === $this->getRecurringPeriodFunctionality();
371 }
372
373 /**
374 * This used when donation option is 'multi' and custom amount is 'enabled'
375 *
376 * @since 3.0.0
377 */
378 public function getRecurringCustomAmountPeriod(): string
379 {
380 return give()->form_meta->get_meta($this->form->id, '_give_recurring_custom_amount_period', true);
381 }
382
383 /**
384 * This used when donation option is 'multi' and custom amount is 'enabled'
385 *
386 * @since 3.0.0
387 */
388 public function getRecurringCustomAmountInterval(): int
389 {
390 return give()->form_meta->get_meta($this->form->id, '_give_recurring_custom_amount_interval', true);
391 }
392
393 /**
394 * This used when donation option is 'multi' and custom amount is 'enabled'
395 *
396 * @since 3.0.0
397 */
398 public function getRecurringCustomAmountTimes(): int
399 {
400 return give()->form_meta->get_meta($this->form->id, '_give_recurring_custom_amount_times', true);
401 }
402
403 public function getStripeUseGlobalDefault(): bool
404 {
405 return (
406 give_get_meta($this->form->id, 'give_stripe_per_form_accounts', true) !== 'enabled'
407 );
408 }
409
410 public function getStripeAccountId(): string
411 {
412 return give_get_meta($this->form->id, '_give_stripe_default_account', true);
413 }
414
415 public function isGoalCountingOnlyRecurringDonations(): bool
416 {
417 return filter_var(give_get_meta($this->form->id, '_give_recurring_goal_format', true), FILTER_VALIDATE_BOOLEAN);
418 }
419
420 /**
421 * @return array{offlineEnabled: bool, offlineUseGlobalInstructions: bool, offlineDonationInstructions: string}
422 */
423 public function getOfflineAttributes(): array
424 {
425 $customization = give_get_meta($this->form->id, '_give_customize_offline_donations', true);
426 $instructions = give_get_meta($this->form->id, '_give_offline_checkout_notes', true);
427
428 return [
429 'offlineEnabled' => $customization !== 'disabled',
430 'offlineUseGlobalInstructions' => $customization === 'global',
431 'offlineDonationInstructions' => $instructions,
432 ];
433 }
434
435 /**
436 * @since 3.0.0
437 */
438 public function getFormFields(): array
439 {
440 return array_filter((array)give_get_meta($this->form->id, 'give-form-fields', true));
441 }
442
443 /**
444 * @since 3.0.0
445 */
446 public function getFormFieldsPlacement(): string
447 {
448 return give_get_meta($this->form->id, '_give_ffm_placement', true);
449 }
450
451 /**
452 * @since 3.0.2 set correct $gatewayId to be used in getMeta calls
453 * @since 3.0.0
454 */
455 public function getFeeRecoverySettings(): array
456 {
457 $feeRecoveryStatus = $this->getMeta('_form_give_fee_recovery');
458
459 if (empty($feeRecoveryStatus) || $feeRecoveryStatus === 'disabled') {
460 return [];
461 }
462
463 if ($feeRecoveryStatus === 'global') {
464 return [
465 'useGlobalSettings' => true,
466 ];
467 }
468
469 if ($feeRecoveryStatus !== 'enabled') {
470 return [];
471 }
472
473 $perGatewaySettings = [];
474 $gateways = give_get_ordered_payment_gateways(give_get_enabled_payment_gateways());
475 $gatewaysMap = [
476 'stripe' => StripePaymentElementGateway::id(),
477 ];
478
479 if ($gateways) {
480 foreach (array_keys($gateways) as $gatewayId) {
481 $v3GatewayId = $gatewayId;
482 if (array_key_exists($gatewayId, $gatewaysMap)) {
483 $v3GatewayId = $gatewaysMap[$gatewayId];
484 }
485
486 $perGatewaySettings[$v3GatewayId] = [
487 'enabled' => $this->getMeta('_form_gateway_fee_enable_' . $gatewayId) === 'enabled',
488 'feePercentage' => (float)$this->getMeta('_form_gateway_fee_percentage_' . $gatewayId, 2.9),
489 'feeBaseAmount' => (float)$this->getMeta('_form_gateway_fee_base_amount_' . $gatewayId, 0.30),
490 'maxFeeAmount' => (float)$this->getMeta(
491 '_form_gateway_fee_maximum_fee_amount_' . $gatewayId,
492 give_format_decimal(['amount' => '0.00'])
493 ),
494 ];
495 }
496 }
497
498 return [
499 'useGlobalSettings' => false,
500 'feeSupportForAllGateways' => $this->getMeta('_form_give_fee_configuration') === 'all_gateways',
501 'perGatewaySettings' => $perGatewaySettings,
502 'feePercentage' => (float)$this->getMeta('_form_give_fee_percentage'),
503 'feeBaseAmount' => (float)$this->getMeta('_form_give_fee_base_amount'),
504 'maxFeeAmount' => (float)$this->getMeta('_form_give_fee_maximum_fee_amount'),
505 'includeInDonationSummary' => $this->getMeta('_form_breakdown') === 'enabled',
506 'donorOptIn' => $this->getMeta('_form_give_fee_mode') === 'donor_opt_in',
507 'feeCheckboxLabel' => $this->getMeta('_form_give_fee_checkbox_label'),
508 'feeMessage' => $this->getMeta('_form_give_fee_explanation'),
509 ];
510 }
511
512 /**
513 * @since 3.3.0
514 */
515 public function isMailchimpEnabled(): bool
516 {
517 $isFormEnabled = give_is_setting_enabled($this->getMeta('_give_mailchimp_enable'),'true');
518
519 $isFormDisabled = give_is_setting_enabled($this->getMeta('_give_mailchimp_disable'),'true');
520
521 $isGloballyEnabled = give_is_setting_enabled(give_get_option('give_mailchimp_show_checkout_signup'), 'on');
522
523 return !($isFormDisabled || ( !$isGloballyEnabled && !$isFormEnabled));
524 }
525
526 /**
527 * @since 3.3.0
528 */
529 public function getMailchimpLabel()
530 {
531 $value = $this->getMeta('_give_mailchimp_custom_label');
532 return $value === '' ? null : $value;
533 }
534
535 /**
536 * @since 3.3.0
537 */
538 public function getMailchimpDefaultChecked(): bool
539 {
540 return $this->getMeta('_give_mailchimp_checked_default');
541 }
542
543 /**
544 * @since 3.3.0
545 */
546 public function getMailchimpDoubleOptIn(): bool
547 {
548 return $this->getMeta('_give_mailchimp_double_opt_in');
549 }
550
551 /**
552 * @since 3.3.0
553 */
554 public function getMailchimpSendDonationData(): bool
555 {
556 return $this->getMeta('_give_mailchimp_send_donation');
557 }
558
559 /**
560 * @since 3.3.0
561 */
562 public function getMailchimpSendFFMData(): bool
563 {
564 return $this->getMeta('_give_mailchimp_send_ffm');
565 }
566
567 /**
568 * @since 3.3.0
569 */
570 public function getMailchimpDefaultAudiences(): array
571 {
572 return $this->getMeta('_give_mailchimp');
573 }
574
575 /**
576 * @since 3.3.0
577 */
578 public function getMailchimpSubscriberTags(): array
579 {
580 return $this->getMeta('_give_mailchimp_tags');
581 }
582
583
584 /**
585 * Retrieves metadata for the current form.
586 *
587 * This method acts as a wrapper for the give_get_meta function, reducing redundancy
588 * and improving code readability when fetching metadata related to the current form.
589 *
590 * @since 3.0.0
591 *
592 * @param string $key
593 * @param mixed $default
594 * @return mixed
595 */
596 private function getMeta(string $key, $default = null)
597 {
598 return give_get_meta($this->form->id, $key, true, $default);
599 }
600
601 /**
602 * @since 3.3.0
603 */
604 public function hasFunds(): bool
605 {
606 $fundsAndDesignationsAttributes = $this->getFundsAndDesignationsAttributes();
607
608 return count($fundsAndDesignationsAttributes['fund']) > 0;
609 }
610
611 /**
612 * @since 3.3.0
613 */
614 public function hasFundOptions(): bool
615 {
616 $fundsAndDesignationsAttributes = $this->getFundsAndDesignationsAttributes();
617
618 return count($fundsAndDesignationsAttributes['options']) > 0;
619 }
620
621 /**
622 * @since 3.3.0
623 */
624 public function getFundsAndDesignationsAttributes(): array
625 {
626 $label = give_get_meta($this->form->id, 'give_funds_label', true);
627 $isAdminChoice = 'admin_choice' === give_get_meta($this->form->id, 'give_funds_form_choice', true);
628 $adminChoice = give_get_meta($this->form->id, 'give_funds_admin_choice', true);
629 $donorOptions = give_get_meta($this->form->id, 'give_funds_donor_choice', true);
630
631
632 $options = [];
633 foreach ($donorOptions as $fundId) {
634 $options[] = [
635 'value' => $fundId,
636 'label' => $this->getFundLabel($fundId),
637 'checked' => $isAdminChoice ? $fundId === $adminChoice : true,
638 'isDefault' => $this->isDefaultFund($fundId),
639 ];
640 }
641
642 return [
643 'label' => $label,
644 'fund' => $isAdminChoice ? [
645 'value' => $adminChoice,
646 'label' => $this->getFundLabel($adminChoice),
647 'checked' => true,
648 'isDefault' => $this->isDefaultFund($adminChoice),
649 ] : $options[0],
650 'options' => $options,
651 ];
652 }
653
654 /**
655 * @since 3.3.0
656 */
657 private function getFundLabel(int $fundId): string
658 {
659 global $wpdb;
660
661 $fund = $wpdb->get_row(
662 $wpdb->prepare("SELECT * FROM {$wpdb->give_funds} WHERE id = %d", $fundId)
663 );
664
665 if ( ! $fund) {
666 return '';
667 }
668
669 return $fund->title;
670 }
671
672 /**
673 * @since 3.3.0
674 */
675 private function isDefaultFund(int $fundId): bool
676 {
677 global $wpdb;
678
679 $fund = $wpdb->get_row("SELECT id FROM {$wpdb->give_funds} WHERE is_default = 1");
680
681 if ( ! $fund) {
682 return false;
683 }
684
685 return $fund->id === $fundId;
686 }
687 }
688