PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 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 All 256 releases
give / src / PaymentGateways / Gateways / Offline / Views / LegacyFormFieldMarkup.php

LegacyFormFieldMarkup.php in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at src/PaymentGateways/Gateways/Offline/Views/LegacyFormFieldMarkup.php

85 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\PaymentGateways\Gateways\Offline\Views;
4
5 /**
6 * Generates the markup for the legacy offline payment fields using the admin settings.
7 *
8 * @since 3.0.0
9 */
10 class LegacyFormFieldMarkup
11 {
12 /**
13 * @since 3.0.0
14 */
15 public function __invoke(int $formId, bool $includeBillingFields): string
16 {
17 $offlineInstructions = stripslashes(give_get_offline_payment_instruction($formId, true));
18 $billingFields = $includeBillingFields ? $this->getBillingFieldsMarkup($formId) : '';
19
20 return trim(
21 "
22 {$billingFields}
23 {$this->getBeforeFieldsHookOutput($formId)}
24 <fieldset class='no-fields' id='give_offline_payment_info'>
25 {$offlineInstructions}
26 </fieldset>
27 {$this->getAfterFieldsHookOutput($formId)}
28 "
29 );
30 }
31
32 /**
33 * @since 3.0.0
34 */
35 private function getBeforeFieldsHookOutput(int $formId): string
36 {
37 ob_start();
38
39 /**
40 * Fires before the offline info fields.
41 *
42 * @since 1.0
43 *
44 * @param int $form_id Give form id.
45 */
46 do_action('give_before_offline_info_fields', $formId);
47
48 return ob_get_clean();
49 }
50
51 /**
52 * @since 3.0.0
53 */
54 private function getAfterFieldsHookOutput(int $formId): string
55 {
56 ob_start();
57
58 /**
59 * Fires after the offline info fields.
60 *
61 * @since 1.0
62 *
63 * @param int $form_id Give form id.
64 */
65 do_action('give_after_offline_info_fields', $formId);
66
67 return ob_get_clean();
68 }
69
70 private function getBillingFieldsMarkup(int $formId): string
71 {
72 $post_offline_cc_fields = give_get_meta($formId, '_give_offline_donation_enable_billing_fields_single', true);
73 $post_offline_customize_option = give_get_meta($formId, '_give_customize_offline_donations', true, 'global');
74
75 $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
76
77 return (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled(
78 $global_offline_cc_fields
79 ))
80 || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled(
81 $post_offline_cc_fields
82 )) ? give_default_cc_address_fields($formId, true) : '';
83 }
84 }
85