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 | give.php +174 -99 2.30.04.16.9 View file →
@@ -5,11 +5,11 @@
5 5 * Plugin URI: https://givewp.com
6 6 * Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
7 7 * Author: GiveWP
8 8 * Author URI: https://givewp.com/
9 - * Version: 2.30.0
10 - * Requires at least: 5.0
11 - * Requires PHP: 7.0
9 + * Version: 4.16.9
10 + * Requires at least: 6.9
11 + * Requires PHP: 7.4
12 12 * Text Domain: give
13 13 * Domain Path: /languages
14 14 *
15 15 * Give is free software: you can redistribute it and/or modify
@@ -41,11 +41,13 @@
41 41 *
42 42 * - The GiveWP Team
43 43 */
44 44
45 +use Give\Campaigns\Repositories\CampaignRepository;
45 46 use Give\Container\Container;
47 +use Give\DonationForms\ServiceProvider as DonationFormsServiceProvider;
46 48 use Give\DonationForms\V2\Repositories\DonationFormsRepository;
47 -use Give\DonationForms\V2\ServiceProvider as DonationFormsServiceProvider;
49 +use Give\DonationForms\V2\ServiceProvider as DonationFormsServiceProviderV2;
48 50 use Give\Donations\Repositories\DonationRepository;
49 51 use Give\Donations\ServiceProvider as DonationServiceProvider;
50 52 use Give\DonationSummary\ServiceProvider as DonationSummaryServiceProvider;
51 53 use Give\DonorDashboards\Profile;
@@ -54,22 +56,27 @@
54 56 use Give\Donors\Repositories\DonorRepositoryProxy;
55 57 use Give\Donors\ServiceProvider as DonorsServiceProvider;
56 58 use Give\Form\LegacyConsumer\ServiceProvider as FormLegacyConsumerServiceProvider;
57 59 use Give\Form\Templates;
60 +use Give\FormBuilder\ServiceProvider as FormBuilderServiceProvider;
61 +use Give\FormMigration\ServiceProvider as FormMigrationServiceProvider;
58 62 use Give\Framework\Database\ServiceProvider as DatabaseServiceProvider;
59 63 use Give\Framework\DesignSystem\DesignSystemServiceProvider;
60 64 use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
61 65 use Give\Framework\Exceptions\UncaughtExceptionLogger;
66 +use Give\Framework\FormDesigns\ServiceProvider as FormDesignServiceProvider;
62 67 use Give\Framework\Http\ServiceProvider as HttpServiceProvider;
63 68 use Give\Framework\Migrations\MigrationsServiceProvider;
64 69 use Give\Framework\PaymentGateways\PaymentGatewayRegister;
65 70 use Give\Framework\ValidationRules\ValidationRulesServiceProvider;
66 71 use Give\Framework\WordPressShims\ServiceProvider as WordPressShimsServiceProvider;
72 +use Give\Helpers\Language;
67 73 use Give\LegacySubscriptions\ServiceProvider as LegacySubscriptionsServiceProvider;
68 74 use Give\License\LicenseServiceProvider;
69 75 use Give\Log\LogServiceProvider;
70 76 use Give\MigrationLog\MigrationLogServiceProvider;
71 77 use Give\MultiFormGoals\ServiceProvider as MultiFormGoalsServiceProvider;
78 +use Give\PaymentGateways\Gateways\TestOffsiteGateway\TestOffsiteGateway;
72 79 use Give\PaymentGateways\ServiceProvider as PaymentGatewaysServiceProvider;
73 80 use Give\Promotions\ServiceProvider as PromotionsServiceProvider;
74 81 use Give\Revenue\RevenueServiceProvider;
75 82 use Give\Route\Form as FormRoute;
@@ -83,8 +90,9 @@
83 90 use Give\Subscriptions\Repositories\SubscriptionRepository;
84 91 use Give\Subscriptions\ServiceProvider as SubscriptionServiceProvider;
85 92 use Give\TestData\ServiceProvider as TestDataServiceProvider;
86 93 use Give\Tracking\TrackingServiceProvider;
94 +use Give\VendorOverrides\AdminNotices\AdminNoticesServiceProvider;
87 95 use Give\VendorOverrides\FieldConditions\FieldConditionsServiceProvider;
88 96 use Give\VendorOverrides\Validation\ValidationServiceProvider;
89 97
90 98 // Exit if accessed directly.
@@ -125,8 +133,9 @@
125 133 * @property-read DonationRepository $donations
126 134 * @property-read DonorRepositoryProxy $donors
127 135 * @property-read SubscriptionRepository $subscriptions
128 136 * @property-read DonationFormsRepository $donationForms
137 + * @property-read CampaignRepository $campaigns
129 138 * @property-read Profile $donorDashboard
130 139 * @property-read TabsRegister $donorDashboardTabs
131 140 * @property-read Give_Recurring_DB_Subscription_Meta $subscription_meta
132 141 *
@@ -164,8 +173,20 @@
164 173 */
165 174 public $stripe;
166 175
167 176 /**
177 + * @var Give_DB_Customers
178 + * @deprecated use give()->donors instead
179 + */
180 + public $customers;
181 +
182 + /**
183 + * @var Give_DB_Customer_Meta
184 + * @deprecated use give()->donor_meta instead
185 + */
186 + public $customer_meta;
187 +
188 + /**
168 189 * @since 2.8.0
169 190 *
170 191 * @var Container
171 192 */
@@ -171,9 +192,10 @@
171 192 */
172 193 private $container;
173 194
174 195 /**
175 - * @since 2.25.0 added HttpServiceProvider
196 + * @since 3.17.0 added Settings service provider
197 + * @since 2.25.0 added HttpServiceProvider
176 198 * @since 2.19.6 added Donors, Donations, and Subscriptions
177 199 * @since 2.8.0
178 200 *
179 201 * @var array Array of Service Providers to load
@@ -201,9 +223,9 @@
201 223 Give\Exports\ServiceProvider::class,
202 224 DonationServiceProvider::class,
203 225 DonorsServiceProvider::class,
204 226 SubscriptionServiceProvider::class,
205 - DonationFormsServiceProvider::class,
227 + DonationFormsServiceProviderV2::class,
206 228 PromotionsServiceProvider::class,
207 229 LegacySubscriptionsServiceProvider::class,
208 230 WordPressShimsServiceProvider::class,
209 231 DatabaseServiceProvider::class,
@@ -209,11 +231,32 @@
209 231 DatabaseServiceProvider::class,
210 232 GlobalStylesServiceProvider::class,
211 233 ValidationServiceProvider::class,
212 234 ValidationRulesServiceProvider::class,
235 + AdminNoticesServiceProvider::class,
213 236 HttpServiceProvider::class,
214 237 DesignSystemServiceProvider::class,
215 238 FieldConditionsServiceProvider::class,
239 + FormBuilderServiceProvider::class,
240 + DonationFormsServiceProvider::class,
241 + FormDesignServiceProvider::class,
242 + FormMigrationServiceProvider::class,
243 + //TODO: merge this service provider
244 + Give\PaymentGateways\Gateways\ServiceProvider::class,
245 + Give\EventTickets\ServiceProvider::class,
246 + Give\BetaFeatures\ServiceProvider::class,
247 + Give\FormTaxonomies\ServiceProvider::class,
248 + Give\DonationSpam\ServiceProvider::class,
249 + Give\Settings\ServiceProvider::class,
250 + Give\Campaigns\ServiceProvider::class,
251 + Give\FeatureFlags\OptionBasedFormEditor\ServiceProvider::class,
252 + Give\ThirdPartySupport\ServiceProvider::class,
253 + Give\ThirdPartyCompatibility\ServiceProvider::class,
254 + Give\API\REST\V3\Routes\ServiceProvider::class,
255 + Give\Framework\PaymentGateways\ServiceProvider::class,
256 + Give\ThirdPartySupport\Elementor\ServiceProvider::class,
257 + Give\MCP\ServiceProvider::class,
258 + Give\VendorOverrides\Harbor\HarborServiceProvider::class,
216 259 ];
217 260
218 261 /**
219 262 * @since 2.8.0
@@ -234,29 +277,11 @@
234 277 $this->container = new Container();
235 278 }
236 279
237 280 /**
238 - * Bootstraps the Give Plugin
239 - *
240 - * @since 2.8.0
241 - */
242 - public function boot()
243 - {
244 - $this->setup_constants();
245 -
246 - // Add compatibility notice for recurring and stripe support with Give 2.5.0.
247 - add_action('admin_notices', [$this, 'display_old_recurring_compatibility_notice']);
248 -
249 - add_action('plugins_loaded', [$this, 'init'], 0);
250 -
251 - register_activation_hook(GIVE_PLUGIN_FILE, [$this, 'install']);
252 -
253 - do_action('give_loaded');
254 - }
255 -
256 - /**
257 281 * Init Give when WordPress Initializes.
258 282 *
283 + * @since 3.19.0 Move the loading of the `give` textdomain to the `init` action hook.
259 284 * @since 1.8.9
260 285 */
261 286 public function init()
262 287 {
@@ -266,11 +291,8 @@
266 291 * @since 1.8.9
267 292 */
268 293 do_action('before_give_init');
269 294
270 - // Set up localization.
271 - $this->load_textdomain();
272 -
273 295 $this->bindClasses();
274 296
275 297 $this->setupExceptionHandler();
276 298
@@ -290,11 +312,28 @@
290 312 * @param Give class instance.
291 313 *
292 314 */
293 315 do_action('give_init', $this);
316 +
317 + // Activate any bundled licenses if not already activated.
318 + add_action('admin_init', 'Give_License::activate_bundled_licenses');
294 319 }
295 320
296 321 /**
322 + * Loads the plugin language files.
323 + *
324 + * @since 3.0.0 Use Language class
325 + * @since 1.0
326 + * @access public
327 + *
328 + * @return void
329 + */
330 + public function load_textdomain()
331 + {
332 + Language::load();
333 + }
334 +
335 + /**
297 336 * Binds the initial classes to the service provider.
298 337 *
299 338 * @since 2.8.0
300 339 */
@@ -304,8 +343,79 @@
304 343 $this->container->singleton('routeForm', FormRoute::class);
305 344 }
306 345
307 346 /**
347 + * Sets up the Exception Handler to catch and handle uncaught exceptions
348 + *
349 + * @since 2.11.1
350 + */
351 + private function setupExceptionHandler()
352 + {
353 + $handler = new UncaughtExceptionLogger();
354 + $handler->setupExceptionHandler();
355 + }
356 +
357 + /**
358 + * Load all the service providers to bootstrap the various parts of the application.
359 + *
360 + * @since 2.8.0
361 + */
362 + private function loadServiceProviders()
363 + {
364 + if ($this->providersLoaded) {
365 + return;
366 + }
367 +
368 + $providers = [];
369 +
370 + foreach ($this->serviceProviders as $serviceProvider) {
371 + if (!is_subclass_of($serviceProvider, ServiceProvider::class)) {
372 + throw new InvalidArgumentException(
373 + "$serviceProvider class must implement the ServiceProvider interface"
374 + );
375 + }
376 +
377 + /** @var ServiceProvider $serviceProvider */
378 + $serviceProvider = new $serviceProvider();
379 +
380 + $serviceProvider->register();
381 +
382 + $providers[] = $serviceProvider;
383 + }
384 +
385 + foreach ($providers as $serviceProvider) {
386 + $serviceProvider->boot();
387 + }
388 +
389 + $this->providersLoaded = true;
390 + }
391 +
392 + /**
393 + * Bootstraps the Give Plugin
394 + *
395 + * @since 3.19.0 Load the `give` textdomain on the `init` action hook.
396 + * @since 2.8.0
397 + */
398 + public function boot()
399 + {
400 + $this->setup_constants();
401 +
402 + $this->disableVisualDonationFormBuilderFeaturePlugin();
403 +
404 + // Add compatibility notice for recurring and stripe support with Give 2.5.0.
405 + add_action('admin_notices', [$this, 'display_old_recurring_compatibility_notice']);
406 +
407 + add_action('plugins_loaded', [$this, 'init'], 0);
408 +
409 + // Set up localization.
410 + add_action('init', [$this, 'load_textdomain']);
411 +
412 + register_activation_hook(GIVE_PLUGIN_FILE, [$this, 'install']);
413 +
414 + do_action('give_loaded');
415 + }
416 +
417 + /**
308 418 * Setup plugin constants
309 419 *
310 420 * @since 1.0
311 421 * @access private
@@ -315,9 +425,9 @@
315 425 private function setup_constants()
316 426 {
317 427 // Plugin version.
318 428 if (!defined('GIVE_VERSION')) {
319 - define('GIVE_VERSION', '2.30.0');
429 + define('GIVE_VERSION', '4.16.9');
320 430 }
321 431
322 432 // Plugin Root File.
323 433 if (!defined('GIVE_PLUGIN_FILE')) {
@@ -344,29 +454,30 @@
344 454 define('CAL_GREGORIAN', 1);
345 455 }
346 456 }
347 457
348 - /**
349 - * Loads the plugin language files.
350 - *
351 - * @since 1.0
352 - * @access public
353 - *
354 - * @return void
355 - */
356 - public function load_textdomain()
458 + protected function disableVisualDonationFormBuilderFeaturePlugin()
357 459 {
358 - // Set filter for Give's languages directory
359 - $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)) . '/languages/';
360 - $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
460 + // Include plugin.php to use is_plugin_active() below.
461 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
361 462
362 - // Traditional WordPress plugin locale filter.
363 - $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
364 - $locale = apply_filters('plugin_locale', $locale, 'give');
463 + // Prevent fatal error due to a renamed class.
464 + class_alias(TestOffsiteGateway::class, 'Give\PaymentGateways\Gateways\TestGateway\TestGatewayOffsite', true);
365 465
366 - unload_textdomain('give');
367 - load_textdomain('give', WP_LANG_DIR . '/give/give-' . $locale . '.mo');
368 - load_plugin_textdomain('give', false, $give_lang_dir);
466 + if (is_plugin_active('givewp-next-gen/give-visual-form-builder.php')) {
467 + deactivate_plugins(['givewp-next-gen/give-visual-form-builder.php']);
468 +
469 + add_action('admin_notices', function () {
470 + Give()->notices->register_notice([
471 + 'id' => 'give-visual-donation-form-builder-feature-plugin-deactivated',
472 + 'description' => __(
473 + 'The Visual Form Builder Beta plugin is no longer needed, since the form builder is included in your current version of GiveWP. To prevent conflicts, the Beta plugin has been deactivated and can be safely deleted.',
474 + 'give'
475 + ),
476 + 'type' => 'info',
477 + ]);
478 + });
479 + }
369 480 }
370 481
371 482 /**
372 483 * Display compatibility notice for Give 2.5.0 and Recurring 1.8.13 when Stripe premium is not active.
@@ -403,47 +514,21 @@
403 514 );
404 515 }
405 516 }
406 517
407 - public function install()
408 - {
409 - $this->loadServiceProviders();
410 - give_install();
411 - }
412 -
413 518 /**
414 - * Load all the service providers to bootstrap the various parts of the application.
519 + * Install Give
415 520 *
416 - * @since 2.8.0
521 + * Runs on plugin activation and performs initial setup.
522 + *
523 + * @since 3.4.0 check if installing in WP multisite
524 + * @since 2.33.3 set network_wide parameter to true, enabling installing in WP multisite
525 + * @since 1.0.0
417 526 */
418 - private function loadServiceProviders()
527 + public function install()
419 528 {
420 - if ($this->providersLoaded) {
421 - return;
422 - }
423 -
424 - $providers = [];
425 -
426 - foreach ($this->serviceProviders as $serviceProvider) {
427 - if (!is_subclass_of($serviceProvider, ServiceProvider::class)) {
428 - throw new InvalidArgumentException(
429 - "$serviceProvider class must implement the ServiceProvider interface"
430 - );
431 - }
432 -
433 - /** @var ServiceProvider $serviceProvider */
434 - $serviceProvider = new $serviceProvider();
435 -
436 - $serviceProvider->register();
437 -
438 - $providers[] = $serviceProvider;
439 - }
440 -
441 - foreach ($providers as $serviceProvider) {
442 - $serviceProvider->boot();
443 - }
444 -
445 - $this->providersLoaded = true;
529 + $this->loadServiceProviders();
530 + give_install(is_plugin_active_for_network(GIVE_PLUGIN_BASENAME));
446 531 }
447 532
448 533 /**
449 534 * Register a Service Provider for bootstrapping
@@ -459,11 +544,11 @@
459 544
460 545 /**
461 546 * Magic properties are passed to the service container to retrieve the data.
462 547 *
463 - * @since 2.8.0 retrieve from the service container
464 548 * @since 2.7.0
465 549 *
550 + * @since 2.8.0 retrieve from the service container
466 551 * @param string $propertyName
467 552 *
468 553 * @return mixed
469 554 * @throws Exception
@@ -477,12 +562,12 @@
477 562 * Magic methods are passed to the service container.
478 563 *
479 564 * @since 2.8.0
480 565 *
566 + * @param $name
567 + *
481 568 * @param $arguments
482 569 *
483 - * @param $name
484 - *
485 570 * @return mixed
486 571 */
487 572 public function __call($name, $arguments)
488 573 {
@@ -498,19 +583,8 @@
498 583 public function getContainer(): Container
499 584 {
500 585 return $this->container;
501 586 }
502 -
503 - /**
504 - * Sets up the Exception Handler to catch and handle uncaught exceptions
505 - *
506 - * @since 2.11.1
507 - */
508 - private function setupExceptionHandler()
509 - {
510 - $handler = new UncaughtExceptionLogger();
511 - $handler->setupExceptionHandler();
512 - }
513 587 }
514 588
515 589 /**
516 590 * Start Give
@@ -521,10 +595,11 @@
521 595 * to declare the global.
522 596 *
523 597 * Example: <?php $give = Give(); ?>
524 598 *
525 - * @since 2.8.0 add parameter for quick retrieval from container
526 - * @since 1.0
599 + * @since 4.6.0 add explicit nullable type to give function
600 + * @since 2.8.0 add parameter for quick retrieval from container
601 + * @since 1.0
527 602 *
528 603 * @template T
529 604 *
530 605 * @param class-string<T>|null $abstract Selector for data to retrieve from the service container
@@ -530,9 +605,9 @@
530 605 * @param class-string<T>|null $abstract Selector for data to retrieve from the service container
531 606 *
532 607 * @return Give|T
533 608 */
534 -function give(string $abstract = null)
609 +function give(?string $abstract = null)
535 610 {
536 611 static $instance = null;
537 612
538 613 if ($instance === null) {