PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.8.0
GiveWP – Donation Plugin and Fundraising Platform v2.8.0
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 5 years ago class-settings-display.php 5 years ago class-settings-email.php 6 years ago class-settings-gateways.php 6 years ago class-settings-general.php 5 years ago class-settings-license.php 6 years ago
class-settings-gateways.php
434 lines
1 <?php
2 /**
3 * Give Settings Page/Tab
4 *
5 * @package Give
6 * @subpackage Classes/Give_Settings_Gateways
7 * @copyright Copyright (c) 2016, GiveWP
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.8
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly
14 }
15
16 if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
17
18 /**
19 * Give_Settings_Gateways.
20 *
21 * @sine 1.8
22 */
23 class Give_Settings_Gateways extends Give_Settings_Page {
24
25 /**
26 * Constructor.
27 */
28 public function __construct() {
29 $this->id = 'gateways';
30 $this->label = esc_html__( 'Payment Gateways', 'give' );
31
32 $this->default_tab = 'gateways-settings';
33
34 parent::__construct();
35
36 // Do not use main form for this tab.
37 if ( give_get_current_setting_tab() === $this->id ) {
38 add_action( 'give_admin_field_gateway_notice', array( $this, 'render_gateway_notice' ), 10, 2 );
39 add_action( 'give_admin_field_enabled_gateways', array( $this, 'render_enabled_gateways' ), 10, 2 );
40 }
41 }
42
43 /**
44 * Get settings array.
45 *
46 * @since 1.8
47 * @return array
48 */
49 public function get_settings() {
50 $settings = array();
51 $current_section = give_get_current_setting_section();
52
53 switch ( $current_section ) {
54 case 'paypal-standard':
55 $settings = array(
56 // Section 2: PayPal Standard.
57 array(
58 'type' => 'title',
59 'id' => 'give_title_gateway_settings_2',
60 ),
61 array(
62 'name' => __( 'PayPal Email', 'give' ),
63 'desc' => __( 'Enter the email address associated with your PayPal account to connect with the gateway.', 'give' ),
64 'id' => 'paypal_email',
65 'type' => 'email',
66 ),
67 array(
68 'name' => __( 'PayPal Page Style', 'give' ),
69 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
70 'id' => 'paypal_page_style',
71 'type' => 'text',
72 ),
73 array(
74 'name' => __( 'PayPal Transaction Type', 'give' ),
75 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, GiveWP transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
76 'id' => 'paypal_button_type',
77 'type' => 'radio_inline',
78 'options' => array(
79 'donation' => __( 'Donation', 'give' ),
80 'standard' => __( 'Standard Transaction', 'give' ),
81 ),
82 'default' => 'donation',
83 ),
84 array(
85 'name' => __( 'Billing Details', 'give' ),
86 'desc' => __( 'If enabled, required billing address fields are added to PayPal Standard forms. These fields are not required by PayPal 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' ),
87 'id' => 'paypal_standard_billing_details',
88 'type' => 'radio_inline',
89 'default' => 'disabled',
90 'options' => array(
91 'enabled' => __( 'Enabled', 'give' ),
92 'disabled' => __( 'Disabled', 'give' ),
93 ),
94 ),
95 array(
96 'name' => __( 'PayPal IPN Verification', 'give' ),
97 'desc' => __( 'If enabled, IPN (Instant Payment Notification) messages sent to your site from PayPal are verified with an extra (background) step. The IPN is what marks PayPal donations as complete on GiveWP\'s side. If donations are not getting marked as complete, disabling this extra verification step can resolve it. Only disable this setting to resolve the pending donation issue, since it is technically less secure.', 'give' ),
98 'id' => 'paypal_verification',
99 'type' => 'radio_inline',
100 'default' => 'enabled',
101 'options' => array(
102 'enabled' => __( 'Enabled', 'give' ),
103 'disabled' => __( 'Disabled', 'give' ),
104 ),
105 ),
106 array(
107 'id' => 'paypal_invoice_prefix',
108 'name' => esc_html__( 'Invoice ID Prefix', 'give' ),
109 'desc' => esc_html__( 'Please enter a prefix for your invoice numbers. If you use your PayPal account for multiple fundraising platforms or ecommerce stores, ensure this prefix is unique. PayPal will not allow orders or donations with the same invoice number.', 'give' ),
110 'type' => 'text',
111 'default' => 'GIVE-',
112 ),
113 array(
114 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
115 'id' => 'paypal_standard_gateway_settings_docs_link',
116 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
117 'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
118 'type' => 'give_docs_link',
119 ),
120 array(
121 'type' => 'sectionend',
122 'id' => 'give_title_gateway_settings_2',
123 ),
124 );
125 break;
126
127 case 'offline-donations':
128 $settings = array(
129 // Section 3: Offline gateway.
130 array(
131 'type' => 'title',
132 'id' => 'give_title_gateway_settings_3',
133 ),
134 array(
135 'name' => __( 'Collect Billing Details', 'give' ),
136 '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' ),
137 'id' => 'give_offline_donation_enable_billing_fields',
138 'type' => 'radio_inline',
139 'default' => 'disabled',
140 'options' => array(
141 'enabled' => __( 'Enabled', 'give' ),
142 'disabled' => __( 'Disabled', 'give' ),
143 ),
144 ),
145 array(
146 'name' => __( 'Offline Donation Instructions', 'give' ),
147 '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' ),
148 'id' => 'global_offline_donation_content',
149 'default' => give_get_default_offline_donation_content(),
150 'type' => 'wysiwyg',
151 'options' => array(
152 'textarea_rows' => 6,
153 ),
154 ),
155 array(
156 'name' => esc_html__( 'Offline Donations Settings Docs Link', 'give' ),
157 'id' => 'offline_gateway_settings_docs_link',
158 'url' => esc_url( 'http://docs.givewp.com/offlinegateway' ),
159 'title' => __( 'Offline Gateway Settings', 'give' ),
160 'type' => 'give_docs_link',
161 ),
162 array(
163 'type' => 'sectionend',
164 'id' => 'give_title_gateway_settings_3',
165 ),
166 );
167 break;
168
169 case 'gateways-settings':
170 $settings = array(
171 // Section 1: Gateways.
172 array(
173 'id' => 'give_title_gateway_settings_1',
174 'type' => 'title',
175 ),
176 array(
177 'id' => 'gateway_notice',
178 'type' => 'gateway_notice',
179 ),
180 array(
181 'name' => __( 'Test Mode', 'give' ),
182 'desc' => __( '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.', 'give' ),
183 'id' => 'test_mode',
184 'type' => 'radio_inline',
185 'default' => 'disabled',
186 'options' => array(
187 'enabled' => __( 'Enabled', 'give' ),
188 'disabled' => __( 'Disabled', 'give' ),
189 ),
190 ),
191 array(
192 'name' => __( 'Enabled Gateways', 'give' ),
193 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
194 'id' => 'gateways',
195 'type' => 'enabled_gateways',
196 ),
197
198 /**
199 * "Enabled Gateways" setting field contains gateways label setting but when you save gateway settings then label will not save
200 * because this is not registered setting API and code will not recognize them.
201 *
202 * 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.
203 */
204 array(
205 'name' => __( 'Gateways Label', 'give' ),
206 'desc' => '',
207 'id' => 'gateways_label',
208 'type' => 'gateways_label_hidden',
209 ),
210
211 /**
212 * "Enabled Gateways" setting field contains default gateway setting but when you save gateway settings then this setting will not save
213 * because this is not registered setting API and code will not recognize them.
214 *
215 * 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.
216 */
217 array(
218 'name' => __( 'Default Gateway', 'give' ),
219 'desc' => __( 'The gateway that will be selected by default.', 'give' ),
220 'id' => 'default_gateway',
221 'type' => 'default_gateway_hidden',
222 ),
223
224 array(
225 'name' => __( 'Gateways Docs Link', 'give' ),
226 'id' => 'gateway_settings_docs_link',
227 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ),
228 'title' => __( 'Gateway Settings', 'give' ),
229 'type' => 'give_docs_link',
230 ),
231 array(
232 'id' => 'give_title_gateway_settings_1',
233 'type' => 'sectionend',
234 ),
235 );
236 break;
237 }
238
239 /**
240 * Filter the payment gateways settings.
241 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
242 */
243 $settings = apply_filters( 'give_settings_gateways', $settings );
244
245 /**
246 * Filter the settings.
247 *
248 * @since 1.8
249 *
250 * @param array $settings
251 */
252 $settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
253
254 // Output.
255 return $settings;
256 }
257
258 /**
259 * Get sections.
260 *
261 * @since 1.8
262 * @return array
263 */
264 public function get_sections() {
265 $sections = array(
266 'gateways-settings' => __( 'Gateways', 'give' ),
267 'paypal-standard' => __( 'PayPal Standard', 'give' ),
268 'offline-donations' => __( 'Offline Donations', 'give' ),
269 );
270
271 return apply_filters( 'give_get_sections_' . $this->id, $sections );
272 }
273
274
275 /**
276 * Render Gateway Notice
277 *
278 * @since 2.3.0
279 * @access public
280 *
281 * @param $field
282 * @param $settings
283 */
284 public function render_gateway_notice( $field, $settings ) {
285 $gateways = give_get_payment_gateways();
286
287 // Only display notice if no active gateways are installed. Filter provided for developers to configure display.
288 if (
289 apply_filters( 'give_gateway_upsell_notice_conditions', count( $gateways ) <= 4 ) &&
290 ! Give\Helpers\Gateways\Stripe::isAccountConfigured()
291 ) {
292 ?>
293 <div class="give-gateways-notice">
294 <div class="give-gateways-cc-icon">
295 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="35" height="29" viewBox="0 0 35 29">
296 <defs>
297 <path id="credit-card-a" 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"/>
298 </defs>
299 <g fill="none" fill-rule="evenodd" opacity=".341" transform="translate(0 -3)">
300 <mask id="credit-card-b" fill="#fff">
301 <use xlink:href="#credit-card-a"/>
302 </mask>
303 <g fill="#242A42" mask="url(#credit-card-b)">
304 <rect width="35" height="35"/>
305 </g>
306 </g>
307 </svg>
308 </div>
309
310 <p class="give-gateways-notice-title">
311 <strong>
312 <?php esc_html_e( 'Want to accept credit card donations directly on your website?', 'give' ); ?>
313 </strong>
314 </p>
315
316 <p class="give-gateways-notice-message">
317 <?php
318 printf(
319 __( 'Activate the free Stripe payment gateway %1$s or a premium gateway like <a href="%2$s" target="_blank">PayPal Pro</a>, <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.', 'give' ),
320 Give()->tooltips->render_help( __( '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.', 'give' ) ),
321 'https://givewp.com/addons/paypal-pro-gateway/?utm_source=WP%20Admin%20%3E%20Donations%20%3E%20Settings%20%3E%20Gateways&utm_medium=banner',
322 'https://givewp.com/addons/authorize-net-gateway/?utm_source=WP%20Admin%20%3E%20Donations%20%3E%20Settings%20%3E%20Gateways&utm_medium=banner',
323 'https://givewp.com/addons/stripe-gateway/?utm_source=WP%20Admin%20%3E%20Donations%20%3E%20Settings%20%3E%20Gateways&utm_medium=banner'
324 );
325 ?>
326 </p>
327
328 <div class="give-gateways-notice-button">
329 <?php echo give_stripe_connect_button(); ?>
330 <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" target="_blank" class="give-view-gateways-btn button">
331 <?php esc_html_e( 'View Premium Gateways', 'give' ); ?>
332 </a>
333 </div>
334 </div>
335 <?php
336 }
337 }
338
339 /**
340 * Render enabled gateways
341 *
342 * @since 2.0.5
343 * @access public
344 *
345 * @param $field
346 * @param $settings
347 */
348 public function render_enabled_gateways( $field, $settings ) {
349 $id = $field['id'];
350 $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
351 $gateways_label = give_get_option( 'gateways_label', array() );
352 $default_gateway = give_get_option( 'default_gateway', current( array_keys( $gateways ) ) );
353
354 ob_start();
355
356 echo '<div class="gateway-enabled-wrap">';
357
358 echo '<div class="gateway-enabled-settings-title">';
359 printf(
360 '
361 <span></span>
362 <span>%1$s</span>
363 <span>%2$s</span>
364 <span>%3$s</span>
365 <span>%4$s</span>
366 ',
367 __( 'Gateway', 'give' ),
368 __( 'Label', 'give' ),
369 __( 'Default', 'give' ),
370 __( 'Enabled', 'give' )
371 );
372 echo '</div>';
373
374 echo '<ul class="give-checklist-fields give-payment-gatways-list">';
375 foreach ( $gateways as $key => $option ) :
376 $enabled = null;
377 if ( is_array( $settings ) && array_key_exists( $key, $settings ) ) {
378 $enabled = '1';
379 }
380
381 echo '<li>';
382 printf( '<span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span>' );
383 printf(
384 '<span class="admin-label">%1$s %2$s</span>',
385 esc_html( $option['admin_label'] ),
386 ! empty( $option['admin_tooltip'] ) ? Give()->tooltips->render_help( esc_attr( $option['admin_tooltip'] ) ) : ''
387 );
388
389 $label = '';
390 if ( ! empty( $gateways_label[ $key ] ) ) {
391 $label = $gateways_label[ $key ];
392 }
393
394 printf(
395 '<input class="checkout-label" type="text" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" placeholder="%4$s"/>',
396 'gateways_label',
397 esc_attr( $key ),
398 esc_html( $label ),
399 esc_html( $option['checkout_label'] )
400 );
401
402 printf(
403 '<input class="gateways-radio" type="radio" name="%1$s" value="%2$s" %3$s %4$s>',
404 'default_gateway',
405 $key,
406 checked( $key, $default_gateway, false ),
407 disabled( null, $enabled, false )
408 );
409
410 printf(
411 '<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"/>',
412 esc_attr( $id ),
413 esc_attr( $key ),
414 checked( '1', $enabled, false ),
415 esc_html( $option['admin_label'] )
416 );
417 echo '</li>';
418 endforeach;
419 echo '</ul>';
420
421 echo '</div>'; // end gateway-enabled-wrap.
422
423 printf(
424 '<tr><th>%1$s</th><td>%2$s</td></tr>',
425 $field['title'],
426 ob_get_clean()
427 );
428 }
429 }
430
431 endif;
432
433 return new Give_Settings_Gateways();
434