Server IP : 104.21.14.103 / Your IP : 18.191.212.185 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Util/Notices/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Util\Notices; if (!defined('ABSPATH')) exit; use MailPoet\Entities\SubscriberEntity; use MailPoet\Settings\SettingsController; use MailPoet\Subscribers\SubscribersRepository; use MailPoet\Util\Helpers; use MailPoet\WP\Functions as WPFunctions; use MailPoet\WP\Notice; class InactiveSubscribersNotice { const OPTION_NAME = 'inactive-subscribers-notice'; const MIN_INACTIVE_SUBSCRIBERS_COUNT = 50; /** @var SettingsController */ private $settings; /** @var SubscribersRepository */ private $subscribersRepository; /** @var WPFunctions */ private $wp; public function __construct( SettingsController $settings, SubscribersRepository $subscribersRepository, WPFunctions $wp ) { $this->settings = $settings; $this->wp = $wp; $this->subscribersRepository = $subscribersRepository; } public function init($shouldDisplay) { if (!$shouldDisplay || !$this->settings->get(self::OPTION_NAME, true)) { return; } // don't display notice if user has changed the default inactive time range $inactiveDays = (int)$this->settings->get('deactivate_subscriber_after_inactive_days'); if ($inactiveDays !== SettingsController::DEFAULT_DEACTIVATE_SUBSCRIBER_AFTER_INACTIVE_DAYS) { return; } $inactiveSubscribersCount = $this->subscribersRepository->countBy(['deletedAt' => null, 'status' => SubscriberEntity::STATUS_INACTIVE]); if ($inactiveSubscribersCount < self::MIN_INACTIVE_SUBSCRIBERS_COUNT) { return; } return $this->display($inactiveSubscribersCount); } public function disable() { $this->settings->set(self::OPTION_NAME, false); } private function display($inactiveSubscribersCount) { $goToSettingsString = __('Go to the Advanced Settings', 'mailpoet'); $notice = sprintf( // translators: %d is the number of inactive subscribers. __('Good news! MailPoet won’t send emails to your %s inactive subscribers. This is a standard practice to maintain good deliverability and open rates. But if you want to disable it, you can do so in settings. [link]Read more.[/link]', 'mailpoet'), $this->wp->numberFormatI18n($inactiveSubscribersCount) ); $notice = Helpers::replaceLinkTags($notice, 'https://kb.mailpoet.com/article/264-inactive-subscribers', [ 'target' => '_blank', 'data-beacon-article' => '5cbf19622c7d3a026fd3efe1', ]); $notice = "<p>$notice</p>"; $notice .= '<p><a href="admin.php?page=mailpoet-settings#advanced" class="button button-primary">' . $goToSettingsString . '</a></p>'; $extraClasses = 'mailpoet-dismissible-notice is-dismissible'; Notice::displaySuccess($notice, $extraClasses, self::OPTION_NAME, false); return $notice; } }