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 / Advanced / AdvancedSection.php

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

110 lines 3.6 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' => __( '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',
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 __( 'Modules', 'tier-pricing-table' );
44 }
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%; }';
51 }
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
63 protected function getCacheSettings(): array {
64 return array(
65 array(
66 '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' ),
69 'type' => 'title',
70 ),
71 array(
72 'title' => __( 'Enabled', 'tier-pricing-table' ),
73 'id' => Settings::SETTINGS_PREFIX . 'cache_enabled',
74 'type' => TPTSwitchOption::FIELD_TYPE,
75 'default' => 'yes',
76 ),
77 array(
78 'title' => __( 'Purge', 'tier-pricing-table' ),
79 'button_text' => __( 'Purge cache', 'tier-pricing-table' ),
80 'button_class' => 'button button-large',
81 'button_link' => ServiceContainer::getInstance()->getCache()->getPurgeURL(),
82 'type' => TPTLinkButton::FIELD_TYPE,
83 ),
84 array(
85 'type' => 'sectionend',
86 ),
87 );
88 }
89
90 protected function getDebuggerSettings(): array {
91 return array(
92 array(
93 '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' ),
96 'type' => 'title',
97 ),
98 array(
99 'title' => __( 'Enabled', 'tier-pricing-table' ),
100 'id' => Settings::SETTINGS_PREFIX . 'debug_enabled',
101 'type' => TPTSwitchOption::FIELD_TYPE,
102 'default' => 'no',
103 ),
104 array(
105 'type' => 'sectionend',
106 ),
107 );
108 }
109 }
110