Remove banner from the last year
[MAILPOET-2469]
This commit is contained in:
committed by
Jack Kitterhing
parent
1ddf68898d
commit
24e42c2e95
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Util\Notices;
|
||||
|
||||
use MailPoet\Settings\SettingsController;
|
||||
use MailPoet\Util\Helpers;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
use MailPoet\WP\Notice as WPNotice;
|
||||
|
||||
class DiscountsAnnouncement {
|
||||
|
||||
const OPTION_NAME = 'mailpoet_display_discounts_announcement_q4_2018';
|
||||
|
||||
/** @var SettingsController */
|
||||
private $settings;
|
||||
|
||||
public function __construct() {
|
||||
$this->settings = new SettingsController();
|
||||
}
|
||||
|
||||
function enable() {
|
||||
$this->settings->set(self::OPTION_NAME, true);
|
||||
}
|
||||
|
||||
function disable() {
|
||||
$this->settings->set(self::OPTION_NAME, false);
|
||||
}
|
||||
|
||||
function init($should_display) {
|
||||
$should_display = $should_display && (time() <= strtotime('2018-11-30 23:59:59'));
|
||||
if ($should_display && $this->settings->get(self::OPTION_NAME, true)) {
|
||||
return $this->display();
|
||||
}
|
||||
}
|
||||
|
||||
private function display() {
|
||||
$message = Helpers::replaceLinkTags(
|
||||
WPFunctions::get()->__('<h3>Save on MailPoet Premium for a limited time. Discounts up to 50%</h3>
|
||||
<p>Our annual sale is a good opportunity to get more detailed stats & great email deliverability. Don’t miss out!</p>
|
||||
[link]Visit the MailPoet Premium page[/link]', 'mailpoet'),
|
||||
'admin.php?page=mailpoet-premium',
|
||||
['class' => 'button button-primary']
|
||||
);
|
||||
$message .= '<script>jQuery(function($) {$(document).on("click", ".mailpoet-dismissible-notice .notice-dismiss",function dismiss() {const type = $(this).closest(".mailpoet-dismissible-notice").data("notice");$.ajax(window.ajaxurl,{type: "POST",data: {action: "dismissed_notice_handler",type,}});});});</script>';
|
||||
|
||||
$extra_classes = 'mailpoet-dismissible-notice is-dismissible';
|
||||
$data_notice_name = self::OPTION_NAME;
|
||||
|
||||
WPNotice::displaySuccess($message, $extra_classes, $data_notice_name);
|
||||
return $message;
|
||||
}
|
||||
|
||||
}
|
@@ -17,9 +17,6 @@ class PermanentNotices {
|
||||
/** @var AfterMigrationNotice */
|
||||
private $after_migration_notice;
|
||||
|
||||
/** @var DiscountsAnnouncement */
|
||||
private $discounts_announcement;
|
||||
|
||||
/** @var UnauthorizedEmailNotice */
|
||||
private $unauthorized_emails_notice;
|
||||
|
||||
@@ -36,7 +33,6 @@ class PermanentNotices {
|
||||
$this->wp = $wp;
|
||||
$this->php_version_warnings = new PHPVersionWarnings();
|
||||
$this->after_migration_notice = new AfterMigrationNotice();
|
||||
$this->discounts_announcement = new DiscountsAnnouncement();
|
||||
$this->unauthorized_emails_notice = new UnauthorizedEmailNotice(new SettingsController, $wp);
|
||||
$this->unauthorized_emails_in_newsletters_notice = new UnauthorizedEmailInNewslettersNotice(new SettingsController, $wp);
|
||||
$this->inactive_subscribers_notice = new InactiveSubscribersNotice(new SettingsController, $wp);
|
||||
@@ -65,11 +61,6 @@ class PermanentNotices {
|
||||
$this->inactive_subscribers_notice->init(
|
||||
Menu::isOnMailPoetAdminPage($exclude = ['mailpoet-welcome-wizard'])
|
||||
);
|
||||
$this->discounts_announcement->init(
|
||||
empty($_GET['page'])
|
||||
&& $this->wp->isAdmin()
|
||||
&& strpos($_SERVER['SCRIPT_NAME'], 'wp-admin/index.php') !== false
|
||||
);
|
||||
$this->black_friday_notice->init(
|
||||
Menu::isOnMailPoetAdminPage($exclude = ['mailpoet-welcome-wizard'])
|
||||
);
|
||||
@@ -84,9 +75,6 @@ class PermanentNotices {
|
||||
case (AfterMigrationNotice::OPTION_NAME):
|
||||
$this->after_migration_notice->disable();
|
||||
break;
|
||||
case (DiscountsAnnouncement::OPTION_NAME):
|
||||
$this->discounts_announcement->disable();
|
||||
break;
|
||||
case (BlackFridayNotice::OPTION_NAME):
|
||||
$this->black_friday_notice->disable();
|
||||
break;
|
||||
|
Reference in New Issue
Block a user