PluginProbe
Pronamic Pay / trunk
Pronamic Pay vtrunk
10.2.0 10.1.0 8.4.0 8.4.1 8.5.0 8.5.1 9.0.0 9.0.1 9.1.0 9.1.1 9.1.2 9.1.3 9.10.0 9.10.1 9.11.0 9.11.1 9.12.0 9.12.1 9.13.0 9.14.0 9.14.1 9.15.0 9.15.1 9.16.0 9.17.0 All 291 releases
pronamic-ideal / pronamic-ideal.php

pronamic-ideal.php in Pronamic Pay trunk, at pronamic-ideal.php

335 lines 8.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Pronamic Pay
4 * Plugin URI: https://www.pronamic.eu/plugins/pronamic-pay/
5 * Description: The Pronamic Pay plugin adds payment methods like iDEAL | Wero, Bancontact, credit card and more to your WordPress site for a variety of payment providers.
6 *
7 * Version: 10.2.0
8 * Requires at least: 6.8
9 * Requires PHP: 8.2
10 *
11 * Author: Pronamic
12 * Author URI: https://www.pronamic.eu/
13 *
14 * Text Domain: pronamic-ideal
15 * Domain Path: /languages/
16 *
17 * Provides: wp-pay/core
18 *
19 * License: GPL-2.0-or-later
20 *
21 * GitHub URI: https://github.com/pronamic/wp-pronamic-pay
22 *
23 * @author Pronamic <info@pronamic.eu>
24 * @copyright 2005-2026 Pronamic
25 * @license GPL-3.0-or-later
26 * @package Pronamic\WordPress\Pay
27 */
28
29 if ( ! defined( 'ABSPATH' ) ) {
30 exit;
31 }
32
33 if ( ! defined( 'PRONAMIC_PAY_DEBUG' ) ) {
34 define( 'PRONAMIC_PAY_DEBUG', false );
35 }
36
37 /**
38 * Autoload.
39 */
40 require_once __DIR__ . '/vendor/autoload_packages.php';
41
42 /**
43 * Bootstrap.
44 */
45 add_action(
46 'plugins_loaded',
47 function () {
48 load_plugin_textdomain( 'pronamic-ideal', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
49 }
50 );
51
52 \Pronamic\WordPress\Pay\Plugin::instance(
53 [
54 'file' => __FILE__,
55 'options' => [
56 'about_page_file' => __DIR__ . '/admin/page-about.php',
57 ],
58 'action_scheduler' => __DIR__ . '/packages/woocommerce/action-scheduler/action-scheduler.php',
59 'pronamic_service_url' => 'https://api.wp-pay.org/wp-json/pronamic-pay/v1/payments',
60 ]
61 );
62
63 \Pronamic\WordPress\Pay\LicenseManager::instance();
64
65 \Pronamic\WordPress\Updater\Plugin::instance()->setup();
66
67 \Pronamic\PronamicPayAdminReports\Plugin::instance()->setup();
68
69 \Pronamic\PronamicForms\Plugin::instance();
70
71 \Pronamic\PronamicPayDefaultPaymentMethods\Plugin::instance();
72
73 /**
74 * Plugin dependencies.
75 *
76 * @link https://make.wordpress.org/core/2024/03/05/introducing-plugin-dependencies-in-wordpress-6-5/
77 * @link https://github.com/pronamic/wp-pronamic-pay-adyen/issues/25
78 */
79 add_filter(
80 'wp_plugin_dependencies_slug',
81 function ( $slug ) {
82 if ( 'pronamic-ideal' === $slug ) {
83 return dirname( __DIR__ );
84 }
85
86 return $slug;
87 }
88 );
89
90 add_filter(
91 'pronamic_pay_modules',
92 function ( $modules ) {
93 $modules[] = 'forms';
94 $modules[] = 'subscriptions';
95
96 return $modules;
97 }
98 );
99
100 add_filter(
101 'pronamic_pay_plugin_integrations',
102 function ( $integrations ) {
103 $classes = [
104 \Pronamic\WordPress\Pay\Forms\Integration::class,
105 \Pronamic\WordPress\Pay\Extensions\Charitable\Extension::class,
106 \Pronamic\WordPress\Pay\Extensions\EasyDigitalDownloads\Extension::class,
107 \Pronamic\WordPress\Pay\Extensions\EventEspresso\Extension::class,
108 \Pronamic\WordPress\Pay\Extensions\Give\Extension::class,
109 \Pronamic\WordPress\Pay\Extensions\WooCommerce\Extension::class,
110 \Pronamic\WordPress\Pay\Extensions\GravityForms\Extension::class,
111 \Pronamic\WordPress\Pay\Extensions\FormidableForms\Extension::class,
112 \Pronamic\WordPress\Pay\Extensions\MemberPress\Extension::class,
113 \Pronamic\WordPress\Pay\Extensions\NinjaForms\Extension::class,
114 \Pronamic\WordPress\Pay\Extensions\RestrictContent\Extension::class,
115 ];
116
117 foreach ( $classes as $class ) {
118 if ( ! array_key_exists( $class, $integrations ) ) {
119 $integrations[ $class ] = new $class();
120 }
121 }
122
123 return $integrations;
124 }
125 );
126
127 add_filter(
128 'get_post_metadata',
129 function ( $value, $post_id, $meta_key, $single ) {
130 static $filter = true;
131
132 if ( false === $filter ) {
133 return $value;
134 }
135
136 if ( '_pronamic_gateway_id' !== $meta_key ) {
137 return $value;
138 }
139
140 $filter = false;
141
142 $value = get_post_meta( $post_id, $meta_key, $single );
143
144 $filter = true;
145
146 $mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
147
148 switch ( $value ) {
149 case 'adyen':
150 return ( 'test' === $mode ) ? 'adyen-test' : 'adyen';
151 case 'buckaroo':
152 return ( 'test' === $mode ) ? 'buckaroo-test' : 'buckaroo';
153 case 'ems-ecommerce':
154 return ( 'test' === $mode ) ? 'ems-ecommerce-test' : 'ems-ecommerce';
155 case 'multisafepay-connect':
156 return ( 'test' === $mode ) ? 'multisafepay-connect-test' : 'multisafepay-connect';
157 case 'paypal':
158 return ( 'test' === $mode ) ? 'paypal-sandbox' : 'paypal';
159 case 'rabobank-omnikassa-2':
160 return ( 'test' === $mode ) ? 'rabobank-omnikassa-2-sandbox' : 'rabobank-omnikassa-2';
161 }
162
163 return $value;
164 },
165 10,
166 4
167 );
168
169 add_filter(
170 'pronamic_pay_gateways',
171 function ( $gateways ) {
172 // Buckaroo.
173 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\Buckaroo\Integration(
174 [
175 'id' => 'buckaroo',
176 'name' => 'Buckaroo',
177 'mode' => 'live',
178 'host' => 'checkout.buckaroo.nl',
179 ]
180 );
181
182 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\Buckaroo\Integration(
183 [
184 'id' => 'buckaroo-test',
185 'name' => 'Buckaroo - Test',
186 'mode' => 'test',
187 'host' => 'testcheckout.buckaroo.nl',
188 ]
189 );
190
191 // EMS - eCommerce.
192 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\EMS\ECommerce\Integration(
193 [
194 'id' => 'ems-ecommerce',
195 'name' => 'EMS e-Commerce',
196 'mode' => 'live',
197 'action_url' => 'https://www.ipg-online.com/connect/gateway/processing',
198 'dashboard_url' => 'https://www.ipg-online.com/vt/login',
199 ]
200 );
201
202 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\EMS\ECommerce\Integration(
203 [
204 'id' => 'ems-ecommerce-test',
205 'name' => 'EMS e-Commerce - Test',
206 'mode' => 'test',
207 'action_url' => 'https://test.ipg-online.com/connect/gateway/processing',
208 'dashboard_url' => 'https://test.ipg-online.com/vt/login',
209 ]
210 );
211
212 // ING Checkout.
213 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\PayNL\Integration(
214 [
215 'id' => 'ing-checkout',
216 'name' => 'ING - ING Checkout',
217 'mode' => 'live',
218 'provider' => 'ing',
219 ]
220 );
221
222 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\PayNL\Integration(
223 [
224 'id' => 'ing-checkout-test',
225 'name' => 'ING - ING Checkout - Test',
226 'mode' => 'test',
227 'provider' => 'ing',
228 ]
229 );
230
231 // Mollie.
232 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\Mollie\Integration(
233 [
234 'manual_url' => 'https://www.pronamicpay.com/en/manuals/how-to-connect-mollie-to-wordpress-with-pronamic-pay/',
235 ]
236 );
237
238 // MultiSafePay - Connect.
239 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\MultiSafepay\Integration(
240 [
241 'id' => 'multisafepay-connect',
242 'name' => 'MultiSafepay - Connect',
243 'mode' => 'live',
244 'api_url' => 'https://api.multisafepay.com/ewx/',
245 ]
246 );
247
248 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\MultiSafepay\Integration(
249 [
250 'id' => 'multisafepay-connect-test',
251 'name' => 'MultiSafepay - Connect - Test',
252 'mode' => 'test',
253 'api_url' => 'https://testapi.multisafepay.com/ewx/',
254 ]
255 );
256
257 // Rabobank - Rabo Smart Pay.
258 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\OmniKassa2\Integration(
259 [
260 'id' => 'rabobank-omnikassa-2',
261 'name' => 'Rabobank - Rabo Smart Pay',
262 'mode' => 'live',
263 'api_url' => 'https://betalen.rabobank.nl/omnikassa-api/',
264 ]
265 );
266
267 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\OmniKassa2\Integration(
268 [
269 'id' => 'rabobank-omnikassa-2-sandbox',
270 'name' => 'Rabobank - Rabo Smart Pay - Sandbox',
271 'mode' => 'test',
272 'api_url' => 'https://betalen.rabobank.nl/omnikassa-api-sandbox/',
273 ]
274 );
275
276 // Pay.nl.
277 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\PayNL\Integration();
278
279 // Sisow.
280 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\Buckaroo\Integration(
281 [
282 'id' => 'sisow-buckaroo',
283 'name' => 'Sisow via Buckaroo',
284 'mode' => 'live',
285 'host' => 'checkout.buckaroo.nl',
286 'meta_key_website_key' => 'sisow_merchant_id',
287 'meta_key_secret_key' => 'sisow_merchant_key',
288 'deprecated' => true,
289 ]
290 );
291
292 $gateways[] = new \Pronamic\WordPress\Pay\Gateways\Buckaroo\Integration(
293 [
294 'id' => 'sisow-buckaroo-test',
295 'name' => 'Sisow via Buckaroo - Test',
296 'mode' => 'test',
297 'host' => 'testcheckout.buckaroo.nl',
298 'meta_key_website_key' => 'sisow_merchant_id',
299 'meta_key_secret_key' => 'sisow_merchant_key',
300 'deprecated' => true,
301 ]
302 );
303
304 return $gateways;
305 }
306 );
307
308 \add_action(
309 'init',
310 function () {
311 /**
312 * Script translations.
313 *
314 * @link https://github.com/pronamic/pronamic-pay-payments-experimental/issues/42
315 */
316 $block_types = \array_filter(
317 \WP_Block_Type_Registry::get_instance()->get_all_registered(),
318 function ( $block_type ) {
319 return isset( $block_type->category ) && 'pronamic-forms' === $block_type->category;
320 }
321 );
322
323 foreach ( $block_types as $block_type ) {
324 foreach ( $block_type->editor_script_handles as $handle ) {
325 \wp_set_script_translations(
326 $handle,
327 'pronamic-ideal',
328 __DIR__ . '/languages'
329 );
330 }
331 }
332 },
333 50
334 );
335