Skip to content

Commit

Permalink
Link upgrades to upgrade page
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed Sep 12, 2024
1 parent 3aef4b7 commit 737c443
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inc/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
22 changes: 17 additions & 5 deletions src/Admin/PluginSuggestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -31,27 +32,37 @@ 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;
}

/**
* Register
*
* @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' ] );
Expand Down Expand Up @@ -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 = '<a href="https://jump.gtmkit.com/link/2-30DDC" class="gtmkit-text-color-primary gtmkit hover:gtmkit-underline gtmkit-font-bold">GTM Kit Woo Add-On</a>';
$link_2 = '<a href="https://jump.gtmkit.com/link/3-63585" class="gtmkit-text-color-primary gtmkit hover:gtmkit-underline gtmkit-font-bold">Grandfathered Wishlist Functionality</a>';
$upgrades_url = $this->util->get_admin_page_url() . 'upgrades';
$link_1 = '<a href="' . $upgrades_url . '" class="gtmkit-text-color-primary gtmkit hover:gtmkit-underline gtmkit-font-bold">GTM Kit Woo Add-On</a>';
$link_2 = '<a href="https://jump.gtmkit.com/link/3-63585" class="gtmkit-text-color-primary gtmkit hover:gtmkit-underline gtmkit-font-bold">Grandfathered Wishlist Functionality</a>';

$message = sprintf(
/* translators: %1$s and %2$s are links with the text 'GTM Kit Woo Add-On' and 'Grandfathered Wishlist Functionality' respectively. */
Expand Down

0 comments on commit 737c443

Please sign in to comment.