diff --git a/inc/main.php b/inc/main.php index b97b9d4..b907b3e 100644 --- a/inc/main.php +++ b/inc/main.php @@ -17,7 +17,7 @@ use TLA_Media\GTM_Kit\Admin\NotificationsHandler; use TLA_Media\GTM_Kit\Admin\PluginAvailability; use TLA_Media\GTM_Kit\Admin\SetupWizard; -use TLA_Media\GTM_Kit\Admin\PluginSuggestions; +use TLA_Media\GTM_Kit\Admin\Suggestions; use TLA_Media\GTM_Kit\Admin\TemplatesOptionsPage; use TLA_Media\GTM_Kit\Common\Conditionals\ContactForm7Conditional; use TLA_Media\GTM_Kit\Common\Conditionals\EasyDigitalDownloadsConditional; @@ -30,6 +30,7 @@ use TLA_Media\GTM_Kit\Frontend\Stape; use TLA_Media\GTM_Kit\Frontend\UserData; use TLA_Media\GTM_Kit\Installation\Activation; +use TLA_Media\GTM_Kit\Installation\AutomaticUpdates; use TLA_Media\GTM_Kit\Installation\Upgrade; use TLA_Media\GTM_Kit\Integration\ContactForm7; use TLA_Media\GTM_Kit\Integration\EasyDigitalDownloads; @@ -177,7 +178,7 @@ function gtmkit_admin_init(): void { $notifications_handler = NotificationsHandler::get(); - PluginSuggestions::register( $notifications_handler, $plugin_availability, $util ); + Suggestions::register( $notifications_handler, $plugin_availability, $options, $util ); Analytics::register( $options, $util ); MetaBox::register( $options ); SetupWizard::register( $options, $util ); diff --git a/src/Admin/PluginSuggestions.php b/src/Admin/Suggestions.php similarity index 94% rename from src/Admin/PluginSuggestions.php rename to src/Admin/Suggestions.php index 4b02ed1..561a9e1 100644 --- a/src/Admin/PluginSuggestions.php +++ b/src/Admin/Suggestions.php @@ -14,9 +14,9 @@ use TLA_Media\GTM_Kit\Options; /** - * Suggested plugins + * Suggestions */ -final class PluginSuggestions { +final class Suggestions { /** * An instance of PluginAvailability. @@ -32,6 +32,13 @@ final class PluginSuggestions { */ private NotificationsHandler $notifications_handler; + /** + * An instance of Options. + * + * @var Options + */ + private Options $options; + /** * An instance of Util. * @@ -44,11 +51,13 @@ final class PluginSuggestions { * * @param NotificationsHandler $notifications_handler The notifications handler to add notifications to. * @param PluginAvailability $plugin_availability Plugin Availability. + * @param Options $options Options. * @param Util $util Util. */ - public function __construct( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability, Util $util ) { + public function __construct( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability, Options $options, Util $util ) { $this->notifications_handler = $notifications_handler; $this->plugin_availability = $plugin_availability; + $this->options = $options; $this->util = $util; } @@ -57,12 +66,13 @@ 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 Options $options Options. * @param Util $util Util. * * @return void */ - public static function register( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability, Util $util ): void { - $page = new self( $notifications_handler, $plugin_availability, $util ); + public static function register( NotificationsHandler $notifications_handler, PluginAvailability $plugin_availability, Options $options, Util $util ): void { + $page = new self( $notifications_handler, $plugin_availability, $options, $util ); add_action( 'admin_init', [ $page->plugin_availability, 'register' ] ); add_action( 'admin_init', [ $page, 'suggest_premium' ] ); @@ -83,7 +93,7 @@ public function suggest_premium(): void { if ( ! ( ( new WooCommerceConditional() )->is_met() && ! ( new PremiumConditional() )->is_met() && - ! Options::init()->get( 'misc', 'gf_wishlist' ) === true ) + ! $this->options->get( 'misc', 'gf_wishlist' ) === true ) ) { $this->notifications_handler->remove_notification_by_id( $notification_id ); return; @@ -182,7 +192,7 @@ public function suggest_grandfathered_wishlist(): void { if ( ! ( ( new WooCommerceConditional() )->is_met() && ! ( new PremiumConditional() )->is_met() && - Options::init()->get( 'misc', 'gf_wishlist' ) === true ) + $this->options->get( 'misc', 'gf_wishlist' ) === true ) ) { $this->notifications_handler->remove_notification_by_id( $notification_id ); return;