Fix dismissing shortcodes notice
[MAILPOET-3672]
This commit is contained in:
committed by
Veljko V
parent
dc393575ad
commit
b71f8defc8
@@ -13,8 +13,15 @@ class DeprecatedShortcodeNotice {
|
|||||||
const DISMISS_NOTICE_TIMEOUT_SECONDS = 15552000; // 6 months
|
const DISMISS_NOTICE_TIMEOUT_SECONDS = 15552000; // 6 months
|
||||||
const OPTION_NAME = 'dismissed-deprecated-shortcode-notice';
|
const OPTION_NAME = 'dismissed-deprecated-shortcode-notice';
|
||||||
|
|
||||||
|
/** @var WPFunctions */
|
||||||
|
private $wp;
|
||||||
|
|
||||||
|
public function __construct(WPFunctions $wp) {
|
||||||
|
$this->wp = $wp;
|
||||||
|
}
|
||||||
|
|
||||||
public function init($shouldDisplay) {
|
public function init($shouldDisplay) {
|
||||||
if ($shouldDisplay && $this->isUsingDeprecatedShortcode()) {
|
if ($shouldDisplay && !$this->wp->getTransient(self::OPTION_NAME) && $this->isUsingDeprecatedShortcode()) {
|
||||||
return $this->display();
|
return $this->display();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -53,6 +60,6 @@ class DeprecatedShortcodeNotice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function disable() {
|
public function disable() {
|
||||||
WPFunctions::get()->setTransient(self::OPTION_NAME, true, self::DISMISS_NOTICE_TIMEOUT_SECONDS);
|
$this->wp->setTransient(self::OPTION_NAME, true, self::DISMISS_NOTICE_TIMEOUT_SECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ class PermanentNotices {
|
|||||||
$this->inactiveSubscribersNotice = new InactiveSubscribersNotice(SettingsController::getInstance(), $wp);
|
$this->inactiveSubscribersNotice = new InactiveSubscribersNotice(SettingsController::getInstance(), $wp);
|
||||||
$this->blackFridayNotice = new BlackFridayNotice();
|
$this->blackFridayNotice = new BlackFridayNotice();
|
||||||
$this->headersAlreadySentNotice = new HeadersAlreadySentNotice(SettingsController::getInstance(), $wp);
|
$this->headersAlreadySentNotice = new HeadersAlreadySentNotice(SettingsController::getInstance(), $wp);
|
||||||
$this->deprecatedShortcodeNotice = new DeprecatedShortcodeNotice();
|
$this->deprecatedShortcodeNotice = new DeprecatedShortcodeNotice($wp);
|
||||||
$this->emailWithInvalidListNotice = new EmailWithInvalidSegmentNotice($wp);
|
$this->emailWithInvalidListNotice = new EmailWithInvalidSegmentNotice($wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user