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
ChangedTrackingNotice.php
43 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\Util\Helpers; |
| 9 | use MailPoet\WP\Functions as WPFunctions; |
| 10 | use MailPoet\WP\Notice; |
| 11 | |
| 12 | class ChangedTrackingNotice { |
| 13 | const OPTION_NAME = 'mailpoet-changed-tracking-settings-notice'; |
| 14 | |
| 15 | /** @var WPFunctions */ |
| 16 | private $wp; |
| 17 | |
| 18 | public function __construct( |
| 19 | WPFunctions $wp |
| 20 | ) { |
| 21 | $this->wp = $wp; |
| 22 | } |
| 23 | |
| 24 | public function init($shouldDisplay) { |
| 25 | if ($shouldDisplay && $this->wp->getTransient(self::OPTION_NAME)) { |
| 26 | return $this->display(); |
| 27 | } |
| 28 | return null; |
| 29 | } |
| 30 | |
| 31 | public function display() { |
| 32 | $text = __('Email open and click tracking is now enabled. You can change how MailPoet tracks your subscribers in [link]Settings[/link]', 'mailpoet'); |
| 33 | $text = Helpers::replaceLinkTags($text, 'admin.php?page=mailpoet-settings#advanced'); |
| 34 | $extraClasses = 'mailpoet-dismissible-notice is-dismissible'; |
| 35 | |
| 36 | return Notice::displayWarning($text, $extraClasses, self::OPTION_NAME); |
| 37 | } |
| 38 | |
| 39 | public function disable() { |
| 40 | $this->wp->deleteTransient(self::OPTION_NAME); |
| 41 | } |
| 42 | } |
| 43 |