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/Settings/Sections/Advanced/AdvancedSection.php +59 -50 7.1.5 → 8.0.2 View file →
@@ -5,68 +5,57 @@
5 5 use TierPricingTable\Settings\CustomOptions\TPTSwitchOption;
6 6 use TierPricingTable\Settings\Sections\SectionAbstract;
7 7 use TierPricingTable\Settings\Settings;
8 8
9 +/**
10 + * The "Advanced" tab: the module switches, the Tools add-on's utilities (roles, data clean-up),
11 + * the cache and the debug mode. The former "Tools" tab lives here since 7.2.1; its old links still work.
12 + */
9 13 class AdvancedSection extends SectionAbstract {
10 -
14 +
11 15 public function getSettings() {
12 -
13 - $settings = array();
14 - $advanced = apply_filters( 'tiered_pricing_table/settings/advanced_settings', array() );
15 -
16 - $sectionTitle = array(
17 - 'title' => __( 'Modules', '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',
16 + return array_merge(
17 + $this->getModulesSettings(),
18 + (array) apply_filters( 'tiered_pricing_table/settings/tools_settings', array() ),
19 + $this->getCacheSettings(),
20 + $this->getDebugSettings()
21 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 22 }
37 -
23 +
38 24 public function getSlug(): string {
39 25 return 'advanced';
40 26 }
41 -
27 +
42 28 public function getName(): string {
43 - return __( 'Modules', 'tier-pricing-table' );
29 + return __( 'Advanced', 'tier-pricing-table' );
44 30 }
45 -
46 - public function getSectionCSS(): string {
47 - return '.form-table:first-of-type tbody { display: flex; flex-wrap: wrap; margin: 10px 0 20px 0; }
48 - .form-table:first-of-type tr { display: block; border-bottom: none; padding-bottom: 0; }
49 - .form-table:first-of-type th { display: none; }
50 - .form-table:first-of-type td { padding: 0 !important; width: 100%; }';
31 +
32 + protected function getModulesSettings(): array {
33 + $settings = array(
34 + array(
35 + 'title' => __( 'Modules', 'tier-pricing-table' ),
36 + 'desc' => __( 'You can disable or enable specific plugin features.', 'tier-pricing-table' ),
37 + 'id' => Settings::SETTINGS_PREFIX . 'advanced',
38 + 'type' => 'title',
39 + ),
40 + );
41 +
42 + $settings = array_merge( $settings, (array) apply_filters( 'tiered_pricing_table/settings/advanced_settings', array() ) );
43 +
44 + $settings[] = array(
45 + 'type' => 'sectionend',
46 + 'id' => Settings::SETTINGS_PREFIX . 'advanced',
47 + );
48 +
49 + return $settings;
51 50 }
52 -
53 - public static function deleteOptions() {
54 - delete_option( Settings::SETTINGS_PREFIX . 'advanced' );
55 - delete_option( Settings::SETTINGS_PREFIX . '_addon_category-tiered-pricing' );
56 - delete_option( Settings::SETTINGS_PREFIX . '_addon_manual-orders' );
57 - delete_option( Settings::SETTINGS_PREFIX . '_addon_role-based-rules' );
58 - delete_option( Settings::SETTINGS_PREFIX . '_addon_global-tier-pricing' );
59 - delete_option( Settings::SETTINGS_PREFIX . '_addon_minimum-quantity' );
60 - delete_option( Settings::SETTINGS_PREFIX . 'advanced' );
61 - }
62 -
51 +
63 52 protected function getCacheSettings(): array {
64 53 return array(
65 54 array(
66 55 'title' => __( 'Cache', 'tier-pricing-table' ),
67 - 'desc' => __( 'Cache improves performance making the plugin not calculate data on each request. Disable to debug issues.',
68 - 'tier-pricing-table' ),
56 + 'desc' => __( 'Cache improves performance making the plugin not calculate data on each request. Disable to debug issues.', 'tier-pricing-table' ),
57 + 'id' => Settings::SETTINGS_PREFIX . 'cache_section',
69 58 'type' => 'title',
70 59 ),
71 60 array(
72 61 'title' => __( 'Enabled', 'tier-pricing-table' ),
@@ -82,18 +71,19 @@
82 71 'type' => TPTLinkButton::FIELD_TYPE,
83 72 ),
84 73 array(
85 74 'type' => 'sectionend',
75 + 'id' => Settings::SETTINGS_PREFIX . 'cache_section',
86 76 ),
87 77 );
88 78 }
89 -
90 - protected function getDebuggerSettings(): array {
79 +
80 + protected function getDebugSettings(): array {
91 81 return array(
92 82 array(
93 83 'title' => __( 'Debug', 'tier-pricing-table' ),
94 - 'desc' => __( 'Debug mode is useful when you need to track what pricing rule is applying for a cart item.',
95 - 'tier-pricing-table' ),
84 + 'desc' => __( 'Debug mode is useful when you need to track what pricing rule is applying for a cart item.', 'tier-pricing-table' ),
85 + 'id' => Settings::SETTINGS_PREFIX . 'debug_section',
96 86 'type' => 'title',
97 87 ),
98 88 array(
99 89 'title' => __( 'Enabled', 'tier-pricing-table' ),
@@ -102,8 +92,27 @@
102 92 'default' => 'no',
103 93 ),
104 94 array(
105 95 'type' => 'sectionend',
96 + 'id' => Settings::SETTINGS_PREFIX . 'debug_section',
106 97 ),
107 98 );
99 + }
100 +
101 + public function getSectionCSS(): string {
102 + // only the modules table (the first one) is a grid; the utilities, cache and debug tables keep the default rows
103 + return '.form-table:first-of-type tbody { display: flex; flex-wrap: wrap; margin: 10px 0 20px 0; }
104 + .form-table:first-of-type tr { display: block; border-bottom: none; padding-bottom: 0; }
105 + .form-table:first-of-type th { display: none; }
106 + .form-table:first-of-type td { padding: 0 !important; width: 100%; }';
107 + }
108 +
109 + public static function deleteOptions() {
110 + delete_option( Settings::SETTINGS_PREFIX . 'advanced' );
111 + delete_option( Settings::SETTINGS_PREFIX . '_addon_category-tiered-pricing' );
112 + delete_option( Settings::SETTINGS_PREFIX . '_addon_manual-orders' );
113 + delete_option( Settings::SETTINGS_PREFIX . '_addon_role-based-rules' );
114 + delete_option( Settings::SETTINGS_PREFIX . '_addon_global-tier-pricing' );
115 + delete_option( Settings::SETTINGS_PREFIX . '_addon_minimum-quantity' );
116 + delete_option( Settings::SETTINGS_PREFIX . 'advanced' );
108 117 }
109 118 }