' . sprintf( esc_html__( 'WooCommerce PayPal Payments requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-paypal-payments' ), 'WooCommerce' ) . '
'; } ); return; } 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; } } add_action( 'plugins_loaded', function () { init(); } ); register_activation_hook( __FILE__, function () { init(); do_action( 'woocommerce_paypal_payments_gateway_activate' ); } ); register_deactivation_hook( __FILE__, function () { init(); do_action( 'woocommerce_paypal_payments_gateway_deactivate' ); } ); // Add "Settings" link to Plugins screen. add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), function( $links ) { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) { return $links; } array_unshift( $links, sprintf( '%2$s', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ), __( 'Settings', 'woocommerce-paypal-payments' ) ) ); return $links; } ); } )();