PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.6.1
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.6.1
1.6.1 1.6.0 1.5.1 1.5.0 1.4.0 1.3.0 trunk 0.0.1 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0
← All changes | inc/shortcodes/donation-form.php +14 -6 1.1.0 → 1.6.1 View file →
@@ -10,8 +10,9 @@
10 10
11 11 namespace SureDonation\Inc\Shortcodes;
12 12
13 13 use SureDonation\Inc\Fields\Form_Renderer;
14 +use SureDonation\Inc\Fields\Form_Styling;
14 15 use SureDonation\Inc\Helper;
15 16 use SureDonation\Inc\Post_Types\Donation_Form as Donation_Form_CPT;
16 17 use SureDonation\Inc\Traits\Get_Instance;
17 18
@@ -105,10 +106,16 @@
105 106 * @return void
106 107 * @since 0.0.1
107 108 */
108 109 private function enqueue_assets( $form_id, $form ) {
109 - // Enqueue the shared compiled frontend stylesheet (same handle the block uses).
110 - wp_enqueue_style( 'suredonation-donation-form' );
110 + // Enqueue the shared compiled frontend stylesheet (same handle the block
111 + // uses). Skipped when the form has default styling disabled — the site's
112 + // own CSS then controls the appearance. Scripts are always loaded so
113 + // payment and validation keep working. The enqueue is additive across
114 + // forms on a page, so a styled form still loads the stylesheet.
115 + if ( ! Form_Styling::is_default_styling_disabled( $form_id ) ) {
116 + wp_enqueue_style( 'suredonation-donation-form' );
117 + }
111 118
112 119 // Enqueue frontend script (registered globally in Assets\Register).
113 120 wp_enqueue_script( 'suredonation-form-frontend' );
114 121
@@ -129,9 +136,10 @@
129 136
130 137 // Enqueue Stripe.js if Stripe is configured.
131 138 $this->maybe_enqueue_stripe();
132 139
133 - // Allow payment gateway extensions to enqueue their scripts (e.g., PayPal SDK).
140 + // Allow payment gateway extensions to enqueue their scripts and localize
141 + // their frontend configuration (see the action's docblock in block.php).
134 142 do_action( 'suredonation_enqueue_form_frontend_scripts', $form_id, $form->post_content );
135 143 }
136 144
137 145 /**
@@ -144,11 +152,11 @@
144 152 if ( ! class_exists( 'SureDonation\Inc\Payments\Stripe\Stripe_Helper' ) ) {
145 153 return;
146 154 }
147 155
148 - $publishable_key = \SureDonation\Inc\Payments\Stripe\Stripe_Helper::get_stripe_publishable_key();
149 -
150 - if ( ! empty( $publishable_key ) ) {
156 + // Load Stripe.js when any connected account exists; the per-form
157 + // publishable key is passed to the frontend via the payment block markup.
158 + if ( \SureDonation\Inc\Payments\Stripe\Stripe_Helper::is_stripe_connected() ) {
151 159 wp_enqueue_script(
152 160 'stripe-js',
153 161 'https://js.stripe.com/v3/',
154 162 [],