PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 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 All 255 releases
← All changes | src/ServiceProviders/LegacyServiceProvider.php +30 -16 2.30.04.16.9 View file →
@@ -1,11 +1,16 @@
1 1 <?php
2 2
3 3 namespace Give\ServiceProviders;
4 4
5 -use _PHPStan_9a6ded56a\Nette\Neon\Exception;
6 5 use Closure;
6 +use Give\Framework\Migrations\MigrationsRegister;
7 +use Give\Framework\Permissions\Migrations\AddViewCapabilitiesToAdminRoles;
8 +use Give\Framework\Permissions\Migrations\FixGiveAccountantCapabilities;
9 +use Give\Framework\Permissions\Migrations\FixGiveWorkerCapabilities;
10 +use Give\PaymentGateways\Gateways\Stripe\LegacyStripeAdapter;
7 11 use Give\Route\Form;
12 +use Give\ServiceProviders\Exceptions\UnknownRequestTypeException;
8 13
9 14 /**
10 15 * Class LegacyServiceProvider
11 16 *
@@ -19,8 +24,12 @@
19 24 * @inheritDoc
20 25 */
21 26 public function register()
22 27 {
28 + // TODO: move this
29 + // this needs to load before the LegacyServiceProvider loads in GiveWP.
30 + give(LegacyStripeAdapter::class)->addToStripeSupportedPaymentMethodsList();
31 +
23 32 $this->includeLegacyFiles();
24 33 $this->bindClasses();
25 34 }
26 35
@@ -28,13 +37,30 @@
28 37 * @inheritDoc
29 38 */
30 39 public function boot()
31 40 {
41 + $this->registerMigrations();
32 42 }
33 43
34 44 /**
45 + * Register migrations for legacy components.
46 + *
47 + * @since 4.14.0 added migrations FixGiveWorkerCapabilities, FixGiveAccountantCapabilities, AddViewCapabilitiesToAdminRoles
48 + */
49 + private function registerMigrations(): void
50 + {
51 + give(MigrationsRegister::class)->addMigrations([
52 + FixGiveWorkerCapabilities::class,
53 + FixGiveAccountantCapabilities::class,
54 + AddViewCapabilitiesToAdminRoles::class,
55 + ]);
56 + }
57 +
58 + /**
35 59 * Load all the legacy class files since they don't have auto-loading
36 60 *
61 + * @since 3.1.2 remove WP_Background_Process & WP_Async_Request in favor of namespaced versions.
62 + * @since 3.0.0 remove the manual (Test Donations) gateway from loading in favor of the new Test Donations gateway
37 63 * @since 2.8.0
38 64 */
39 65 private function includeLegacyFiles()
40 66 {
@@ -41,19 +67,8 @@
41 67 global $give_options;
42 68
43 69 require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache-setting.php';
44 70
45 - /**
46 - * Load libraries.
47 - */
48 - if (!class_exists('WP_Async_Request')) {
49 - include_once GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php';
50 - }
51 -
52 - if (!class_exists('WP_Background_Process')) {
53 - include_once GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php';
54 - }
55 -
56 71 require_once GIVE_PLUGIN_DIR . 'includes/setting-functions.php';
57 72 require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
58 73 require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
59 74 require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
@@ -128,9 +143,8 @@
128 143
129 144 require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
130 145 require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal/paypal-standard.php';
131 146 require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
132 - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
133 147 require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
134 148 require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
135 149 require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
136 150 require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
@@ -224,12 +238,12 @@
224 238 * to the container.
225 239 *
226 240 * @since 2.8.0
227 241 *
228 - * @param string $alias
242 + * @param string $alias
229 243 * @param string|Closure $class
230 - * @param string $includesPath
231 - * @param bool $singleton
244 + * @param string $includesPath
245 + * @param bool $singleton
232 246 */
233 247 private function bindInstance($alias, $class, $includesPath, $singleton = false)
234 248 {
235 249 require_once GIVE_PLUGIN_DIR . "includes/$includesPath";