Use the 'ppcp.path-to-plugin-main-file' config

This commit is contained in:
Narek Zakarian 2025-07-04 19:27:13 +04:00
parent 235a9f45cf
commit 943a0d197c
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
21 changed files with 24 additions and 23 deletions

View file

@ -18,7 +18,7 @@ use WooCommerce\PayPalCommerce\AdminNotices\Endpoint\MuteMessageEndpoint;
return array(
'admin-notices.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-admin-notices/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-admin-notices/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'admin-notices.renderer' => static function ( ContainerInterface $container ): RendererInterface {
return new Renderer(

View file

@ -136,7 +136,7 @@ return array(
return false;
},
'applepay.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-applepay/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-applepay/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'applepay.sdk_script_url' => static function ( ContainerInterface $container ): string {
return 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';

View file

@ -18,7 +18,7 @@ return array(
return true;
},
'axoblock.url' => static function ( ContainerInterface $container ) : string {
return plugins_url( '/modules/ppcp-axo-block/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-axo-block/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'axoblock.method' => static function ( ContainerInterface $container ) : AxoBlockPaymentMethod {
return new AxoBlockPaymentMethod(

View file

@ -59,7 +59,7 @@ return array(
},
'axo.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-axo/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-axo/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'axo.manager' => static function ( ContainerInterface $container ): AxoManager {

View file

@ -17,7 +17,7 @@ use WC_Cart;
return array(
'blocks.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-blocks/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-blocks/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'blocks.method' => static function ( ContainerInterface $container ): PayPalPaymentMethod {
return new PayPalPaymentMethod(

View file

@ -174,7 +174,7 @@ return array(
);
},
'button.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-button/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-button/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'button.pay-now-contexts' => static function ( ContainerInterface $container ): array {
$defaults = array( 'checkout', 'pay-now' );

View file

@ -101,7 +101,7 @@ return array(
},
'compat.module.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-compat/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-compat/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'compat.assets' => function( ContainerInterface $container ) : CompatAssets {

View file

@ -205,7 +205,7 @@ return array(
},
'googlepay.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-googlepay/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-googlepay/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'googlepay.sdk_url' => static function ( ContainerInterface $container ): string {

View file

@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\LocalApmProductSta
return array(
'ppcp-local-apms.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-local-alternative-payment-methods/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-local-alternative-payment-methods/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'ppcp-local-apms.payment-methods' => static function( ContainerInterface $container ): array {
return array(

View file

@ -123,7 +123,7 @@ return array(
},
'onboarding.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-onboarding/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-onboarding/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'onboarding.endpoint.login-seller' => static function ( ContainerInterface $container ) : LoginSellerEndpoint {

View file

@ -43,7 +43,7 @@ return array(
);
},
'order-tracking.module.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-order-tracking/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-order-tracking/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'order-tracking.meta-box.renderer' => static function ( ContainerInterface $container ): MetaBoxRenderer {
return new MetaBoxRenderer(

View file

@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
return array(
'paylater-block.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-paylater-block/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-paylater-block/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'paylater-block.renderer' => static function (): PayLaterBlockRenderer {
return new PayLaterBlockRenderer();

View file

@ -19,7 +19,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
return array(
'paylater-configurator.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-paylater-configurator', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-paylater-configurator', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'paylater-configurator.factory.config' => static function ( ContainerInterface $container ): ConfigFactory {
return new ConfigFactory();

View file

@ -13,7 +13,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
return array(
'paylater-wc-blocks.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-paylater-wc-blocks/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-paylater-wc-blocks/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'paylater-wc-blocks.cart-renderer' => static function ( ContainerInterface $container ): PayLaterWCBlocksRenderer {

View file

@ -30,7 +30,7 @@ return array(
);
},
'paypal-subscriptions.module.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-paypal-subscriptions/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-paypal-subscriptions/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'paypal-subscriptions.renewal-handler' => static function ( ContainerInterface $container ): RenewalHandler {
return new RenewalHandler( $container->get( 'woocommerce.logger.woocommerce' ) );

View file

@ -87,7 +87,7 @@ return array(
);
},
'save-payment-methods.module.url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-save-payment-methods/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-save-payment-methods/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'save-payment-methods.endpoint.create-setup-token' => static function ( ContainerInterface $container ): CreateSetupToken {
return new CreateSetupToken(

View file

@ -75,7 +75,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Helper\MerchantDetails;
return array(
'settings.url' => static function ( ContainerInterface $container ) : string {
return plugins_url( '/modules/ppcp-settings/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-settings/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'settings.data.onboarding' => static function ( ContainerInterface $container ) : OnboardingProfile {
$can_use_casual_selling = $container->get( 'settings.casual-selling.eligible' );
@ -370,7 +370,8 @@ return array(
$merchant_id = $container->get( 'api.partner_merchant_id' );
$button_language_choices = $container->get( 'wcgateway.wp-paypal-locales-map' );
$partner_attribution = $container->get( 'api.helper.partner-attribution' );
return new ScriptDataHandler( $settings, $settings_url, $paylater_is_available, $store_country, $merchant_id, $button_language_choices, $partner_attribution );
$path_to_module_assets_folder = $container->get( 'ppcp.path-to-plugin-folder' ) . 'modules/ppcp-settings/assets';
return new ScriptDataHandler( $settings, $settings_url, $paylater_is_available, $store_country, $merchant_id, $button_language_choices, $partner_attribution, $path_to_module_assets_folder );
},
'settings.ajax.switch_ui' => static function ( ContainerInterface $container ) : SwitchSettingsUiEndpoint {
return new SwitchSettingsUiEndpoint(

View file

@ -79,7 +79,7 @@ return array(
},
'uninstall.module-url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-uninstall/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-uninstall/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'uninstall.clear-db-assets' => function( ContainerInterface $container ) : ClearDatabaseAssets {

View file

@ -13,7 +13,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
return array(
'vaulting.module-url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-vaulting/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-vaulting/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'vaulting.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
$factory = $container->get( 'api.factory.payment-token' );

View file

@ -1351,13 +1351,13 @@ return array(
);
},
'wcgateway.url' => static function ( ContainerInterface $container ): string {
return plugins_url( $container->get( 'wcgateway.relative-path' ), $container->get( 'ppcp.plugin-path' ) );
return plugins_url( $container->get( 'wcgateway.relative-path' ), $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
'wcgateway.relative-path' => static function( ContainerInterface $container ): string {
return 'modules/ppcp-wc-gateway/';
},
'wcgateway.absolute-path' => static function( ContainerInterface $container ): string {
return plugin_dir_path( $container->get( 'ppcp.plugin-path' ) ) . $container->get( 'wcgateway.relative-path' );
return plugin_dir_path( $container->get( 'ppcp.path-to-plugin-main-file' ) ) . $container->get( 'wcgateway.relative-path' );
},
'wcgateway.endpoint.return-url' => static function ( ContainerInterface $container ) : ReturnUrlEndpoint {
$gateway = $container->get( 'wcgateway.paypal-gateway' );

View file

@ -220,6 +220,6 @@ return array(
},
'webhook.module-url' => static function ( ContainerInterface $container ): string {
return plugins_url( '/modules/ppcp-webhooks/', $container->get( 'ppcp.plugin-path' ) );
return plugins_url( '/modules/ppcp-webhooks/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
},
);