PluginProbe
Tiered Pricing Table for WooCommerce / trunk
Tiered Pricing Table for WooCommerce vtrunk
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / src / Admin / Notifications / Notifications / TwoMonthsUsingDiscount.php

TwoMonthsUsingDiscount.php in Tiered Pricing Table for WooCommerce trunk, at src/Admin/Notifications/Notifications/TwoMonthsUsingDiscount.php

43 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TierPricingTable\Admin\Notifications\Notifications;
4
5 use TierPricingTable\Core\ServiceContainerTrait;
6 use TierPricingTable\TierPricingTablePlugin;
7 /**
8 * Class Notifications
9 *
10 * @package TierPricingTable\Admin\Notifications
11 */
12 class TwoMonthsUsingDiscount extends Notification {
13 use ServiceContainerTrait;
14 public function getMonthsNumberToUsePluginToSeeNotification() : int {
15 return 2;
16 }
17
18 public function getId() : string {
19 return 'two-months-using-discount';
20 }
21
22 public function getTemplate() : string {
23 return 'admin/notifications/feedback-discount.php';
24 }
25
26 public function passedRequirements() : bool {
27 if ( !$this->isPluginPage() ) {
28 return false;
29 }
30 $activationDate = TierPricingTablePlugin::getPluginActivationDate();
31 if ( !$activationDate ) {
32 return false;
33 }
34 // If activation date is more than {number} months ago
35 return time() - $activationDate > MONTH_IN_SECONDS * $this->getMonthsNumberToUsePluginToSeeNotification();
36 }
37
38 public function isActive() : bool {
39 return $this->passedRequirements() && !$this->isSeen();
40 }
41
42 }
43