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
← All changes | src/Freemius.php +23 -23 6.1.0 → 8.0.2 View file →
@@ -5,18 +5,18 @@
5 5 *
6 6 * @package TierPricingTable
7 7 */
8 8 class Freemius {
9 -
9 +
10 10 /**
11 11 * License
12 12 *
13 - * @var \Freemius
13 + * @var self
14 14 */
15 15 private $instance;
16 -
16 +
17 17 private $mainFile;
18 -
18 +
19 19 /**
20 20 * Freemius constructor.
21 21 *
22 22 * @param $mainFile
@@ -21,20 +21,20 @@
21 21 *
22 22 * @param $mainFile
23 23 */
24 24 public function __construct( $mainFile ) {
25 -
25 +
26 26 $this->mainFile = $mainFile;
27 27 $this->init();
28 -
28 +
29 29 if ( $this->isValid() ) {
30 30 $this->hooks();
31 31 }
32 32 }
33 -
33 +
34 34 public function hooks() {
35 35 add_action( 'admin_menu', [ $this, 'initPages' ] );
36 -
36 +
37 37 $this->instance->add_filter( 'templates/pricing.php', function ( $template ) {
38 38 ob_start();
39 39 ?>
40 40
@@ -50,42 +50,42 @@
50 50 --fs-ds-theme-background-color: #faf6f9;
51 51 }
52 52 </style>
53 53 <?php
54 -
54 +
55 55 $style = ob_get_clean();
56 -
56 +
57 57 return $style . $template;
58 58 } );
59 -
59 +
60 60 $this->instance->add_filter( 'pricing/show_annual_in_monthly', '__return_false' );
61 61 }
62 -
62 +
63 63 public function isValid(): bool {
64 64 return $this->instance instanceof \Freemius;
65 65 }
66 -
66 +
67 67 public function init() {
68 68 if ( function_exists( 'tpt_fs' ) ) {
69 69 $this->instance = tpt_fs();
70 70 }
71 71 }
72 -
72 +
73 73 public function initPages() {
74 -
74 +
75 75 // Account
76 76 add_submenu_page( '__freemius', __( 'Freemius Account', 'tier-price-table' ),
77 - __( 'Freemius Account', 'tier-price-table' ), 'manage_options', 'tiered-pricing-table-account',
78 - [ $this, 'renderAccountPage' ] );
79 -
77 + __( 'Freemius Account', 'tier-price-table' ), 'manage_options', 'tiered-pricing-table-account',
78 + [ $this, 'renderAccountPage' ] );
79 +
80 80 // Contact us
81 81 add_submenu_page( '__freemius', __( 'Contact Us', 'tiered-price-table' ),
82 - __( 'Contact Us', 'tier-price-table' ), 'manage_options', 'tiered-pricing-table-contact-us',
83 - [ $this, 'renderContactUsPage' ] );
82 + __( 'Contact Us', 'tier-price-table' ), 'manage_options', 'tiered-pricing-table-contact-us',
83 + [ $this, 'renderContactUsPage' ] );
84 84 }
85 -
85 +
86 86 public function renderAccountPage() {
87 -
87 +
88 88 if ( ! $this->instance->get_user() || $this->instance->is_activation_mode() || $this->instance->is_anonymous() ) {
89 89 wp_safe_redirect( admin_url( 'admin.php?page=tier-pricing-table' ) );
90 90 exit;
91 91 } else {
@@ -92,9 +92,9 @@
92 92 $this->instance->_account_page_load();
93 93 $this->instance->_account_page_render();
94 94 }
95 95 }
96 -
96 +
97 97 public function renderContactUsPage() {
98 98 $this->instance->_contact_page_render();
99 99 }
100 100 }