PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.22
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.22
1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 1.8.0 All 210 releases
charitable / includes / admin / views / settings / gateways.php

gateways.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.6.22, at includes/admin/views/settings/gateways.php

103 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Display the table of payment gateways.
4 *
5 * @author Eric Daams
6 * @package Charitable/Admin View/Settings
7 * @copyright Copyright (c) 2019, Studio 164a
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.0.0
10 * @version 1.0.0
11 */
12
13 $helper = charitable_get_helper( 'gateways' );
14 $gateways = $helper->get_available_gateways();
15 $default = $helper->get_default_gateway();
16 $upgrades = $helper->get_recommended_gateways();
17
18 foreach ( $gateways as $gateway ) :
19
20 $gateway = new $gateway;
21 $is_active = $helper->is_active_gateway( $gateway->get_gateway_id() );
22
23 if ( $is_active ) {
24 $action_url = esc_url( add_query_arg( array(
25 'charitable_action' => 'disable_gateway',
26 'gateway_id' => $gateway->get_gateway_id(),
27 '_nonce' => wp_create_nonce( 'gateway' ),
28 ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) );
29 $action_text = __( 'Disable Gateway', 'charitable' );
30 } else {
31 $action_url = esc_url( add_query_arg( array(
32 'charitable_action' => 'enable_gateway',
33 'gateway_id' => $gateway->get_gateway_id(),
34 '_nonce' => wp_create_nonce( 'gateway' ),
35 ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) );
36 $action_text = __( 'Enable Gateway', 'charitable' );
37 }
38
39 $action_url = esc_url( add_query_arg( array(
40 'charitable_action' => $is_active ? 'disable_gateway' : 'enable_gateway',
41 'gateway_id' => $gateway->get_gateway_id(),
42 '_nonce' => wp_create_nonce( 'gateway' ),
43 ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) );
44
45 $make_default_url = esc_url( add_query_arg( array(
46 'charitable_action' => 'make_default_gateway',
47 'gateway_id' => $gateway->get_gateway_id(),
48 '_nonce' => wp_create_nonce( 'gateway' ),
49 ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) );
50
51 ?>
52 <div class="charitable-settings-object charitable-gateway cf">
53 <h4><?php echo $gateway->get_name(); ?></h4>
54 <?php if ( $gateway->get_gateway_id() == $default ) : ?>
55
56 <span class="default-gateway"><?php _e( 'Default gateway', 'charitable' ); ?></span>
57
58 <?php elseif ( $is_active ) : ?>
59
60 <a href="<?php echo $make_default_url; ?>" class="make-default-gateway"><?php _e( 'Make default gateway', 'charitable' ); ?></a>
61
62 <?php endif ?>
63 <span class="actions">
64 <?php
65 if ( $is_active ) :
66 $settings_url = esc_url( add_query_arg( array(
67 'group' => 'gateways_' . $gateway->get_gateway_id(),
68 ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) );
69 ?>
70
71 <a href="<?php echo $settings_url; ?>" class="button button-primary"><?php _e( 'Gateway Settings', 'charitable' ); ?></a>
72 <?php endif ?>
73 <a href="<?php echo $action_url; ?>" class="button"><?php echo $action_text; ?></a>
74 </span>
75 </div>
76 <?php endforeach ?>
77 <?php
78 if ( ! empty( $upgrades ) ) :
79 if ( array_key_exists( 'payfast', $upgrades ) ) {
80 $message = sprintf(
81 /* translators: %s: hyperlink */
82 __( '<strong>Tip</strong>: Accept donations in South African Rand with <a href="%s" target="_blank">PayFast</a>.', 'charitable' ),
83 'https://www.wpcharitable.com/extensions/charitable-payfast/?utm_source=gateways-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=payfast'
84 );
85 } elseif ( array_key_exists( 'payumoney', $upgrades ) ) {
86 $message = sprintf(
87 /* translators: %s: hyperlink */
88 __( '<strong>Tip</strong>: Accept donations in Indian Rupee with <a href="%s" target="_blank">PayUMoney</a>.', 'charitable' ),
89 'https://www.wpcharitable.com/extensions/charitable-payu-money/?utm_source=gateways-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=payu-money'
90 );
91 } else {
92 $message = sprintf(
93 /* translators: %1$s: hyperlink; %2$s: single extension name; %3$s: comma-separated list of extension names */
94 __( '<strong>Need more options?</strong> <a href="%1$s" target="_blank">Click here to browse our payment gateway extensions</a>, including %3$s and %2$s.', 'charitable' ),
95 'https://www.wpcharitable.com/extensions/category/payment-gateways/?utm_source=gateways-page&amp;utm_medium=wordpress-dashboard&amp;utm_campaign=gateways',
96 array_pop( $upgrades ),
97 implode( ', ', $upgrades )
98 );
99 }
100 ?>
101 <p class="charitable-gateway-prompt charitable-settings-notice"><?php echo $message; ?></p>
102 <?php endif ?>
103