woocommerce-paypal-payments/woocommerce-paypal-commerce-gateway.php

78 lines
2.1 KiB
PHP
Raw Normal View History

2020-09-17 16:50:04 -03:00
<?php
2020-03-19 16:47:08 +01:00
/**
* Plugin Name: PayPal Payments for WooCommerce
2020-03-19 16:47:08 +01:00
* Plugin URI: TODO
2020-09-17 16:50:04 -03:00
* Description: PayPal's latest complete payments processing solution. Accept PayPal, PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
2020-03-19 16:47:08 +01:00
* Version: dev-master
2020-09-11 10:14:00 +03:00
* Author: WooCommerce
2020-03-19 16:47:08 +01:00
* Author URI: https://inpsyde.com/
* License: GPL-2.0
* Text Domain: paypal-payments-for-woocommerce
2020-09-17 16:50:04 -03:00
*
* @package WooCommerce\PayPalCommerce
2020-03-19 16:47:08 +01:00
*/
2020-09-17 16:50:04 -03:00
declare( strict_types = 1 );
2020-06-15 11:48:37 +03:00
2020-09-11 14:11:10 +03:00
namespace WooCommerce\PayPalCommerce;
2020-04-02 08:38:00 +03:00
use Dhii\Container\CachingContainer;
use Dhii\Container\CompositeCachingServiceProvider;
use Dhii\Container\DelegatingContainer;
use Dhii\Container\ProxyContainer;
use Dhii\Modular\Module\ModuleInterface;
2020-09-17 16:50:04 -03:00
( function () {
2020-09-01 15:27:18 +03:00
include __DIR__ . '/vendor/autoload.php';
2020-04-02 08:38:00 +03:00
2020-09-17 16:50:04 -03:00
/**
* Initialize the plugin and its modules.
*/
function init() {
static $initialized;
if ( ! $initialized ) {
$modules = array( new PluginModule() );
foreach ( glob( plugin_dir_path( __FILE__ ) . 'modules/*/module.php' ) as $module_file ) {
$modules[] = ( require $module_file )();
}
$providers = array();
foreach ( $modules as $module ) {
/* @var $module ModuleInterface module */
$providers[] = $module->setup();
}
$proxy = new ProxyContainer();
$provider = new CompositeCachingServiceProvider( $providers );
$container = new CachingContainer( new DelegatingContainer( $provider ) );
$proxy->setInnerContainer( $container );
foreach ( $modules as $module ) {
/* @var $module ModuleInterface module */
$module->run( $container );
}
$initialized = true;
2020-04-06 10:51:56 +03:00
2020-09-17 16:50:04 -03:00
}
}
2020-04-02 08:38:00 +03:00
2020-09-17 16:50:04 -03:00
add_action(
'plugins_loaded',
function () {
init();
}
);
register_activation_hook(
__FILE__,
function () {
init();
do_action( 'woocommerce_paypal_commerce_gateway_activate' );
}
);
register_deactivation_hook(
__FILE__,
function () {
init();
do_action( 'woocommerce_paypal_commerce_gateway_deactivate' );
}
);
2020-04-06 10:51:56 +03:00
2020-09-17 16:50:04 -03:00
} )();