Use DI to initialize PermanentNotices
[MAILPOET-2088]
This commit is contained in:
@ -52,6 +52,9 @@ class Initializer {
|
||||
/** @var CronTrigger */
|
||||
private $cron_trigger;
|
||||
|
||||
/** @var PermanentNotices */
|
||||
private $permanent_notices;
|
||||
|
||||
const INITIALIZED = 'MAILPOET_INITIALIZED';
|
||||
|
||||
function __construct(
|
||||
@ -64,7 +67,8 @@ class Initializer {
|
||||
Hooks $hooks,
|
||||
Changelog $changelog,
|
||||
Menu $menu,
|
||||
CronTrigger $cron_trigger
|
||||
CronTrigger $cron_trigger,
|
||||
PermanentNotices $permanent_notices
|
||||
) {
|
||||
$this->renderer_factory = $renderer_factory;
|
||||
$this->access_control = $access_control;
|
||||
@ -76,6 +80,7 @@ class Initializer {
|
||||
$this->changelog = $changelog;
|
||||
$this->menu = $menu;
|
||||
$this->cron_trigger = $cron_trigger;
|
||||
$this->permanent_notices = $permanent_notices;
|
||||
}
|
||||
|
||||
function init() {
|
||||
@ -302,8 +307,7 @@ class Initializer {
|
||||
}
|
||||
|
||||
function setupPermanentNotices() {
|
||||
$notices = new PermanentNotices();
|
||||
$notices->init();
|
||||
$this->permanent_notices->init();
|
||||
}
|
||||
|
||||
function handleFailedInitialization($exception) {
|
||||
|
@ -83,6 +83,8 @@ class ContainerConfigurator implements IContainerConfigurator {
|
||||
$container->autowire(\MailPoet\Listing\BulkActionController::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Listing\BulkActionFactory::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Listing\Handler::class)->setPublic(true);
|
||||
// Notices
|
||||
$container->autowire(\MailPoet\Util\Notices\PermanentNotices::class);
|
||||
// Router
|
||||
$container->autowire(\MailPoet\Router\Endpoints\CronDaemon::class)->setPublic(true);
|
||||
$container->autowire(\MailPoet\Router\Endpoints\Subscription::class)->setPublic(true);
|
||||
|
@ -8,6 +8,9 @@ use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class PermanentNotices {
|
||||
|
||||
/** @var WPFunctions */
|
||||
private $wp;
|
||||
|
||||
/** @var PHPVersionWarnings */
|
||||
private $php_version_warnings;
|
||||
|
||||
@ -26,17 +29,14 @@ class PermanentNotices {
|
||||
/** @var InactiveSubscribersNotice */
|
||||
private $inactive_subscribers_notice;
|
||||
|
||||
/** @var WPFunctions */
|
||||
private $wp;
|
||||
|
||||
public function __construct() {
|
||||
$this->wp = WPFunctions::get();
|
||||
public function __construct(WPFunctions $wp) {
|
||||
$this->wp = $wp;
|
||||
$this->php_version_warnings = new PHPVersionWarnings();
|
||||
$this->after_migration_notice = new AfterMigrationNotice();
|
||||
$this->discounts_announcement = new DiscountsAnnouncement();
|
||||
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $this->wp);
|
||||
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $this->wp);
|
||||
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $this->wp);
|
||||
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $wp);
|
||||
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $wp);
|
||||
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $wp);
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
Reference in New Issue
Block a user