PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 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 All 91 releases
tier-pricing-table / src / Admin / Notifications / Notifications / BlackFriday.php

BlackFriday.php in Tiered Pricing Table for WooCommerce 8.0.2, at src/Admin/Notifications/Notifications/BlackFriday.php

37 lines 953 B
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 /**
6 * Class Notifications
7 *
8 * @package TierPricingTable\Admin\Notifications
9 */
10 abstract class BlackFriday extends Notification {
11 public function getTemplate() : string {
12 return 'admin/notifications/black-friday.php';
13 }
14
15 public function getId() : string {
16 return 'black-friday-' . $this->getBlackFridayDate();
17 }
18
19 public abstract function getBlackFridayDate() : string;
20
21 public function isBlackFriday() : bool {
22 $blackFriday = $this->getBlackFridayDate();
23 $start = strtotime( "{$blackFriday} - 3 days" );
24 $end = strtotime( "{$blackFriday} + 4 days" );
25 return time() > $start && time() < $end;
26 }
27
28 public function passedRequirements() : bool {
29 return $this->isBlackFriday();
30 }
31
32 public function isActive() : bool {
33 return $this->passedRequirements() && !$this->isSeen();
34 }
35
36 }
37