AfterMigrationNotice.php
2 years ago
BlackFridayNotice.php
2 months ago
ChangedTrackingNotice.php
3 years ago
DatabaseEngineNotice.php
1 year ago
DeprecatedFilterNotice.php
4 years ago
DisabledMailFunctionNotice.php
2 months ago
DisabledWPCronNotice.php
1 year ago
EmailWithInvalidSegmentNotice.php
3 years ago
HeadersAlreadySentNotice.php
2 months ago
InactiveSubscribersNotice.php
2 years ago
PHPVersionWarnings.php
2 months ago
PendingApprovalNotice.php
2 years ago
PermanentNotices.php
2 months ago
PremiumFeaturesAvailableNotice.php
2 years ago
SenderDomainAuthenticationNotices.php
5 months ago
SendingQueueBodyCleanupNotice.php
2 months ago
StuckPostNotificationNotice.php
2 months ago
UnauthorizedEmailInNewslettersNotice.php
5 months ago
UnauthorizedEmailNotice.php
5 months ago
WooCommerceVersionWarning.php
1 year ago
WordPressPlaygroundNotice.php
1 year ago
index.php
3 years ago
AfterMigrationNotice.php
52 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Util\Notices; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Settings\SettingsController; |
| 9 | use MailPoet\Util\Helpers; |
| 10 | |
| 11 | class AfterMigrationNotice { |
| 12 | |
| 13 | const OPTION_NAME = 'mailpoet_display_after_migration_notice'; |
| 14 | |
| 15 | /** @var SettingsController */ |
| 16 | private $settings; |
| 17 | |
| 18 | public function __construct() { |
| 19 | $this->settings = SettingsController::getInstance(); |
| 20 | } |
| 21 | |
| 22 | public function enable() { |
| 23 | $this->settings->set(self::OPTION_NAME, true); |
| 24 | } |
| 25 | |
| 26 | public function disable() { |
| 27 | $this->settings->set(self::OPTION_NAME, false); |
| 28 | } |
| 29 | |
| 30 | public function init($shouldDisplay) { |
| 31 | if ($shouldDisplay && $this->settings->get(self::OPTION_NAME, false)) { |
| 32 | return $this->display(); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | private function display() { |
| 37 | $message = Helpers::replaceLinkTags( |
| 38 | __('Congrats! You’re progressing well so far. Complete your upgrade thanks to this [link]checklist[/link].', 'mailpoet'), |
| 39 | 'https://kb.mailpoet.com/article/199-checklist-after-migrating-to-mailpoet3', |
| 40 | [ |
| 41 | 'target' => '_blank', |
| 42 | ] |
| 43 | ); |
| 44 | |
| 45 | $extraClasses = 'mailpoet-dismissible-notice is-dismissible'; |
| 46 | $dataNoticeName = self::OPTION_NAME; |
| 47 | |
| 48 | \MailPoet\WP\Notice::displaySuccess($message, $extraClasses, $dataNoticeName); |
| 49 | return $message; |
| 50 | } |
| 51 | } |
| 52 |