PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 5.34.1
MailPoet – Newsletters, Email Marketing, and Automation v5.34.1
5.37.0 5.36.1 5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 4.44.0 All 541 releases
mailpoet / lib / Util / Notices / DeprecatedFilterNotice.php
DeprecatedFilterNotice.php
53 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types = 1);
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 /**
13 * This can be removed after 2022-12-01
14 */
15 class DeprecatedFilterNotice {
16 const DISMISS_NOTICE_TIMEOUT_SECONDS = 15552000; // 6 months
17 const OPTION_NAME = 'dismissed-deprecated-filter-notice';
18
19 const DEPRECATED_FILTER_NAME = 'mailpoet_mailer_smtp_transport_agent';
20 const NEW_FILTER_NAME = 'mailpoet_mailer_smtp_options';
21
22 /** @var WPFunctions */
23 private $wp;
24
25 public function __construct(
26 WPFunctions $wp
27 ) {
28 $this->wp = $wp;
29 }
30
31 public function init($shouldDisplay): ?Notice {
32 if ($shouldDisplay && !$this->wp->getTransient(self::OPTION_NAME) && $this->wp->hasFilter('mailpoet_mailer_smtp_transport_agent')) {
33 return $this->display();
34 }
35 return null;
36 }
37
38 public function display(): Notice {
39 $message = Helpers::replaceLinkTags(
40 __('The <i>mailpoet_mailer_smtp_transport_agent</i> filter no longer works. Please replace it with <i>mailpoet_mailer_smtp_options</i>. Read more in [link]documentation[/link].', 'mailpoet'),
41 'https://kb.mailpoet.com/article/193-tls-encryption-does-not-work',
42 ['target' => '_blank']
43 );
44 $extraClasses = 'mailpoet-dismissible-notice is-dismissible';
45
46 return Notice::displayWarning($message, $extraClasses, self::OPTION_NAME);
47 }
48
49 public function disable(): void {
50 $this->wp->setTransient(self::OPTION_NAME, true, self::DISMISS_NOTICE_TIMEOUT_SECONDS);
51 }
52 }
53