PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 4.16.3
GiveWP – Donation Plugin and Fundraising Platform v4.16.3
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 CanSetupStripeApp.php 4 years ago CheckoutInstructions.php 4 years ago CheckoutModal.php 6 days ago CheckoutRedirect.php 2 years ago CreditCardForm.php 4 years ago FormFieldMarkup.php 4 years ago HandlePaymentIntentStatus.php 3 years ago SEPAMandateForm.php 3 years ago
CheckoutModal.php
148 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 4.16.3 Escaped the submit button label in the Stripe checkout modal.
18 * @since 2.19.0 Migrated from the legacy Give_Stripe_Checkout::showCheckoutModal implementation of the Stripe Checkout Gateway.
19 *
20 * @return string
21 */
22 public function getCheckoutModalHTML( $formId, $args )
23 {
24 $idPrefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : "{$formId}-1";
25 $backgroundImageUrl = give_get_option( 'stripe_checkout_background_image', '' );
26 $backgroundItem = 'background-color: #000000;';
27
28 // Load Background Image, if exists.
29 if ( ! empty( $backgroundImageUrl ) ) {
30 $backgroundImageUrl = esc_url( $backgroundImageUrl );
31 $backgroundItem = "background-image: url('{$backgroundImageUrl}'); background-size: cover;";
32 }
33
34 ob_start();
35 ?>
36 <div id="give-stripe-checkout-modal-<?php echo $idPrefix; ?>" class="give-stripe-checkout-modal">
37 <div class="give-stripe-checkout-modal-content">
38 <div class="give-stripe-checkout-modal-container">
39 <div class="give-stripe-checkout-modal-header" style="<?php echo $backgroundItem; ?>">
40 <button class="give-stripe-checkout-modal-close">
41 <svg
42 width="20px"
43 height="20px"
44 viewBox="0 0 20 20"
45 version="1.1"
46 xmlns="http://www.w3.org/2000/svg"
47 xmlns:xlink="http://www.w3.org/1999/xlink"
48 >
49 <defs>
50 <path
51 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"
52 id="path-1"
53 ></path>
54 </defs>
55 <g
56 id="Payment-recipes"
57 stroke="none"
58 stroke-width="1"
59 fill="none"
60 fill-rule="evenodd"
61 >
62 <g
63 id="Elements-Popup"
64 transform="translate(-816.000000, -97.000000)"
65 >
66 <g id="close-btn" transform="translate(816.000000, 97.000000)">
67 <circle
68 id="Oval"
69 fill-opacity="0.3"
70 fill="#AEAEAE"
71 cx="10"
72 cy="10"
73 r="10"
74 ></circle>
75 <mask id="mask-2" fill="white">
76 <use xlink:href="#path-1"></use>
77 </mask>
78 <use
79 id="Mask"
80 fill-opacity="0.5"
81 fill="#FFFFFF"
82 opacity="0.5"
83 xlink:href="#path-1"
84 ></use>
85 </g>
86 </g>
87 </g>
88 </svg>
89 </button>
90 <h3><?php echo give_get_option( 'stripe_checkout_name' ); ?></h3>
91 <div class="give-stripe-checkout-donation-amount">
92 <?php echo give_get_form_price( $formId ); ?>
93 </div>
94 <div class="give-stripe-checkout-donor-email"></div>
95 <div class="give-stripe-checkout-form-title">
96 <?php echo get_the_title( $formId ); ?>
97 </div>
98 </div>
99 <div class="give-stripe-checkout-modal-body">
100 <?php
101 /**
102 * This action hook will be trigger in Stripe Checkout Modal before CC fields.
103 *
104 * @since 2.7.3
105 */
106 do_action( 'give_stripe_checkout_modal_before_cc_fields', $formId, $args );
107
108 // Load Credit Card Fields for Stripe Checkout.
109 echo Stripe::showCreditCardFields( $idPrefix );
110
111 /**
112 * This action hook will be trigger in Stripe Checkout Modal after CC fields.
113 *
114 * @since 2.7.3
115 */
116 do_action( 'give_stripe_checkout_modal_after_cc_fields', $formId, $args );
117 ?>
118 <input type="hidden" name="give_validate_stripe_payment_fields" value="0"/>
119 </div>
120 <div class="give-stripe-checkout-modal-footer">
121 <div class="card-errors"></div>
122 <?php
123 $display_label_field = give_get_meta( $formId, '_give_checkout_label', true );
124 $display_label_field = apply_filters( 'give_donation_form_submit_button_text', $display_label_field, $formId, $args );
125 $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
126 ?>
127 <div class="give-submit-button-wrap give-stripe-checkout-modal-btn-wrap give-clearfix">
128 <?php
129 echo sprintf(
130 '<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/>',
131 FormUtils::isLegacyForm() ? 'give-btn give-stripe-checkout-modal-donate-button' : 'give-btn give-stripe-checkout-modal-sequoia-donate-button',
132 "give-stripe-checkout-modal-donate-button-{$idPrefix}",
133 esc_attr($display_label),
134 'give_stripe_modal_donate',
135 FormUtils::isLegacyForm()
136 );
137 ?>
138 <span class="give-loading-animation"></span>
139 </div>
140 </div>
141 </div>
142 </div>
143 </div>
144 <?php
145 return ob_get_clean();
146 }
147 }
148