PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 3.7.0
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v3.7.0
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 5 months ago class-page-additional-css.php 5 months ago class-page-dashboard.php 5 months ago class-page-settings.php 5 months ago class-page-support.php 5 months ago
class-page-settings.php
186 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\Utils\AdminLinkSource;
10 use SuperbAddons\Admin\Utils\AdminLinkUtil;
11 use SuperbAddons\Components\Admin\EnhancementSettingsComponent;
12 use SuperbAddons\Components\Admin\InputCheckbox;
13 use SuperbAddons\Components\Admin\Modal;
14 use SuperbAddons\Components\Admin\PremiumBoxLarge;
15 use SuperbAddons\Data\Controllers\KeyController;
16
17 use SuperbAddons\Components\Admin\ReviewBox;
18 use SuperbAddons\Components\Admin\SupportLinkBoxes;
19 use SuperbAddons\Data\Controllers\CompatibilitySettingsOptionKey;
20 use SuperbAddons\Data\Controllers\SettingsOptionKey;
21 use SuperbAddons\Data\Utils\KeyType;
22
23 class SettingsPage
24 {
25 private $HasRegisteredKey = false;
26 private $KeyTypeLabel = false;
27 private $KeyStatus = false;
28 private $Settings = false;
29 private $Incompatibilities = false;
30 private $CompatibilitySettings = false;
31
32 public function __construct()
33 {
34 $this->HasRegisteredKey = KeyController::HasRegisteredKey();
35 if ($this->HasRegisteredKey) {
36 $this->KeyTypeLabel = KeyController::GetCurrentKeyTypeLabel();
37 $this->KeyStatus = KeyController::GetKeyStatus();
38 }
39
40 $this->Settings = SettingsController::GetSettings();
41
42 $this->Incompatibilities = SettingsController::GetRelevantCompatibilitySettings();
43 if (count($this->Incompatibilities) > 0) {
44 $this->CompatibilitySettings = SettingsController::GetCompatibilitySettings();
45 }
46
47 $this->Render();
48 }
49
50 private function Render()
51 {
52 ?>
53 <div class="superbaddons-admindashboard-sidebarlayout">
54 <div class="superbaddons-admindashboard-sidebarlayout-left">
55 <?php
56 new PremiumBoxLarge(AdminLinkSource::SETTINGS);
57 ?>
58 <div class="superbaddons-license-key-wrapper">
59 <?php if ($this->HasRegisteredKey) : ?>
60 <div class="superbaddons-license-key-body">
61 <?php $this->MaybeDisplayKeyIssue(); ?>
62 <p class="superbaddons-element-text-sm"><?php echo esc_html__('Current License: ', "superb-blocks"); ?><span class="superbaddons-element-text-md"><?php echo esc_html($this->KeyTypeLabel); ?></span></p>
63 <button id="spbaddons-license-remove-btn" class="superbaddons-element-button spbaddons-admin-btn-danger" type="button"><!-- JS Overwrites --><?php echo esc_html__('Remove License Key', "superb-blocks"); ?></button>
64 </div>
65 <?php else : ?>
66 <div class="superbaddons-license-key-body superbaddons-license-key-body-flex">
67 <div class="superbaddons-license-key-input-wrapper">
68 <img class="spbaddons-license-result-icon spbaddons-license-error" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/color-warning-octagon.svg"); ?>" style="display:none;" />
69 <input id="superbaddons-license-key-input" type="text" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" maxlength="23" />
70 </div>
71 <button id="spbaddons-license-submit-btn" class="superbaddons-element-button" type="button" disabled><?php echo esc_html__('Add License Key', "superb-blocks"); ?></button>
72 </div>
73 <?php endif; ?>
74 <div class="superbaddons-spinner-wrapper" style="display:none;">
75 <img class="spbaddons-spinner" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/blocks-spinner.svg"); ?>" />
76 </div>
77 </div>
78 <div class="superbaddons-editor-settings-wrapper">
79 <?php new EnhancementSettingsComponent(); ?>
80 </div>
81 <div class="superbaddons-additional-content-wrapper">
82 <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("Advanced Settings", "superb-blocks"); ?></h4>
83 <p class="superbaddons-element-text-xs superbaddons-element-text-gray "><?php echo esc_html__("Manage your advanced settings for Superb Addons.", "superb-blocks"); ?></p>
84
85 <div class="superbaddons-cache-settings-wrapper">
86 <!-- Cache Settings -->
87 <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="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-database.svg'); ?>" /><?php echo esc_html__("Cache", "superb-blocks"); ?></h5>
88 <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-mb1"><?php echo esc_html__("Superb Addons caches data for faster loading and processing. Clearing the cache will force data to be refreshed and reloaded. If you are not experiencing any problems with the plugin, the cache should not be cleared.", "superb-blocks"); ?></p>
89 <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="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?php echo esc_html__("Clear Cache", "superb-blocks"); ?></button>
90 </div>
91
92 <div class="superbaddons-restoration-points-settings-wrapper">
93 <!-- Restoration Points Settings -->
94 <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="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-database.svg'); ?>" /><?php echo esc_html__("Template Restoration Points", "superb-blocks"); ?></h5>
95 <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-mb1"><?php echo 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>
96 <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="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?php echo esc_html__("Clear Restoration Points", "superb-blocks"); ?></button>
97 </div>
98
99 <div class="superbaddons-element-separator"></div>
100
101 <div class="superbaddons-error-logs-settings-wrapper">
102 <!-- Error Logs Settings -->
103 <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="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-bug.svg'); ?>" /><?php echo esc_html__("Error Logs", "superb-blocks"); ?></h5>
104 <?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]); ?>
105 <div class="superbaddons-maybe-hide-element" <?php echo $this->Settings[SettingsOptionKey::LOGS_ENABLED] ? '' : 'style="display:none;"'; ?>>
106 <?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'); ?>
107 </div>
108 <button type="button" class="superbaddons-element-button superbaddons-element-mr1" id="superbaddons-view-logs-btn"><img class="superbaddons-element-button-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/list-magnifying-glass.svg'); ?>" /><?php echo esc_html__("View Logs", "superb-blocks"); ?></button>
109 <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger" id="superbaddons-clear-logs-btn"><img class="superbaddons-element-button-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?php echo esc_html__("Clear Logs", "superb-blocks"); ?></button>
110 </div>
111 <div class="superbaddons-compatibility-settings-wrapper">
112 <!-- Compatibility Settings -->
113 <?php if (count($this->Incompatibilities) > 0) : ?>
114 <div class="superbaddons-element-separator"></div>
115 <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="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-plugs.svg'); ?>" /><?php echo esc_html__("Compatibility", "superb-blocks"); ?></h5>
116 <?php if (isset($this->Incompatibilities[CompatibilitySettingsOptionKey::SPECTRA_BLOCK_SPACING])) :
117 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]);
118 endif; ?>
119 <?php endif; ?>
120 </div>
121 </div>
122 <div class="superbaddons-admindashboard-linkbox-wrapper">
123 <?php new SupportLinkBoxes(); ?>
124 </div>
125 </div>
126 <div class="superbaddons-admindashboard-sidebarlayout-right">
127 <?php new ReviewBox(); ?>
128 </div>
129 </div>
130 <?php new Modal(); ?>
131 <?php
132 }
133
134 private function MaybeDisplayKeyIssue()
135 {
136 if (!$this->KeyStatus['expired'] && $this->KeyStatus['active'] && $this->KeyStatus['verified'] && !$this->KeyStatus['exceeded']) {
137 return;
138 }
139 ?>
140 <div class="spbaddons-license-issue-wrapper">
141 <?php printf('<img src="%s" alt="%s"/>', esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'), esc_attr__("Issue Detected", "superb-blocks")); ?>
142 <p>
143 <?php
144 if (
145 $this->KeyStatus['expired']
146 ) {
147 esc_html_e('It looks like your subscription has expired. Please renew your subscription or contact support for assistance.', "superb-blocks");
148 } elseif (
149 !$this->KeyStatus['active']
150 ) {
151 esc_html_e('It looks like your license key has been disabled. Please contact support for assistance.', "superb-blocks");
152 } elseif (
153 !$this->KeyStatus['verified']
154 ) {
155 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");
156 } elseif (
157 $this->KeyStatus['exceeded']
158 ) {
159 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");
160 }
161 ?>
162 <?php if ($this->KeyStatus['expired'] || $this->KeyStatus['exceeded']): ?>
163 <br />
164 <a href="<?php echo esc_url(AdminLinkUtil::GetLink(AdminLinkSource::DEFAULT, array("url" => "https://superbthemes.com/renew-subscription/"))); ?>" target="_blank" class="superbaddons-element-colorlink">
165 <?php echo esc_html__("Renew License", "superb-blocks"); ?>
166 </a>
167 <br />
168 <small>
169 <?php echo esc_html__("If you have already renewed your subscription, please run the troubleshooting process or contact support for assistance.", "superb-blocks"); ?>
170 <a href="<?php echo esc_url(admin_url('admin.php?page=' . DashboardController::SUPPORT)); ?>" class="superbaddons-element-colorlink">
171 <?php echo esc_html__("Go to Troubleshooting page", "superb-blocks"); ?>
172 </a>
173 </small>
174 <?php endif; ?>
175 </p>
176 <?php
177 if (!$this->KeyStatus['verified']) : ?>
178 <a href="<?php echo esc_url(admin_url('admin.php?page=' . DashboardController::SUPPORT)); ?>" class="superbaddons-element-button">
179 <?php echo esc_html__("Go to Troubleshooting page", "superb-blocks"); ?>
180 </a>
181 <?php endif; ?>
182 </div>
183 <?php
184 }
185 }
186