servicesChecker = $servicesChecker; $this->subscribers = $subscribers; } public function init($shouldDisplay) { $shouldDisplay = $shouldDisplay && !$this->servicesChecker->isBundledSubscription() && (time() >= strtotime(self::DATE_FROM)) && (time() <= strtotime(self::DATE_TO)) && !get_transient(self::OPTION_NAME); if ($shouldDisplay) { $this->display(); } } private function display() { $header = '
" // translators: a button on a sale banner . __('Shop annual plans', 'mailpoet') . '
'; $extraClasses = 'mailpoet-dismissible-notice is-dismissible'; WPNotice::displaySuccess($header . $body . $link, $extraClasses, self::OPTION_NAME, false); } public function disable() { WPFunctions::get()->setTransient(self::OPTION_NAME, true, self::DISMISS_NOTICE_TIMEOUT_SECONDS); } private function getSaleUrl(): string { $params = 'ref=' . self::PARAM_REF . '&utm_source=plugin&utm_medium=banner&utm_campaign=' . self::PARAM_UTM_CAMPAIGN; $partialApiKey = $this->servicesChecker->generatePartialApiKey(); if ($partialApiKey) { return 'https://account.mailpoet.com/orders/upgrade/' . $partialApiKey . '?' . $params; } return 'https://account.mailpoet.com/?s=' . $this->subscribers->getSubscribersCount() . '&' . $params; } }