diff --git a/inc/main.php b/inc/main.php index 6047c3d..b97b9d4 100644 --- a/inc/main.php +++ b/inc/main.php @@ -177,7 +177,7 @@ function gtmkit_admin_init(): void { $notifications_handler = NotificationsHandler::get(); - PluginSuggestions::register( $notifications_handler, $plugin_availability ); + PluginSuggestions::register( $notifications_handler, $plugin_availability, $util ); Analytics::register( $options, $util ); MetaBox::register( $options ); SetupWizard::register( $options, $util ); diff --git a/src/Admin/PluginSuggestions.php b/src/Admin/PluginSuggestions.php index 1e4f743..1a9f243 100644 --- a/src/Admin/PluginSuggestions.php +++ b/src/Admin/PluginSuggestions.php @@ -10,6 +10,7 @@ use TLA_Media\GTM_Kit\Common\Conditionals\EasyDigitalDownloadsConditional; use TLA_Media\GTM_Kit\Common\Conditionals\PremiumConditional; use TLA_Media\GTM_Kit\Common\Conditionals\WooCommerceConditional; +use TLA_Media\GTM_Kit\Common\Util; use TLA_Media\GTM_Kit\Options; /** @@ -31,15 +32,24 @@ final class PluginSuggestions { */ private NotificationsHandler $notifications_handler; + /** + * An instance of Util. + * + * @var Util + */ + private Util $util; + /** * Constructor. * * @param NotificationsHandler $notifications_handler The notifications handler to add notifications to. * @param PluginAvailability $plugin_availability Plugin Availability. + * @param Util $util Util. */ - public function __construct( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability ) { + public function __construct( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability, Util $util ) { $this->notifications_handler = $notifications_handler; $this->plugin_availability = $plugin_availability; + $this->util = $util; } /** @@ -47,11 +57,12 @@ public function __construct( NotificationsHandler $notifications_handler, Plugin * * @param NotificationsHandler $notifications_handler The notifications handler to add notifications to. * @param PluginAvailability $plugin_availability Plugin Availability. + * @param Util $util Util. * * @return void */ - public static function register( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability ): void { - $page = new self( $notifications_handler, $plugin_availability ); + public static function register( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability, Util $util ): void { + $page = new self( $notifications_handler, $plugin_availability, $util ); add_action( 'admin_init', [ $page->plugin_availability, 'register' ] ); add_action( 'admin_init', [ $page, 'suggest_premium' ] ); @@ -303,8 +314,9 @@ protected function get_conflicting_plugin_notification( string $notification_id, */ protected function get_gf_wishlist_plugin_notification( string $notification_id ): Notification { - $link_1 = 'GTM Kit Woo Add-On'; - $link_2 = 'Grandfathered Wishlist Functionality'; + $upgrades_url = $this->util->get_admin_page_url() . 'upgrades'; + $link_1 = 'GTM Kit Woo Add-On'; + $link_2 = 'Grandfathered Wishlist Functionality'; $message = sprintf( /* translators: %1$s and %2$s are links with the text 'GTM Kit Woo Add-On' and 'Grandfathered Wishlist Functionality' respectively. */