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 / Settings / Sections / SectionAbstract.php

SectionAbstract.php in Tiered Pricing Table for WooCommerce trunk, at src/Settings/Sections/SectionAbstract.php

55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Settings\Sections;
2
3 use TierPricingTable\Settings\Settings;
4
5 abstract class SectionAbstract {
6
7 abstract public function getName();
8
9 abstract public function getSlug();
10
11 abstract public function getSettings();
12
13 public function getSectionCSS(): string {
14 return '';
15 }
16
17 public function isActive(): bool {
18
19 if ( isset( $_GET['section'] ) ) {
20 return $_GET['section'] === $this->getSlug();
21 } else {
22 return $this->getSlug() === Settings::DEFAULT_SECTION;
23 }
24 }
25
26 public function getURL(): string {
27 return add_query_arg( array( 'section' => $this->getSlug() ) );
28 }
29
30 public function isIntegration(): bool {
31 return false;
32 }
33
34 /**
35 * "Unread" indicator on this section's navigation link. Return a version string to enable it;
36 * bump the version to show the badge again after it was seen. Store-wide: the first visit
37 * clears it for every user.
38 */
39 public function getBadgeVersion(): ?string {
40 return null;
41 }
42
43 public function isBadgeUnseen(): bool {
44 $version = $this->getBadgeVersion();
45
46 return $version && get_option( 'tpt_section_badge_seen_' . $this->getSlug() ) !== $version;
47 }
48
49 public function markBadgeSeen() {
50 if ( $this->getBadgeVersion() ) {
51 update_option( 'tpt_section_badge_seen_' . $this->getSlug(), $this->getBadgeVersion(), false );
52 }
53 }
54 }
55