PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.20.0
GiveWP – Donation Plugin and Fundraising Platform v2.20.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 / PaymentGateways / Gateways / Stripe / Traits / CheckoutModal.php
give / src / PaymentGateways / Gateways / Stripe / Traits Last commit date
BECSMandateForm.php 4 years ago CheckoutInstructions.php 4 years ago CheckoutModal.php 4 years ago CheckoutRedirect.php 4 years ago CreditCardForm.php 4 years ago FormFieldMarkup.php 4 years ago HandlePaymentIntentStatus.php 4 years ago SEPAMandateForm.php 4 years ago
CheckoutModal.php
147 lines
1 <?php
2
3 namespace Give\PaymentGateways\Gateways\Stripe\Traits;
4
5 use Give\Helpers\Form\Utils as FormUtils;
6 use Give\Helpers\Gateways\Stripe;
7
8 /**
9 * @since 2.19.0
10 */
11 trait CheckoutModal
12 {
13 /**
14 * @param int $formId Donation Form ID.
15 * @param array $args Donation Form Arguments.
16 *
17 * @since 2.19.0 Migrated from the legacy Give_Stripe_Checkout::showCheckoutModal implementation of the Stripe Checkout Gateway.
18 *
19 * @return string
20 */
21 public function getCheckoutModalHTML( $formId, $args )
22 {
23 $idPrefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : "{$formId}-1";
24 $backgroundImageUrl = give_get_option( 'stripe_checkout_background_image', '' );
25 $backgroundItem = 'background-color: #000000;';
26
27 // Load Background Image, if exists.
28 if ( ! empty( $backgroundImageUrl ) ) {
29 $backgroundImageUrl = esc_url( $backgroundImageUrl );
30 $backgroundItem = "background-image: url('{$backgroundImageUrl}'); background-size: cover;";
31 }
32
33 ob_start();
34 ?>
35 <div id="give-stripe-checkout-modal-<?php echo $idPrefix; ?>" class="give-stripe-checkout-modal">
36 <div class="give-stripe-checkout-modal-content">
37 <div class="give-stripe-checkout-modal-container">
38 <div class="give-stripe-checkout-modal-header" style="<?php echo $backgroundItem; ?>">
39 <button class="give-stripe-checkout-modal-close">
40 <svg
41 width="20px"
42 height="20px"
43 viewBox="0 0 20 20"
44 version="1.1"
45 xmlns="http://www.w3.org/2000/svg"
46 xmlns:xlink="http://www.w3.org/1999/xlink"
47 >
48 <defs>
49 <path
50 d="M10,8.8766862 L13.6440403,5.2326459 C13.9542348,4.92245137 14.4571596,4.92245137 14.7673541,5.2326459 C15.0775486,5.54284044 15.0775486,6.04576516 14.7673541,6.3559597 L11.1238333,9.99948051 L14.7673541,13.6430016 C15.0775486,13.9531961 15.0775486,14.4561209 14.7673541,14.7663154 C14.4571596,15.0765099 13.9542348,15.0765099 13.6440403,14.7663154 L10,11.1222751 L6.3559597,14.7663154 C6.04576516,15.0765099 5.54284044,15.0765099 5.2326459,14.7663154 C4.92245137,14.4561209 4.92245137,13.9531961 5.2326459,13.6430016 L8.87616671,9.99948051 L5.2326459,6.3559597 C4.92245137,6.04576516 4.92245137,5.54284044 5.2326459,5.2326459 C5.54284044,4.92245137 6.04576516,4.92245137 6.3559597,5.2326459 L10,8.8766862 Z"
51 id="path-1"
52 ></path>
53 </defs>
54 <g
55 id="Payment-recipes"
56 stroke="none"
57 stroke-width="1"
58 fill="none"
59 fill-rule="evenodd"
60 >
61 <g
62 id="Elements-Popup"
63 transform="translate(-816.000000, -97.000000)"
64 >
65 <g id="close-btn" transform="translate(816.000000, 97.000000)">
66 <circle
67 id="Oval"
68 fill-opacity="0.3"
69 fill="#AEAEAE"
70 cx="10"
71 cy="10"
72 r="10"
73 ></circle>
74 <mask id="mask-2" fill="white">
75 <use xlink:href="#path-1"></use>
76 </mask>
77 <use
78 id="Mask"
79 fill-opacity="0.5"
80 fill="#FFFFFF"
81 opacity="0.5"
82 xlink:href="#path-1"
83 ></use>
84 </g>
85 </g>
86 </g>
87 </svg>
88 </button>
89 <h3><?php echo give_get_option( 'stripe_checkout_name' ); ?></h3>
90 <div class="give-stripe-checkout-donation-amount">
91 <?php echo give_get_form_price( $formId ); ?>
92 </div>
93 <div class="give-stripe-checkout-donor-email"></div>
94 <div class="give-stripe-checkout-form-title">
95 <?php echo get_the_title( $formId ); ?>
96 </div>
97 </div>
98 <div class="give-stripe-checkout-modal-body">
99 <?php
100 /**
101 * This action hook will be trigger in Stripe Checkout Modal before CC fields.
102 *
103 * @since 2.7.3
104 */
105 do_action( 'give_stripe_checkout_modal_before_cc_fields', $formId, $args );
106
107 // Load Credit Card Fields for Stripe Checkout.
108 echo Stripe::showCreditCardFields( $idPrefix );
109
110 /**
111 * This action hook will be trigger in Stripe Checkout Modal after CC fields.
112 *
113 * @since 2.7.3
114 */
115 do_action( 'give_stripe_checkout_modal_after_cc_fields', $formId, $args );
116 ?>
117 <input type="hidden" name="give_validate_stripe_payment_fields" value="0"/>
118 </div>
119 <div class="give-stripe-checkout-modal-footer">
120 <div class="card-errors"></div>
121 <?php
122 $display_label_field = give_get_meta( $formId, '_give_checkout_label', true );
123 $display_label_field = apply_filters( 'give_donation_form_submit_button_text', $display_label_field, $formId, $args );
124 $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
125 ?>
126 <div class="give-submit-button-wrap give-stripe-checkout-modal-btn-wrap give-clearfix">
127 <?php
128 echo sprintf(
129 '<input type="submit" class="%1$s" id="%2$s" value="%3$s" data-before-validation-label="%3$s" name="%4$s" data-is_legacy_form="%5$s" disabled/>',
130 FormUtils::isLegacyForm() ? 'give-btn give-stripe-checkout-modal-donate-button' : 'give-btn give-stripe-checkout-modal-sequoia-donate-button',
131 "give-stripe-checkout-modal-donate-button-{$idPrefix}",
132 $display_label,
133 'give_stripe_modal_donate',
134 FormUtils::isLegacyForm()
135 );
136 ?>
137 <span class="give-loading-animation"></span>
138 </div>
139 </div>
140 </div>
141 </div>
142 </div>
143 <?php
144 return ob_get_clean();
145 }
146 }
147