PluginProbe
Tiered Pricing Table for WooCommerce / 6.1.0
Tiered Pricing Table for WooCommerce v6.1.0
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 / Settings / Sections / Advanced / AdvancedSection.php

AdvancedSection.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Settings/Sections/Advanced/AdvancedSection.php

103 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Settings\Sections\Advanced;
2
3 use TierPricingTable\Core\ServiceContainer;
4 use TierPricingTable\Settings\CustomOptions\TPTLinkButton;
5 use TierPricingTable\Settings\CustomOptions\TPTSwitchOption;
6 use TierPricingTable\Settings\Sections\SectionAbstract;
7 use TierPricingTable\Settings\Settings;
8
9 class AdvancedSection extends SectionAbstract {
10
11 public function getSettings() {
12
13 $settings = array();
14 $advanced = apply_filters( 'tiered_pricing_table/settings/advanced_settings', array() );
15
16 $sectionTitle = array(
17 'title' => __( 'Features', 'tier-pricing-table' ),
18 'desc' => __( 'You can disable or enable specific plugin features.', 'tier-pricing-table' ),
19 'id' => Settings::SETTINGS_PREFIX . 'advanced',
20 'type' => 'title',
21 );
22
23 $sectionEnd = array(
24 'type' => 'sectionend',
25 'id' => Settings::SETTINGS_PREFIX . 'advanced',
26 );
27
28 $settings[] = $sectionTitle;
29 $settings = array_merge( $settings, $advanced );
30 $settings[] = $sectionEnd;
31
32 $settings = array_merge( $settings, $this->getCacheSettings() );
33 $settings = array_merge( $settings, $this->getDebuggerSettings() );
34
35 return $settings;
36 }
37
38 public function getSlug(): string {
39 return 'advanced';
40 }
41
42 public function getName(): string {
43 return __( 'Feature Flags', 'tier-pricing-table' );
44 }
45
46 public static function deleteOptions() {
47 delete_option( Settings::SETTINGS_PREFIX . 'advanced' );
48 delete_option( Settings::SETTINGS_PREFIX . '_addon_category-tiered-pricing' );
49 delete_option( Settings::SETTINGS_PREFIX . '_addon_manual-orders' );
50 delete_option( Settings::SETTINGS_PREFIX . '_addon_role-based-rules' );
51 delete_option( Settings::SETTINGS_PREFIX . '_addon_global-tier-pricing' );
52 delete_option( Settings::SETTINGS_PREFIX . '_addon_minimum-quantity' );
53 delete_option( Settings::SETTINGS_PREFIX . 'advanced' );
54 }
55
56 protected function getCacheSettings(): array {
57 return array(
58 array(
59 'title' => __( 'Cache', 'tier-pricing-table' ),
60 'desc' => __( 'Cache improves performance making the plugin not calculate data on each request. Disable to debug issues.',
61 'tier-pricing-table' ),
62 'type' => 'title',
63 ),
64 array(
65 'title' => __( 'Enabled', 'tier-pricing-table' ),
66 'id' => Settings::SETTINGS_PREFIX . 'cache_enabled',
67 'type' => TPTSwitchOption::FIELD_TYPE,
68 'default' => 'yes',
69 ),
70 array(
71 'title' => __( 'Purge', 'tier-pricing-table' ),
72 'button_text' => __( 'Purge cache', 'tier-pricing-table' ),
73 'button_class' => 'button button-large',
74 'button_link' => ServiceContainer::getInstance()->getCache()->getPurgeURL(),
75 'type' => TPTLinkButton::FIELD_TYPE,
76 ),
77 array(
78 'type' => 'sectionend',
79 ),
80 );
81 }
82
83 protected function getDebuggerSettings(): array {
84 return array(
85 array(
86 'title' => __( 'Debug', 'tier-pricing-table' ),
87 'desc' => __( 'Debug mode is useful when you need to track what pricing rule is applying for a cart item.',
88 'tier-pricing-table' ),
89 'type' => 'title',
90 ),
91 array(
92 'title' => __( 'Enabled', 'tier-pricing-table' ),
93 'id' => Settings::SETTINGS_PREFIX . 'debug_enabled',
94 'type' => TPTSwitchOption::FIELD_TYPE,
95 'default' => 'no',
96 ),
97 array(
98 'type' => 'sectionend',
99 ),
100 );
101 }
102 }
103