PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 3.4.2
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v3.4.2
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / src / admin / pages / class-page-settings.php
superb-blocks / src / admin / pages Last commit date
wizard 1 year ago class-page-additional-css.php 1 year ago class-page-dashboard.php 1 year ago class-page-settings.php 1 year ago class-page-support.php 1 year ago
class-page-settings.php
174 lines
1 <?php
2
3 namespace SuperbAddons\Admin\Pages;
4
5 defined('ABSPATH') || exit();
6
7 use SuperbAddons\Admin\Controllers\DashboardController;
8 use SuperbAddons\Admin\Controllers\SettingsController;
9 use SuperbAddons\Admin\Controllers\Wizard\WizardRestorationPointController;
10 use SuperbAddons\Components\Admin\EnhancementSettingsComponent;
11 use SuperbAddons\Components\Admin\InputCheckbox;
12 use SuperbAddons\Components\Admin\Modal;
13 use SuperbAddons\Components\Admin\PremiumBoxLarge;
14 use SuperbAddons\Data\Controllers\KeyController;
15
16 use SuperbAddons\Components\Admin\ReviewBox;
17 use SuperbAddons\Components\Admin\SupportLinkBoxes;
18 use SuperbAddons\Data\Controllers\CompatibilitySettingsOptionKey;
19 use SuperbAddons\Data\Controllers\SettingsOptionKey;
20 use SuperbAddons\Data\Utils\KeyType;
21
22 class SettingsPage
23 {
24 private $HasRegisteredKey = false;
25 private $KeyTypeLabel = false;
26 private $KeyStatus = false;
27 private $Settings = false;
28 private $Incompatibilities = false;
29 private $CompatibilitySettings = false;
30
31 public function __construct()
32 {
33 $this->HasRegisteredKey = KeyController::HasRegisteredKey();
34 if ($this->HasRegisteredKey) {
35 $this->KeyTypeLabel = KeyController::GetCurrentKeyTypeLabel();
36 $this->KeyStatus = KeyController::GetKeyStatus();
37 }
38
39 $this->Settings = SettingsController::GetSettings();
40
41 $this->Incompatibilities = SettingsController::GetRelevantCompatibilitySettings();
42 if (count($this->Incompatibilities) > 0) {
43 $this->CompatibilitySettings = SettingsController::GetCompatibilitySettings();
44 }
45
46 $this->Render();
47 }
48
49 private function Render()
50 {
51 ?>
52 <div class="superbaddons-admindashboard-sidebarlayout">
53 <div class="superbaddons-admindashboard-sidebarlayout-left">
54 <?php
55 new PremiumBoxLarge();
56 ?>
57 <div class="superbaddons-license-key-wrapper">
58 <?php if ($this->HasRegisteredKey) : ?>
59 <div class="superbaddons-license-key-body">
60 <?php $this->MaybeDisplayKeyIssue(); ?>
61 <p class="superbaddons-element-text-sm"><?= esc_html__('Current License: ', "superb-blocks"); ?><span class="superbaddons-element-text-md"><?= esc_html($this->KeyTypeLabel); ?></span></p>
62 <button id="spbaddons-license-remove-btn" class="superbaddons-element-button spbaddons-admin-btn-danger" type="button"><!-- JS Overwrites --><?= esc_html__('Remove License Key', "superb-blocks"); ?></button>
63 </div>
64 <?php else : ?>
65 <div class="superbaddons-license-key-body superbaddons-license-key-body-flex">
66 <div class="superbaddons-license-key-input-wrapper">
67 <img class="spbaddons-license-result-icon spbaddons-license-error" src="<?= SUPERBADDONS_ASSETS_PATH ?>/img/color-warning-octagon.svg" style="display:none;" />
68 <input id="superbaddons-license-key-input" type="text" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" maxlength="23" />
69 </div>
70 <button id="spbaddons-license-submit-btn" class="superbaddons-element-button" type="button" disabled><?= esc_html__('Add License Key', "superb-blocks"); ?></button>
71 </div>
72 <?php endif; ?>
73 <div class="superbaddons-spinner-wrapper" style="display:none;">
74 <img class="spbaddons-spinner" src="<?= SUPERBADDONS_ASSETS_PATH ?>/img/blocks-spinner.svg" />
75 </div>
76 </div>
77 <div class="superbaddons-editor-settings-wrapper">
78 <?php new EnhancementSettingsComponent(); ?>
79 </div>
80 <div class="superbaddons-additional-content-wrapper">
81 <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?= esc_html__("Advanced Settings", "superb-blocks"); ?></h4>
82 <p class="superbaddons-element-text-xs superbaddons-element-text-gray "><?= esc_html__("Manage your advanced settings for Superb Addons.", "superb-blocks"); ?></p>
83
84 <div class="superbaddons-cache-settings-wrapper">
85 <!-- Cache Settings -->
86 <h5 class="superbaddons-element-flex-center superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-database.svg'); ?>" /><?= esc_html__("Cache", "superb-blocks"); ?></h5>
87 <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-mb1"><?= esc_html__("Superb Addons caches data for faster loading and processing. Clearing the cache will force data and images to be refreshed and reloaded. If you are not experiencing any problems with the plugin, the cache should not be cleared.", "superb-blocks"); ?></p>
88 <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-m0 superbaddons-element-mb1" id="superbaddons-clear-cache-btn"><img class="superbaddons-element-button-icon" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?= esc_html__("Clear Cache", "superb-blocks"); ?></button>
89 </div>
90
91 <div class="superbaddons-restoration-points-settings-wrapper">
92 <!-- Restoration Points Settings -->
93 <h5 class="superbaddons-element-flex-center superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-database.svg'); ?>" /><?= esc_html__("Template Restoration Points", "superb-blocks"); ?></h5>
94 <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-mb1"><?= esc_html__("Superb Addons creates restoration points for your templates when you use the theme designer feature. All restoration points are automatically removed 2 months after creation. You should only manually clear the restoration points if you no longer need them and want to remove them immediately.", "superb-blocks"); ?></p>
95 <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-m0 superbaddons-element-mb1" id="superbaddons-clear-restoration-points-btn"><img class="superbaddons-element-button-icon" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?= esc_html__("Clear Restoration Points", "superb-blocks"); ?></button>
96 </div>
97
98 <div class="superbaddons-element-separator"></div>
99
100 <div class="superbaddons-error-logs-settings-wrapper">
101 <!-- Error Logs Settings -->
102 <h5 class="superbaddons-element-flex-center superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-mb1"><img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-bug.svg'); ?>" /><?= esc_html__("Error Logs", "superb-blocks"); ?></h5>
103 <?php new InputCheckbox('superbaddons-enable-logs-input', SettingsOptionKey::LOGS_ENABLED, __("Enable Error Logs", "superb-blocks"), __("If issues or errors occur in the plugin when this setting is enabled, the error messages will be logged and can be viewed and shared with our support team and developers.", "superb-blocks"), $this->Settings[SettingsOptionKey::LOGS_ENABLED]); ?>
104 <div class="superbaddons-maybe-hide-element" <?= $this->Settings[SettingsOptionKey::LOGS_ENABLED] ? '' : 'style="display:none;"'; ?>>
105 <?php new InputCheckbox('superbaddons-share-logs-input', SettingsOptionKey::LOG_SHARE_ENABLED, __("Share Error Logs", "superb-blocks"), __("When this setting is enabled, error logs will be shared anonymously with our support team and developers to help improve the plugin. Only the error messages shown in the error logs will be shared.", "superb-blocks"), $this->Settings[SettingsOptionKey::LOG_SHARE_ENABLED], '/img/cloud-arrow-up.svg'); ?>
106 </div>
107 <button type="button" class="superbaddons-element-button superbaddons-element-mr1" id="superbaddons-view-logs-btn"><img class="superbaddons-element-button-icon" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/list-magnifying-glass.svg'); ?>" /><?= esc_html__("View Logs", "superb-blocks"); ?></button>
108 <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger" id="superbaddons-clear-logs-btn"><img class="superbaddons-element-button-icon" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?= esc_html__("Clear Logs", "superb-blocks"); ?></button>
109 </div>
110 <div class="superbaddons-compatibility-settings-wrapper">
111 <!-- Compatibility Settings -->
112 <?php if (count($this->Incompatibilities) > 0) : ?>
113 <div class="superbaddons-element-separator"></div>
114 <h5 class="superbaddons-element-flex-center superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-mb1"><img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-plugs.svg'); ?>" /><?= esc_html__("Compatibility", "superb-blocks"); ?></h5>
115 <?php if (isset($this->Incompatibilities[CompatibilitySettingsOptionKey::SPECTRA_BLOCK_SPACING])) :
116 new InputCheckbox('superbaddons-spectra-compat', CompatibilitySettingsOptionKey::SPECTRA_BLOCK_SPACING, __("Fix Block Spacing", "superb-blocks"), __("The Spectra plugin features an option to apply a fixed block spacing between all blocks while in the editor. Unfortunately this option overrides custom block spacing and can result in blocks and patterns appearing strange in the editor. When this setting is enabled, custom block spacing will appear correctly in the editor.", "superb-blocks"), $this->CompatibilitySettings[CompatibilitySettingsOptionKey::SPECTRA_BLOCK_SPACING]);
117 endif; ?>
118 <?php endif; ?>
119 </div>
120 </div>
121 <div class="superbaddons-admindashboard-linkbox-wrapper">
122 <?php new SupportLinkBoxes(); ?>
123 </div>
124 </div>
125 <div class="superbaddons-admindashboard-sidebarlayout-right">
126 <?php new ReviewBox(); ?>
127 </div>
128 </div>
129 <?php new Modal(); ?>
130 <?php
131 }
132
133 private function MaybeDisplayKeyIssue()
134 {
135 if (!$this->KeyStatus['expired'] && $this->KeyStatus['active'] && $this->KeyStatus['verified'] && !$this->KeyStatus['exceeded']) {
136 return;
137 }
138 ?>
139 <div class="spbaddons-license-issue-wrapper">
140 <?php printf('<img src="%s" alt="%s"/>', esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'), esc_attr__("Issue Detected", "superb-blocks")); ?>
141 <p>
142 <?php
143 if ($this->KeyStatus['expired'] && $this->KeyStatus['exceeded'] && $this->KeyStatus['type'] === KeyType::STANDARD) {
144 esc_html_e('It looks like your subscription has expired and your license key is active on too many domains. Please renew your subscription, deactivate your license key on some of your domains, or contact support for assistance.', "superb-blocks");
145 } elseif (
146 $this->KeyStatus['expired']
147 ) {
148 esc_html_e('It looks like your subscription has expired. Please renew your subscription or contact support for assistance.', "superb-blocks");
149 } elseif (
150 !$this->KeyStatus['active']
151 ) {
152 esc_html_e('It looks like your license key has been disabled. Please contact support for assistance.', "superb-blocks");
153 } elseif (
154 !$this->KeyStatus['verified']
155 ) {
156 esc_html_e('It seems that your license key verification for this website is no longer valid. Please click the button below to head to the support section and get started with the troubleshooting process.', "superb-blocks");
157 } elseif (
158 $this->KeyStatus['exceeded']
159 ) {
160 esc_html_e('It looks like your license key has been activated on too many domains. Please renew your subscription, deactivate your license key on some of your domains, or contact support for assistance.', "superb-blocks");
161 }
162 ?>
163 </p>
164 <?php
165 if (!$this->KeyStatus['verified']) : ?>
166 <a href="<?= esc_url(admin_url('admin.php?page=' . DashboardController::SUPPORT)); ?>" class="superbaddons-element-button">
167 <?= esc_html__("Go to Troubleshooting page"); ?>
168 </a>
169 <?php endif; ?>
170 </div>
171 <?php
172 }
173 }
174