From 31e388ce1d44883581912587a0e608ecf8001c0d Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Fri, 7 Jun 2024 09:55:16 +0200 Subject: [PATCH] Make standalone plugin for easier development and testing. --- .wp-env.json | 13 +++++++++---- composer.json | 28 +++++++++++++++++++++++++++- pronamic-pay-event-espresso.php | 33 ++++++++++++++++++++++++++++++--- 3 files changed, 66 insertions(+), 8 deletions(-) diff --git a/.wp-env.json b/.wp-env.json index 12da052..c12687b 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,12 +1,17 @@ { "core": null, "plugins": [ - ".", - "../../../", - "https://github.com/pronamic/eventespresso/releases/download/4.10.38.p/event-espresso-core-reg-4.10.38.p.zip", + "pronamic/wp-env-quick-login", + "pronamic/wp-pronamic-pay-test-helper", + "https://downloads.wordpress.org/plugin/pronamic-client.zip", "https://downloads.wordpress.org/plugin/query-monitor.zip", - "https://downloads.wordpress.org/plugin/one-time-login.zip" + "https://downloads.wordpress.org/plugin/one-time-login.zip", + "https://downloads.wordpress.org/plugin/wp-plugin-dependencies.zip", + "https://github.com/pronamic/eventespresso/releases/download/4.10.38.p/event-espresso-core-reg-4.10.38.p.zip" ], + "mappings": { + "wp-content/plugins/pronamic-pay-event-espresso": "." + }, "config": { "PRONAMIC_PAY_DEBUG": true } diff --git a/composer.json b/composer.json index 7633251..816c456 100644 --- a/composer.json +++ b/composer.json @@ -40,17 +40,42 @@ } }, "config": { - "sort-packages": true, "allow-plugins": { "composer/installers": true, "dealerdirect/phpcodesniffer-composer-installer": true, "roots/wordpress-core-installer": true, "automattic/jetpack-autoloader": true, "phpstan/extension-installer": true + }, + "platform": { + "php": "8.1" + }, + "platform-check": false, + "sort-packages": true, + "wp-slug": "pronamic-pay-event-espresso" + }, + "extra": { + "installer-paths": { + "packages/{$vendor}/{$name}": [ + "pronamic/wp-datetime", + "pronamic/wp-gravityforms-nl", + "pronamic/wp-html", + "pronamic/wp-http", + "pronamic/wp-mollie", + "pronamic/wp-money", + "pronamic/wp-number", + "vendor:wp-pay", + "vendor:wp-pay-extensions", + "vendor:wp-pay-gateways", + "woocommerce/action-scheduler" + ] } }, "require": { "php": ">=8.0", + "automattic/jetpack-autoloader": "^3.0", + "composer/installers": "^2.2", + "woocommerce/action-scheduler": "^3.8", "wp-pay/core": "^4.16" }, "require-dev": { @@ -63,6 +88,7 @@ "roots/wordpress": "^6.4", "szepeviktor/phpstan-wordpress": "^1.3", "vimeo/psalm": "^0.3.14", + "wp-pay-gateways/mollie": "^4.11", "wp-phpunit/wp-phpunit": "^6.4", "yoast/phpunit-polyfills": "^2.0" }, diff --git a/pronamic-pay-event-espresso.php b/pronamic-pay-event-espresso.php index 5ccf567..f1ca665 100644 --- a/pronamic-pay-event-espresso.php +++ b/pronamic-pay-event-espresso.php @@ -16,9 +16,6 @@ * * License: GPL-3.0-or-later * - * Requires Plugins: pronamic-ideal - * Depends: wp-pay/core - * * GitHub URI: https://github.com/pronamic/wp-pronamic-pay-event-espresso * * @author Pronamic @@ -27,6 +24,25 @@ * @package Pronamic\WordPress\Pay\Extensions\EventEspresso */ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Autoload. + */ +require_once __DIR__ . '/vendor/autoload_packages.php'; + +/** + * Bootstrap. + */ +\Pronamic\WordPress\Pay\Plugin::instance( + [ + 'file' => __FILE__, + 'action_scheduler' => __DIR__ . '/packages/woocommerce/action-scheduler/action-scheduler.php', + ] +); + add_filter( 'pronamic_pay_plugin_integrations', function ( $integrations ) { @@ -41,3 +57,14 @@ function ( $integrations ) { return $integrations; } ); + +if ( class_exists( \Pronamic\WordPress\Pay\Gateways\Mollie\Integration::class ) ) { + add_filter( + 'pronamic_pay_gateways', + function ( $gateways ) { + $gateways[] = new \Pronamic\WordPress\Pay\Gateways\Mollie\Integration(); + + return $gateways; + } + ); +}