HEX
Server: Apache/2.4.65 (Unix) OpenSSL/1.1.1k
System: Linux server-manager.elshandawiily.com 4.18.0-553.87.1.el8_10.x86_64 #1 SMP Mon Dec 1 05:11:16 EST 2025 x86_64
User: elshanda (1002)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/elshanda/public_html/wp-content/plugins/mailpoet/lib/Util/Notices/ChangedTrackingNotice.php
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing

namespace MailPoet\Util\Notices;

if (!defined('ABSPATH')) exit;


use MailPoet\Util\Helpers;
use MailPoet\WP\Functions as WPFunctions;
use MailPoet\WP\Notice;

class ChangedTrackingNotice {
  const OPTION_NAME = 'mailpoet-changed-tracking-settings-notice';

  /** @var WPFunctions */
  private $wp;

  public function __construct(
    WPFunctions $wp
  ) {
    $this->wp = $wp;
  }

  public function init($shouldDisplay) {
    if ($shouldDisplay && $this->wp->getTransient(self::OPTION_NAME)) {
      return $this->display();
    }
    return null;
  }

  public function display() {
    $text = __('Email open and click tracking is now enabled. You can change how MailPoet tracks your subscribers in [link]Settings[/link]', 'mailpoet');
    $text = Helpers::replaceLinkTags($text, 'admin.php?page=mailpoet-settings#advanced');
    $extraClasses = 'mailpoet-dismissible-notice is-dismissible';

    return Notice::displayWarning($text, $extraClasses, self::OPTION_NAME);
  }

  public function disable() {
    $this->wp->deleteTransient(self::OPTION_NAME);
  }
}