PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Admin / SettingsPages / Membership / PaymentMethods.php
wp-user-avatar / src / Admin / SettingsPages / Membership Last commit date
CouponsPage 1 year ago CustomersPage 5 months ago DashboardPage 1 year ago DownloadLogsPage 1 year ago ExportPage 5 months ago GroupsPage 1 year ago OrdersPage 1 year ago PlansPage 2 months ago SubscriptionsPage 3 months ago TaxSettings 3 years ago views 1 month ago CheckListHeader.php 3 years ago CheckoutFieldsManager.php 1 year ago ContextualStateChangeHelper.php 3 years ago FileDownloads.php 3 years ago PaymentMethods.php 1 year ago PaymentSettings.php 1 month ago PlanIntegrationsMetabox.php 10 months ago SettingsFieldsParser.php 1 year ago index.php 3 years ago
PaymentMethods.php
147 lines
1 <?php
2
3 namespace ProfilePress\Core\Admin\SettingsPages\Membership;
4
5 use ProfilePress\Core\Admin\SettingsPages\AbstractSettingsPage;
6 use ProfilePress\Core\Membership\PaymentMethods\PaymentMethods as PaymentGateways;
7 use ProfilePress\Custom_Settings_Page_Api;
8
9 class PaymentMethods
10 {
11 public function __construct()
12 {
13 add_filter('ppress_settings_page_submenus_tabs', [$this, 'header_sub_menu_tab']);
14
15 add_action('ppress_admin_settings_submenu_page_payments_payment-methods', [$this, 'payment_methods_page']);
16
17 add_action('ppress_register_menu_page_payments_payment-methods', function () {
18
19 add_filter('ppress_general_settings_admin_page_title', function () {
20 return esc_html__('Payment Methods &lsaquo; Payments', 'wp-user-avatar');
21 });
22
23 add_action('admin_footer', [$this, 'js_script']);
24 });
25 }
26
27 public function header_sub_menu_tab($tabs)
28 {
29 $tabs[173] = ['parent' => 'payments', 'id' => 'payment-methods', 'label' => esc_html__('Payment Methods', 'wp-user-avatar')];
30
31 return $tabs;
32 }
33
34 public function payment_method_list()
35 {
36 ob_start();
37 require dirname(__FILE__) . '/views/payment-method-list.php';
38
39 return ob_get_clean();
40 }
41
42 protected function get_enabled_payment_methods()
43 {
44 $methods = PaymentGateways::get_instance()->get_enabled_methods();
45
46 $bucket = ['' => __('&mdash; No gateway &mdash;', 'wp-user-avatar')];
47
48 foreach ($methods as $id => $method) {
49 $bucket[$id] = $method->get_method_title();
50 }
51
52 return $bucket;
53 }
54
55 public function payment_methods_page()
56 {
57 $instance = Custom_Settings_Page_Api::instance();
58 $instance->option_name(PPRESS_PAYMENT_METHODS_OPTION_NAME);
59 $instance->page_header(esc_html__('Payment Methods', 'wp-user-avatar'));
60
61 if ( ! empty($_GET['method'])) {
62
63 $method = PaymentGateways::get_instance()->get_by_id(
64 sanitize_text_field($_GET['method'])
65 );
66
67 if ( ! $method) {
68 ppress_do_admin_redirect(add_query_arg(['view' => 'payments', 'section' => 'payment-methods'], PPRESS_SETTINGS_SETTING_PAGE));
69 }
70
71 $instance->page_header($method->get_method_title());
72
73 add_action('wp_cspa_after_header', function () use ($method) {
74 echo '<p>' . $method->get_method_description() . '</p>';
75 });
76
77 $settings = [];
78 foreach ($method->admin_settings() as $key => $setting) {
79 $settings[0][$method->id . '_' . $key] = $setting;
80 }
81
82 } else {
83
84 $instance->add_view_classes('ppress-payment-methods-list');
85
86 $settings = [
87 [
88 'payment_method_list' => [
89 'type' => 'arbitrary',
90 'data' => $this->payment_method_list(),
91 ],
92 'test_mode' => [
93 'label' => esc_html__('Test Mode', 'wp-user-avatar'),
94 'description' => esc_html__('When test mode is enabled, no live transactions are processed. Use test mode in conjunction with the sandbox/test account for the payment method to test.', 'wp-user-avatar'),
95 'type' => 'checkbox'
96 ],
97 'test_mode_reconnection_notice' => [
98 'label' => '',
99 'data' => '<style>#test_mode_reconnection_notice_row {display:none}</style><div class="pp-alert-notice pp-alert-notice-info"><p>' . __('Switching test/live modes would require payment methods reconnection or setup.', 'wp-user-avatar') . '</p></div>',
100 'type' => 'custom_field_block'
101 ],
102 'default_payment_method' => [
103 'label' => esc_html__('Default Payment Method', 'wp-user-avatar'),
104 'description' => esc_html__('Select payment method to automatically load on the checkout page. If empty, the first active method is selected instead.', 'wp-user-avatar'),
105 'type' => 'select',
106 'options' => $this->get_enabled_payment_methods()
107 ]
108 ]
109 ];
110
111 add_action('wp_cspa_after_header', function () {
112 echo '<p>' . esc_html__('Installed payment methods are listed below. Drag and drop to control their display order on the frontend.', 'wp-user-avatar') . '</p>';
113 });
114 }
115
116 $instance->main_content($settings);
117 $instance->remove_white_design();
118 AbstractSettingsPage::register_core_settings($instance, true);
119 $instance->build(true);
120 }
121
122 public function js_script()
123 {
124 ?>
125 <script type="text/javascript">
126 (function ($) {
127 $(function () {
128 $('#test_mode').on('change', function () {
129 $('#test_mode_reconnection_notice_row').show();
130 });
131 });
132 })(jQuery)
133 </script>
134 <?php
135 }
136
137 public static function get_instance()
138 {
139 static $instance = null;
140
141 if (is_null($instance)) {
142 $instance = new self();
143 }
144
145 return $instance;
146 }
147 }