PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.22.2
GiveWP – Donation Plugin and Fundraising Platform v3.22.2
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 / includes / admin / settings / class-settings-gateways.php
give / includes / admin / settings Last commit date
class-settings-addon.php 6 years ago class-settings-advanced.php 1 year ago class-settings-display.php 2 years ago class-settings-email.php 2 years ago class-settings-gateways.php 1 year ago class-settings-general.php 1 year ago class-settings-license.php 4 years ago class-settings-recurring.php 3 years ago
class-settings-gateways.php
654 lines
1 <?php
2
3 /**
4 * Give Settings Page/Tab
5 *
6 * @package Give
7 * @since 1.8
8 * @copyright Copyright (c) 2016, GiveWP
9 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10 * @subpackage Classes/Give_Settings_Gateways
11 */
12
13 use Give\DonationForms\V2\DonationFormsAdminPage;
14 use Give\PaymentGateways\PayPalCommerce\Repositories\MerchantDetails;
15 use Give\PaymentGateways\Stripe\Admin\AccountManagerSettingField;
16
17 if (! defined('ABSPATH')) {
18 exit; // Exit if accessed directly
19 }
20
21 if (! class_exists('Give_Settings_Gateways')) :
22
23 /**
24 * Give_Settings_Gateways.
25 *
26 * @sine 1.8
27 */
28 class Give_Settings_Gateways extends Give_Settings_Page
29 {
30 /**
31 * Constructor.
32 */
33 public function __construct()
34 {
35 $this->id = 'gateways';
36 $this->label = esc_html__('Payment Gateways', 'give');
37
38 $this->default_tab = 'gateways-settings';
39
40 parent::__construct();
41
42 // Do not use main form for this tab.
43 if (give_get_current_setting_tab() === $this->id) {
44 add_action('give_admin_field_gateway_notice', [$this, 'render_gateway_notice'], 10, 2);
45 add_action('give_admin_field_enabled_gateways', [$this, 'render_enabled_gateways'], 10, 2);
46 }
47 }
48
49 /**
50 * Get settings array.
51 *
52 * @since 1.8
53 * @return array
54 */
55 public function get_settings()
56 {
57 $settings = [];
58 $current_section = give_get_current_setting_section();
59
60 switch ($current_section) {
61 case 'offline-donations':
62 $settings = [
63 // Section 3: Offline gateway.
64 [
65 'type' => 'title',
66 'id' => 'give_title_gateway_settings_3',
67 ],
68 [
69 'name' => __('Collect Billing Details', 'give'),
70 'desc' => __('If enabled, required billing address fields are added to Offline Donation forms. These fields are not required to process the transaction, but you may have a need to collect the data. Billing address details are added to both the donation and donor record in GiveWP. ', 'give'),
71 'id' => 'give_offline_donation_enable_billing_fields',
72 'type' => 'radio_inline',
73 'default' => 'disabled',
74 'options' => [
75 'enabled' => __('Enabled', 'give'),
76 'disabled' => __('Disabled', 'give'),
77 ],
78 ],
79 [
80 'name' => __('Offline Donation Instructions', 'give'),
81 'desc' => __('The Offline Donation Instructions are a chance for you to educate the donor on how to best submit offline donations. These instructions appear directly on the form, and after submission of the form. Note: You may also customize the instructions on individual forms as needed.', 'give'),
82 'id' => 'global_offline_donation_content',
83 'default' => give_get_default_offline_donation_content(),
84 'type' => 'wysiwyg',
85 'options' => [
86 'textarea_rows' => 6,
87 ],
88 ],
89 [
90 'name' => esc_html__('Offline Donations Settings Docs Link', 'give'),
91 'id' => 'offline_gateway_settings_docs_link',
92 'url' => esc_url('http://docs.givewp.com/offlinegateway'),
93 'title' => __('Offline Gateway Settings', 'give'),
94 'type' => 'give_docs_link',
95 ],
96 [
97 'type' => 'sectionend',
98 'id' => 'give_title_gateway_settings_3',
99 ],
100 ];
101 break;
102
103 case 'gateways-settings':
104 $settings = [
105 // Section 1: Gateways.
106 [
107 'id' => 'give_title_gateway_settings_1',
108 'type' => 'title',
109 ],
110 [
111 'id' => 'gateway_notice',
112 'type' => 'gateway_notice',
113 ],
114 [
115 'name' => __('Test Mode', 'give'),
116 'desc' => __(
117 'If enabled, donations are processed through the sandbox/test accounts configured in each gateway\'s settings. This prevents having to use real money for tests. See the payment gateway documentation for instructions on configuring sandbox accounts.',
118 'give'
119 ),
120 'id' => 'test_mode',
121 'type' => 'radio_inline',
122 'default' => 'disabled',
123 'options' => [
124 'enabled' => __('Enabled', 'give'),
125 'disabled' => __('Disabled', 'give'),
126 ],
127 ],
128 [
129 'name' => __('Enabled Gateways', 'give') . ' - v2',
130 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
131 'id' => 'gateways',
132 'type' => 'enabled_gateways',
133 ],
134 [
135 'name' => __('Enabled Gateways', 'give') . ' - v3',
136 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
137 'id' => 'gateways_v3',
138 'type' => 'enabled_gateways_hidden',
139 ],
140
141 /**
142 * "Enabled Gateways" setting field contains gateways label setting but when you save gateway settings then label will not save
143 * because this is not registered setting API and code will not recognize them.
144 *
145 * This setting will not render on admin setting screen but help internal code to recognize "gateways_label" setting and add them to give setting when save.
146 */
147 [
148 'name' => __('Gateways Label', 'give') . ' - v2',
149 'desc' => '',
150 'id' => 'gateways_label',
151 'type' => 'gateways_label_hidden',
152 ],
153 [
154 'name' => __('Gateways Label', 'give') . ' - v3',
155 'desc' => '',
156 'id' => 'gateways_label_v3',
157 'type' => 'gateways_label_hidden',
158 ],
159
160 /**
161 * "Enabled Gateways" setting field contains default gateway setting but when you save gateway settings then this setting will not save
162 * because this is not registered setting API and code will not recognize them.
163 *
164 * This setting will not render on admin setting screen but help internal code to recognize "default_gateway" setting and add them to give setting when save.
165 */
166 [
167 'name' => __('Default Gateway', 'give') . ' - v2',
168 'desc' => __('The gateway that will be selected by default.', 'give'),
169 'id' => 'default_gateway',
170 'type' => 'default_gateway_hidden',
171 ],
172 [
173 'name' => __('Default Gateway', 'give') . ' - v3',
174 'desc' => __('The gateway that will be selected by default.', 'give'),
175 'id' => 'default_gateway_v3',
176 'type' => 'default_gateway_hidden',
177 ],
178
179 [
180 'name' => __('Gateways Docs Link', 'give'),
181 'id' => 'gateway_settings_docs_link',
182 'url' => esc_url('http://docs.givewp.com/settings-gateways'),
183 'title' => __('Gateway Settings', 'give'),
184 'type' => 'give_docs_link',
185 ],
186 [
187 'id' => 'give_title_gateway_settings_1',
188 'type' => 'sectionend',
189 ],
190 ];
191 break;
192 }
193
194 /**
195 * Filter the payment gateways settings.
196 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
197 */
198 $settings = apply_filters('give_settings_gateways', $settings);
199
200 /**
201 * Filter the settings.
202 *
203 * @since 1.8
204 *
205 * @param array $settings
206 */
207 $settings = apply_filters('give_get_settings_' . $this->id, $settings);
208
209 // Output.
210 return $settings;
211 }
212
213 /**
214 * Get sections.
215 *
216 * @since 2.9.0 move offline-donations to end of gateway list
217 * @since 1.8
218 *
219 * @return array
220 */
221 public function get_sections()
222 {
223 $sections = apply_filters(
224 'give_get_sections_' . $this->id,
225 [
226 'gateways-settings' => __('Gateways', 'give'),
227 ]
228 );
229
230 $sections['offline-donations'] = __('Offline Donations', 'give');
231
232 return $sections;
233 }
234
235 /**
236 * @since 2.13.0
237 * @return bool
238 */
239 private function hasPremiumPaymentGateway()
240 {
241 $gateways = give_get_payment_gateways();
242
243 return (bool)apply_filters('give_gateway_upsell_notice_conditions', count($gateways) > 8);
244 }
245
246 /**
247 * @since 2.13.0
248 *
249 * @return bool
250 */
251 private function canAcceptCreditCard()
252 {
253 return Give\Helpers\Gateways\Stripe::isAccountConfigured() ||
254 give(MerchantDetails::class)->accountIsConnected();
255 }
256
257
258 /**
259 * Render Gateway Notice
260 *
261 * @since 2.3.0
262 * @access public
263 *
264 * @param $field
265 * @param $settings
266 */
267 public function render_gateway_notice($field, $settings)
268 {
269 if (! $this->hasPremiumPaymentGateway() && ! $this->canAcceptCreditCard()) {
270 ?>
271 <div class="give-gateways-notice">
272 <div class="give-gateways-cc-icon">
273 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="35"
274 height="29" viewBox="0 0 35 29">
275 <defs>
276 <path id="credit-card-a"
277 d="M32.0772569,3.88888889 L2.92274306,3.88888889 C1.30642361,3.88888889 0,5.1953125 0,6.80555556 L0,28.1944444 C0,29.8046875 1.30642361,31.1111111 2.92274306,31.1111111 L32.0772569,31.1111111 C33.6935764,31.1111111 35,29.8046875 35,28.1944444 L35,6.80555556 C35,5.1953125 33.6935764,3.88888889 32.0772569,3.88888889 Z M3.28732639,6.80555556 L31.7126736,6.80555556 C31.9131944,6.80555556 32.0772569,6.96961806 32.0772569,7.17013889 L32.0772569,9.72222222 L2.92274306,9.72222222 L2.92274306,7.17013889 C2.92274306,6.96961806 3.08680556,6.80555556 3.28732639,6.80555556 Z M31.7126736,28.1944444 L3.28732639,28.1944444 C3.08680556,28.1944444 2.92274306,28.0303819 2.92274306,27.8298611 L2.92274306,17.5 L32.0772569,17.5 L32.0772569,27.8298611 C32.0772569,28.0303819 31.9131944,28.1944444 31.7126736,28.1944444 Z M11.6666667,22.1180556 L11.6666667,24.5486111 C11.6666667,24.9496528 11.3385417,25.2777778 10.9375,25.2777778 L6.5625,25.2777778 C6.16145833,25.2777778 5.83333333,24.9496528 5.83333333,24.5486111 L5.83333333,22.1180556 C5.83333333,21.7170139 6.16145833,21.3888889 6.5625,21.3888889 L10.9375,21.3888889 C11.3385417,21.3888889 11.6666667,21.7170139 11.6666667,22.1180556 Z M23.3333333,22.1180556 L23.3333333,24.5486111 C23.3333333,24.9496528 23.0052083,25.2777778 22.6041667,25.2777778 L14.3402778,25.2777778 C13.9392361,25.2777778 13.6111111,24.9496528 13.6111111,24.5486111 L13.6111111,22.1180556 C13.6111111,21.7170139 13.9392361,21.3888889 14.3402778,21.3888889 L22.6041667,21.3888889 C23.0052083,21.3888889 23.3333333,21.7170139 23.3333333,22.1180556 Z" />
278 </defs>
279 <g fill="none" fill-rule="evenodd" opacity=".341" transform="translate(0 -3)">
280 <mask id="credit-card-b" fill="#fff">
281 <use xlink:href="#credit-card-a" />
282 </mask>
283 <g fill="#242A42" mask="url(#credit-card-b)">
284 <rect width="35" height="35" />
285 </g>
286 </g>
287 </svg>
288 </div>
289
290 <p class="give-gateways-notice-title">
291 <strong>
292 <?php esc_html_e(
293 'Want to accept credit card donations directly on your website?',
294 'give'
295 ); ?>
296 </strong>
297 </p>
298
299 <p class="give-gateways-notice-message">
300 <?php
301 printf(
302 __(
303 'Activate the free Stripe payment gateway %1$s, <a href="%2$s" target="_blank">PayPal Donations</a>, or a premium gateway like <a href="%3$s" target="_blank">Authorize.net</a>, or <a href="%4$s" target="_blank">Stripe Premium</a> for no added fees and priority support.',
304 'give'
305 ),
306 Give()->tooltips->render_help(
307 __(
308 'The free version of Stripe includes an additional 2% processing fee in addition to Stripe\'s normal fees for one-time donations. This ensures we can fully support the plugin for the future. Upgrade to the premium Stripe add-on for no added fees.',
309 'give'
310 )
311 ),
312 admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=paypal'),
313 'https://givewp.com/addons/authorize-net-gateway/?utm_source=WP%20Admin%20%3E%20Donations%20%3E%20Settings%20%3E%20Gateways&utm_medium=banner',
314 'https://givewp.com/addons/stripe-gateway/?utm_source=WP%20Admin%20%3E%20Donations%20%3E%20Settings%20%3E%20Gateways&utm_medium=banner'
315 );
316 ?>
317 </p>
318
319 <div class="give-gateways-notice-button">
320 <?php echo give(AccountManagerSettingField::class)->getStripeConnectButtonMarkup(); ?>
321 <a href="https://givewp.com/addons/category/payment-gateways/?utm_source=WP%20Admin%20%3E%20Donations%20%3E%20Settings%20%3E%20Gateways&utm_medium=banner"
322 target="_blank" class="give-view-gateways-btn button">
323 <?php esc_html_e('View Premium Gateways', 'give'); ?>
324 </a>
325 </div>
326 </div>
327 <?php
328 }
329 }
330
331 /**
332 * Render enabled gateways
333 *
334 * @since 3.15.0 Set the v3 settings tab as default in the gateways list
335 * @since 3.0.0 split gateways into separated tabs for v2 and v3 settings
336 * @since 2.0.5
337 * @access public
338 *
339 * @param $field
340 * @param $settings
341 */
342 public function render_enabled_gateways($field, $settings)
343 {
344 $id = $field['id'];
345 $gateways = give_get_payment_gateways();
346
347 $current_page = give_get_current_setting_page();
348 $current_tab = give_get_current_setting_tab();
349 $current_section = give_get_current_setting_section();
350
351 // Legacy gateways are gateways that are not registered with updated gateway registration API.
352 // For example: Razorpay, Paytm, Mollie etc.
353 // These payment gateways support donation processing only with v2 donation forms.
354 $legacyGateways = array_filter(
355 $gateways,
356 static function ($value, $key) {
357 return ! give()->gateways->hasPaymentGateway($key);
358 },
359 ARRAY_FILTER_USE_BOTH
360 );
361
362 // v2 gateways are gateways that are registered with updated gateway registration API.
363 // These payment gateways support donation processing with v2 donation forms.
364 // Legacy payment gateways will display with v2 gateways.
365 $v2Gateways = give_get_ordered_payment_gateways(
366 array_merge(
367 $legacyGateways,
368 array_intersect_key(
369 $gateways,
370 give()->gateways->getPaymentGateways(2)
371 )
372 ),
373 2
374 );
375
376 // v3 gateways are gateways that are registered with updated gateway registration API.
377 // These payment gateways support donation processing with v3 donation forms.
378 $v3Gateways = give_get_ordered_payment_gateways(
379 array_intersect_key($gateways, give()->gateways->getPaymentGateways(3)),
380 3
381 );
382
383 $groups = [
384 'v3' => [
385 'label' => __('Visual Form Builder', 'give'),
386 'gateways' => $v3Gateways,
387 'settings' => give_get_option('gateways_v3', []),
388 'gatewaysLabel' => give_get_option('gateways_label_v3', []),
389 'defaultGateway' => give_get_option('default_gateway_v3', current(array_keys($v3Gateways))),
390 'helper' => [
391 'text' => __(
392 'Uses the blocks-based visual form builder for creating and customizing a donation form.',
393 'give'
394 ),
395 'image' => GIVE_PLUGIN_URL . 'assets/dist/images/admin/give-settings-gateways-v3.jpg',
396 ]
397 ],
398 'v2' => [
399 'label' => __('Option-Based Form Editor', 'give'),
400 'gateways' => $v2Gateways,
401 'settings' => $settings,
402 'gatewaysLabel' => give_get_option('gateways_label', []),
403 'defaultGateway' => give_get_option('default_gateway', current(array_keys($v2Gateways))),
404 'helper' => [
405 'text' => __(
406 'Uses the traditional settings options for creating and customizing a donation form.',
407 'give'
408 ),
409 'image' => GIVE_PLUGIN_URL . 'assets/dist/images/admin/give-settings-gateways-v2.jpg',
410 ],
411 ],
412 ];
413
414 /**
415 * @since 3.18.0
416 */
417 $groups = apply_filters('give_settings_payment_gateways_menu_groups', $groups);
418
419 $defaultGroup = current(array_keys($groups));
420
421 ob_start();
422
423 echo '<h4>' . __('Enabled Gateways', 'give') . '</h4>';
424 echo '<div class="give-settings-section-content give-payment-gateways-settings">';
425
426 if (count($groups) > 1) {
427 echo '<div class="give-settings-section-group-menu">';
428 echo '<ul>';
429 foreach ($groups as $slug => $group) {
430 $current_group = ! empty($_GET['group']) ? give_clean($_GET['group']) : $defaultGroup;
431 $active_class = ($slug === $current_group) ? 'active' : '';
432
433 if ($group['helper']) {
434 $helper = sprintf(
435 '<div class="give-settings-section-group-helper">
436 <img src="%1$s" />
437 <div class="give-settings-section-group-helper__popout">
438 <img src="%2$s" />
439 <h5>%3$s</h5>
440 <p>%4$s</p>
441 </div>
442 </div>',
443 esc_url(GIVE_PLUGIN_URL . 'assets/dist/images/admin/help-circle.svg'),
444 esc_url($group['helper']['image']),
445 esc_html($group['label']),
446 esc_html($group['helper']['text'])
447 );
448 }
449
450 echo sprintf(
451 '<li><a class="%1$s" href="%2$s" data-group="%3$s">%4$s %5$s</a></li>',
452 esc_html($active_class),
453 esc_url(
454 admin_url(
455 "edit.php?post_type=give_forms&page={$current_page}&tab={$current_tab}&section={$current_section}&group={$slug}"
456 )
457 ),
458 esc_html($slug),
459 esc_html($group['label']),
460 $helper ?? ''
461 );
462 }
463 echo '</ul>';
464 echo '</div>';
465 }
466
467 echo '<div class="give-settings-section-group-content">';
468 foreach ($groups as $slug => $group) :
469 $current_group = !empty($_GET['group']) ? give_clean($_GET['group']) : $defaultGroup;
470 $hide_class = $slug !== $current_group ? 'give-hidden' : '';
471 $suffix = $slug === 'v3' ? '_v3' : '';
472
473 printf(
474 '<div id="give-settings-section-group-%1$s" class="give-settings-section-group %2$s">',
475 esc_attr($slug),
476 esc_html($hide_class)
477 );
478
479 echo '<div class="gateway-enabled-wrap">';
480 echo '<div class="gateway-enabled-settings-title">';
481 printf(
482 '
483 <span></span>
484 <span>%1$s</span>
485 <span>%2$s</span>
486 <span style="text-align: center;">%3$s</span>
487 <span style="text-align: center;">%4$s</span>
488 ',
489 __('Gateway', 'give'),
490 __('Label', 'give'),
491 __('Default', 'give'),
492 __('Enabled', 'give')
493 );
494 echo '</div>';
495
496 echo '<ul class="give-checklist-fields give-payment-gatways-list">';
497 foreach ($group['gateways'] as $key => $option) :
498 $enabled = null;
499 if (is_array($group['settings']) && array_key_exists($key, $group['settings'])) {
500 $enabled = '1';
501 }
502
503 echo '<li>';
504 printf('<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>');
505 printf(
506 '<span class="admin-label">%1$s %2$s</span>',
507 esc_html($option['admin_label']),
508 !empty($option['admin_tooltip']) ? Give()->tooltips->render_help(
509 esc_attr($option['admin_tooltip'])
510 ) : ''
511 );
512
513 $label = '';
514 if (!empty($group['gatewaysLabel'][$key])) {
515 $label = $group['gatewaysLabel'][$key];
516 }
517
518 printf(
519 '<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>',
520 'gateways_label' . $suffix,
521 esc_attr($key),
522 esc_html($label),
523 esc_html($option['checkout_label'])
524 );
525
526 printf(
527 '<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>',
528 'default_gateway' . $suffix,
529 $key,
530 checked($key, $group['defaultGateway'], false),
531 disabled(null, $enabled, false)
532 );
533
534 printf(
535 '<input class="gateways-checkbox" name="%1$s[%2$s]" id="%1$s[%2$s]" type="checkbox" value="1" %3$s data-payment-gateway="%4$s"/>',
536 esc_attr($id) . $suffix,
537 esc_attr($key),
538 checked('1', $enabled, false),
539 esc_html($option['admin_label'])
540 );
541 echo '</li>';
542 endforeach;
543 echo '</ul>';
544
545 echo '</div>'; // end gateway-enabled-wrap.
546 echo '</div>'; // end give-settings-section-group-content.
547 endforeach;
548
549 echo '</div>'; // end give-settings-section-content.
550
551 printf('<tr><td colspan="2" style="padding: 0">%s</td></tr>', ob_get_clean());
552
553 $this->maybeRenderNoticeDialog();
554 }
555
556 /**
557 * @since 3.0.0
558 */
559 private function maybeRenderNoticeDialog()
560 {
561 $noticeVersion = '3.0.0';
562 $hasUserSeenGatewayNotice = version_compare(
563 get_user_meta(
564 get_current_user_id(),
565 'give-payment-gateways-settings-dialog-read',
566 true
567 ),
568 $noticeVersion,
569 '>='
570 );
571
572 if ($hasUserSeenGatewayNotice) {
573 return;
574 }
575
576 update_user_meta(
577 get_current_user_id(),
578 'give-payment-gateways-settings-dialog-read',
579 $noticeVersion
580 );
581
582 $supportedGateways = (new DonationFormsAdminPage())->getSupportedGateways();
583 ?>
584
585 <dialog class="give-payment-gateway-settings-dialog" id="give-payment-gateway-settings-dialog">
586 <div class="give-payment-gateway-settings-dialog__header">
587 <?php
588 _e('Feature notice', 'give'); ?>
589 <button
590 class="give-payment-gateway-settings-dialog__close"
591 id="give-payment-gateway-settings-dialog__close"
592 aria-label="<?php
593 esc_attr_e('Close dialog', 'give'); ?>"
594 >
595 <svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 24 24"
596 aria-label="Close dialog icon">
597 <path
598 d="M18.707 6.707a1 1 0 0 0-1.414-1.414L12 10.586 6.707 5.293a1 1 0 0 0-1.414 1.414L10.586 12l-5.293 5.293a1 1 0 1 0 1.414 1.414L12 13.414l5.293 5.293a1 1 0 0 0 1.414-1.414L13.414 12l5.293-5.293z"></path>
599 </svg>
600 </button>
601 </div>
602 <div class="give-payment-gateway-settings-dialog__content">
603 <div class="give-payment-gateway-settings-dialog__content-title">
604 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
605 <path
606 d="M5.5 2a1 1 0 0 0-2 0v1.5H2a1 1 0 0 0 0 2h1.5V7a1 1 0 0 0 2 0V5.5H7a1 1 0 0 0 0-2H5.5V2zM5.5 17a1 1 0 1 0-2 0v1.5H2a1 1 0 1 0 0 2h1.5V22a1 1 0 1 0 2 0v-1.5H7a1 1 0 1 0 0-2H5.5V17zM13.933 2.641a1 1 0 0 0-1.866 0L10.332 7.15c-.3.78-.394 1.006-.523 1.188a2 2 0 0 1-.471.47c-.182.13-.407.224-1.188.524L3.64 11.067a1 1 0 0 0 0 1.866l4.509 1.735c.78.3 1.006.394 1.188.523.182.13.341.29.47.471.13.182.224.407.524 1.188l1.735 4.509a1 1 0 0 0 1.866 0l1.735-4.509c.3-.78.394-1.006.523-1.188.13-.182.29-.341.471-.47.182-.13.407-.224 1.188-.524l4.509-1.735a1 1 0 0 0 0-1.866L17.85 9.332c-.78-.3-1.006-.394-1.188-.523a2.001 2.001 0 0 1-.47-.471c-.13-.182-.224-.407-.524-1.188L13.933 2.64z"
607 fill="#F2CC0C"></path>
608 </svg>
609 <?php
610 esc_html_e('What\'s new', 'give'); ?>
611 </div>
612 <?php
613 esc_html_e(
614 'GiveWP 3.0 introduces an enhanced forms experience powered by the new Visual Donations Form Builder. However, we are still working on gateway compatibility with the new forms experience.',
615 'give'
616 ); ?>
617 <?php
618 if ($supportedGateways) : ?>
619 <div class="give-payment-gateway-settings-dialog__content-title"><?php
620 esc_html_e('Supported gateways', 'give'); ?></div>
621 <div class="give-payment-gateway-settings-dialog__content-itemsContainer">
622 <?php
623 foreach ($supportedGateways as $gateway) : ?>
624 <div class="give-payment-gateway-settings-dialog__content-item">
625 <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
626 xmlns="http://www.w3.org/2000/svg">
627 <path fill-rule="evenodd" clip-rule="evenodd"
628 d="M7.063.986a1.531 1.531 0 0 1 1.872 0l.783.601.98-.129c.69-.09 1.354.294 1.62.935l.377.913.911.376h.002c.641.267 1.025.93.935 1.62l-.13.98.602.783a1.534 1.534 0 0 1 0 1.872l-.601.783.129.98c.09.69-.294 1.354-.935 1.62h-.002l-.91.377-.378.912a1.537 1.537 0 0 1-1.62.936l-.98-.13-.783.601a1.531 1.531 0 0 1-1.872 0l-.782-.6-.98.129a1.537 1.537 0 0 1-1.62-.936l-.377-.912-.911-.376H2.39a1.537 1.537 0 0 1-.935-1.621l.129-.98-.601-.783a1.533 1.533 0 0 1 0-1.872l.601-.782-.129-.98c-.09-.69.294-1.354.935-1.62l.002-.001.91-.376.377-.913a1.537 1.537 0 0 1 1.62-.935l.98.13.783-.602zm3.741 5.82a.667.667 0 0 0-.943-.943L7.333 8.392 6.47 7.53a.667.667 0 1 0-.943.943L6.86 9.806c.26.26.683.26.943 0l3-3z"
629 fill="#459948"></path>
630 </svg>
631 <?php
632 echo $gateway; ?>
633 </div>
634 <?php
635 endforeach; ?>
636 </div>
637 <?php
638 endif; ?>
639 <button class="give-payment-gateway-settings-dialog__content-button"><?php
640 esc_html_e('Got it', 'give'); ?></button>
641 <a href="https://docs.givewp.com/compat-guide" rel="noopener noreferrer" target="_blank"
642 class="give-payment-gateway-settings-dialog__content-link"><?php
643 esc_html_e('Read more on Add-ons and Gateways compatibility', 'give'); ?></a>
644 </div>
645 </dialog>
646
647 <?php
648 }
649 }
650
651 endif;
652
653 return new Give_Settings_Gateways();
654