wizard
3 days ago
class-page-additional-css.php
3 days ago
class-page-dashboard.php
3 days ago
class-page-form.php
3 days ago
class-page-settings.php
3 days ago
class-page-support.php
3 days ago
class-page-settings.php
972 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\RewriteCheckController; |
| 9 | use SuperbAddons\Admin\Controllers\SettingsController; |
| 10 | use SuperbAddons\Admin\Utils\AdminLinkSource; |
| 11 | use SuperbAddons\Admin\Utils\AdminLinkUtil; |
| 12 | use SuperbAddons\Components\Admin\EnhancementSettingsComponent; |
| 13 | use SuperbAddons\Components\Admin\InputCheckbox; |
| 14 | use SuperbAddons\Components\Admin\Modal; |
| 15 | use SuperbAddons\Components\Admin\PremiumBox; |
| 16 | use SuperbAddons\Data\Controllers\KeyController; |
| 17 | |
| 18 | use SuperbAddons\Components\Admin\EncryptionNotice; |
| 19 | use SuperbAddons\Components\Admin\InputApiKey; |
| 20 | use SuperbAddons\Components\Admin\ReviewBox; |
| 21 | use SuperbAddons\Components\Admin\SupportBox; |
| 22 | use SuperbAddons\Components\Admin\SupportLinkBoxes; |
| 23 | use SuperbAddons\Data\Controllers\CompatibilitySettingsOptionKey; |
| 24 | use SuperbAddons\Data\Controllers\OptionController; |
| 25 | use SuperbAddons\Data\Controllers\SettingsOptionKey; |
| 26 | use SuperbAddons\Data\Utils\KeyType; |
| 27 | use SuperbAddons\Gutenberg\Controllers\GutenbergController; |
| 28 | use SuperbAddons\Gutenberg\Controllers\GutenbergEnhancementsController; |
| 29 | use SuperbAddons\Gutenberg\Form\FormAccessControl; |
| 30 | use SuperbAddons\Gutenberg\Form\FormPermissions; |
| 31 | use SuperbAddons\Gutenberg\Form\FormSettings; |
| 32 | |
| 33 | class SettingsPage |
| 34 | { |
| 35 | private $HasRegisteredKey = false; |
| 36 | private $KeyTypeLabel = false; |
| 37 | private $KeyStatus = false; |
| 38 | private $KeyHasIssue = false; |
| 39 | private $Settings = false; |
| 40 | private $Incompatibilities = false; |
| 41 | private $CompatibilitySettings = false; |
| 42 | private $MailchimpConfigured = false; |
| 43 | private $MailchimpMaskedKey = ''; |
| 44 | private $BrevoConfigured = false; |
| 45 | private $BrevoMaskedKey = ''; |
| 46 | private $GoogleSheetsConfigured = false; |
| 47 | private $GoogleSheetsClientEmail = ''; |
| 48 | private $EditorEnabledCount = 0; |
| 49 | private $EditorTotalCount = 0; |
| 50 | private $IntegrationCount = 0; |
| 51 | private $IntegrationTotalCount = 0; |
| 52 | private $GlobalEnhancementOptions = array(); |
| 53 | private $GlobalEnabledCount = 0; |
| 54 | private $GlobalTotalCount = 0; |
| 55 | private $DisabledBlocks = array(); |
| 56 | private $DisabledBlockCount = 0; |
| 57 | private $ActiveBlockCount = 0; |
| 58 | private $TotalBlockCount = 0; |
| 59 | |
| 60 | // CAPTCHA config |
| 61 | private $HcaptchaConfigured = false; |
| 62 | private $HcaptchaMaskedSecret = ''; |
| 63 | private $HcaptchaSiteKey = ''; |
| 64 | private $RecaptchaConfigured = false; |
| 65 | private $RecaptchaMaskedSecret = ''; |
| 66 | private $RecaptchaSiteKey = ''; |
| 67 | private $TurnstileConfigured = false; |
| 68 | private $TurnstileMaskedSecret = ''; |
| 69 | private $TurnstileSiteKey = ''; |
| 70 | |
| 71 | // Forms settings |
| 72 | private $DataRetentionDays = 0; |
| 73 | private $DefaultEmail = array(); |
| 74 | private $FormPermissions = array(); |
| 75 | |
| 76 | public function __construct() |
| 77 | { |
| 78 | $this->HasRegisteredKey = KeyController::HasRegisteredKey(); |
| 79 | if ($this->HasRegisteredKey) { |
| 80 | $this->KeyTypeLabel = KeyController::GetCurrentKeyTypeLabel(); |
| 81 | $this->KeyStatus = KeyController::GetKeyStatus(); |
| 82 | $this->KeyHasIssue = $this->KeyStatus['expired'] || !$this->KeyStatus['active'] || !$this->KeyStatus['verified'] || $this->KeyStatus['exceeded']; |
| 83 | } |
| 84 | |
| 85 | $this->Settings = SettingsController::GetSettings(); |
| 86 | |
| 87 | $this->Incompatibilities = SettingsController::GetRelevantCompatibilitySettings(); |
| 88 | if (count($this->Incompatibilities) > 0) { |
| 89 | $this->CompatibilitySettings = SettingsController::GetCompatibilitySettings(); |
| 90 | } |
| 91 | |
| 92 | // Enhancement counts: global keys for the card badge, all keys for the status bar |
| 93 | $this->GlobalEnhancementOptions = GutenbergEnhancementsController::GetGlobalEnhancementsOptions(); |
| 94 | $user_options = GutenbergEnhancementsController::GetEnhancementsOptions(get_current_user_id()); |
| 95 | $global_keys = array( |
| 96 | GutenbergEnhancementsController::RESPONSIVE_KEY, |
| 97 | GutenbergEnhancementsController::ANIMATIONS_KEY, |
| 98 | GutenbergEnhancementsController::CONDITIONS_KEY, |
| 99 | GutenbergEnhancementsController::DYNAMIC_CONTENT_KEY, |
| 100 | GutenbergEnhancementsController::NAVIGATION_KEY, |
| 101 | GutenbergEnhancementsController::RICHTEXT_KEY, |
| 102 | GutenbergEnhancementsController::SOCIAL_ICONS_KEY, |
| 103 | GutenbergEnhancementsController::DASHBOARD_SHORTCUTS_KEY, |
| 104 | GutenbergEnhancementsController::STICKY_KEY, |
| 105 | GutenbergEnhancementsController::Z_INDEX_KEY, |
| 106 | ); |
| 107 | $user_keys = array( |
| 108 | GutenbergEnhancementsController::HIGHLIGHTS_KEY, |
| 109 | ); |
| 110 | $this->GlobalTotalCount = count($global_keys); |
| 111 | foreach ($global_keys as $key) { |
| 112 | if (isset($this->GlobalEnhancementOptions[$key]) && $this->GlobalEnhancementOptions[$key]) { |
| 113 | $this->GlobalEnabledCount++; |
| 114 | } |
| 115 | } |
| 116 | // Status bar total = global + per-user |
| 117 | $this->EditorTotalCount = $this->GlobalTotalCount + count($user_keys); |
| 118 | $this->EditorEnabledCount = $this->GlobalEnabledCount; |
| 119 | foreach ($user_keys as $key) { |
| 120 | if (isset($user_options[$key]) && $user_options[$key]) { |
| 121 | $this->EditorEnabledCount++; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | // Disabled blocks |
| 126 | $this->DisabledBlocks = OptionController::GetDisabledBlocks(); |
| 127 | $this->DisabledBlockCount = count($this->DisabledBlocks); |
| 128 | $this->TotalBlockCount = GutenbergController::GetDiscoverableBlockTotal(); |
| 129 | $this->ActiveBlockCount = GutenbergController::GetDiscoverableBlockActiveCount($this->DisabledBlocks); |
| 130 | |
| 131 | // Integrations |
| 132 | $this->IntegrationTotalCount++; |
| 133 | $this->MailchimpConfigured = FormSettings::HasValue(FormSettings::OPTION_MAILCHIMP_API_KEY); |
| 134 | if ($this->MailchimpConfigured) { |
| 135 | $this->MailchimpMaskedKey = FormSettings::GetMasked(FormSettings::OPTION_MAILCHIMP_API_KEY); |
| 136 | $this->IntegrationCount++; |
| 137 | } |
| 138 | $this->IntegrationTotalCount++; |
| 139 | $this->BrevoConfigured = FormSettings::HasValue(FormSettings::OPTION_BREVO_API_KEY); |
| 140 | if ($this->BrevoConfigured) { |
| 141 | $this->BrevoMaskedKey = FormSettings::GetMasked(FormSettings::OPTION_BREVO_API_KEY); |
| 142 | $this->IntegrationCount++; |
| 143 | } |
| 144 | $this->IntegrationTotalCount++; |
| 145 | $this->GoogleSheetsConfigured = FormSettings::HasValue(FormSettings::OPTION_GOOGLE_SHEETS_CLIENT_EMAIL) && FormSettings::HasValue(FormSettings::OPTION_GOOGLE_SHEETS_PRIVATE_KEY); |
| 146 | if ($this->GoogleSheetsConfigured) { |
| 147 | $this->GoogleSheetsClientEmail = FormSettings::Get(FormSettings::OPTION_GOOGLE_SHEETS_CLIENT_EMAIL); |
| 148 | $this->IntegrationCount++; |
| 149 | } |
| 150 | |
| 151 | // CAPTCHA settings |
| 152 | $this->IntegrationTotalCount++; |
| 153 | $this->HcaptchaConfigured = FormSettings::HasValue(FormSettings::OPTION_HCAPTCHA_SITE_KEY) && FormSettings::HasValue(FormSettings::OPTION_HCAPTCHA_SECRET_KEY); |
| 154 | if ($this->HcaptchaConfigured) { |
| 155 | $this->HcaptchaMaskedSecret = FormSettings::GetMasked(FormSettings::OPTION_HCAPTCHA_SECRET_KEY); |
| 156 | $this->HcaptchaSiteKey = FormSettings::Get(FormSettings::OPTION_HCAPTCHA_SITE_KEY); |
| 157 | $this->IntegrationCount++; |
| 158 | } |
| 159 | $this->IntegrationTotalCount++; |
| 160 | $this->RecaptchaConfigured = FormSettings::HasValue(FormSettings::OPTION_RECAPTCHA_SITE_KEY) && FormSettings::HasValue(FormSettings::OPTION_RECAPTCHA_SECRET_KEY); |
| 161 | if ($this->RecaptchaConfigured) { |
| 162 | $this->RecaptchaMaskedSecret = FormSettings::GetMasked(FormSettings::OPTION_RECAPTCHA_SECRET_KEY); |
| 163 | $this->RecaptchaSiteKey = FormSettings::Get(FormSettings::OPTION_RECAPTCHA_SITE_KEY); |
| 164 | $this->IntegrationCount++; |
| 165 | } |
| 166 | $this->IntegrationTotalCount++; |
| 167 | $this->TurnstileConfigured = FormSettings::HasValue(FormSettings::OPTION_TURNSTILE_SITE_KEY) && FormSettings::HasValue(FormSettings::OPTION_TURNSTILE_SECRET_KEY); |
| 168 | if ($this->TurnstileConfigured) { |
| 169 | $this->TurnstileMaskedSecret = FormSettings::GetMasked(FormSettings::OPTION_TURNSTILE_SECRET_KEY); |
| 170 | $this->TurnstileSiteKey = FormSettings::Get(FormSettings::OPTION_TURNSTILE_SITE_KEY); |
| 171 | $this->IntegrationCount++; |
| 172 | } |
| 173 | |
| 174 | // Forms settings |
| 175 | $this->DataRetentionDays = intval(get_option('superbaddons_form_data_retention', 0)); |
| 176 | $this->DefaultEmail = get_option('superbaddons_form_default_email', array()); |
| 177 | if (!is_array($this->DefaultEmail)) { |
| 178 | $this->DefaultEmail = array(); |
| 179 | } |
| 180 | $this->FormPermissions = FormPermissions::GetAll(); |
| 181 | |
| 182 | $this->Render(); |
| 183 | } |
| 184 | |
| 185 | private function Render() |
| 186 | { |
| 187 | $license_status_class = 'superbaddons-status-dot--gray'; |
| 188 | $license_status_label = __('No License', 'superb-blocks'); |
| 189 | if ($this->HasRegisteredKey) { |
| 190 | if ($this->KeyHasIssue) { |
| 191 | $license_status_class = 'superbaddons-status-dot--red'; |
| 192 | $license_status_label = __('Issue Detected', 'superb-blocks'); |
| 193 | } else { |
| 194 | $license_status_class = 'superbaddons-status-dot--green'; |
| 195 | $license_status_label = $this->KeyTypeLabel; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | $enhancement_dot = 'superbaddons-status-dot--gray'; |
| 200 | if ($this->EditorEnabledCount >= 4) { |
| 201 | $enhancement_dot = 'superbaddons-status-dot--green'; |
| 202 | } elseif ($this->EditorEnabledCount > 0) { |
| 203 | $enhancement_dot = 'superbaddons-status-dot--yellow'; |
| 204 | } |
| 205 | ?> |
| 206 | <!-- Status Dashboard Header --> |
| 207 | <div class="superbaddons-settings-status-bar superbaddons-dashboard-welcome-strip"> |
| 208 | <span class="superbaddons-dashboard-welcome-title"><?php esc_html_e("Settings", "superb-blocks"); ?></span> |
| 209 | <div class="superbaddons-dashboard-stat-items"> |
| 210 | <a href="#license" class="superbaddons-settings-status-item" data-tab-link="license"> |
| 211 | <span class="superbaddons-status-dot <?php echo esc_attr($license_status_class); ?>"></span> |
| 212 | <?php echo esc_html__('License:', 'superb-blocks'); ?> <?php echo esc_html($license_status_label); ?> |
| 213 | </a> |
| 214 | <a href="#modules" class="superbaddons-settings-status-item" data-tab-link="modules"> |
| 215 | <span class="superbaddons-status-dot <?php echo $this->DisabledBlockCount === 0 ? 'superbaddons-status-dot--green' : 'superbaddons-status-dot--yellow'; ?>"></span> |
| 216 | <?php echo esc_html(sprintf( |
| 217 | /* translators: %1$d: active block count, %2$d: total block count */ |
| 218 | __('Blocks: %1$d/%2$d', 'superb-blocks'), |
| 219 | $this->ActiveBlockCount, |
| 220 | $this->TotalBlockCount |
| 221 | )); ?> |
| 222 | </a> |
| 223 | <a href="#modules" class="superbaddons-settings-status-item" data-tab-link="modules"> |
| 224 | <span class="superbaddons-status-dot <?php echo esc_attr($enhancement_dot); ?>"></span> |
| 225 | <?php echo esc_html(sprintf( |
| 226 | /* translators: %1$d: enabled enhancement count, %2$d: total enhancement count */ |
| 227 | __('Enhancements: %1$d/%2$d', 'superb-blocks'), |
| 228 | $this->EditorEnabledCount, |
| 229 | $this->EditorTotalCount |
| 230 | )); ?> |
| 231 | </a> |
| 232 | <a href="#integrations" class="superbaddons-settings-status-item" data-tab-link="integrations"> |
| 233 | <span class="superbaddons-status-dot <?php echo $this->IntegrationCount >= 1 ? 'superbaddons-status-dot--green' : 'superbaddons-status-dot--gray'; ?>"></span> |
| 234 | <?php echo esc_html(sprintf( |
| 235 | /* translators: %1$d: number of connected integrations, %2$d: total integrations */ |
| 236 | __('Integrations: %1$d/%2$d', 'superb-blocks'), |
| 237 | $this->IntegrationCount, |
| 238 | $this->IntegrationTotalCount |
| 239 | )); ?> |
| 240 | </a> |
| 241 | <a href="#advanced" class="superbaddons-settings-status-item" data-tab-link="advanced"> |
| 242 | <span class="superbaddons-status-dot <?php echo $this->Settings[SettingsOptionKey::LOGS_ENABLED] ? 'superbaddons-status-dot--green' : 'superbaddons-status-dot--gray'; ?>"></span> |
| 243 | <?php echo esc_html__('Logs:', 'superb-blocks'); ?> <?php echo $this->Settings[SettingsOptionKey::LOGS_ENABLED] ? esc_html__('Enabled', 'superb-blocks') : esc_html__('Disabled', 'superb-blocks'); ?> |
| 244 | </a> |
| 245 | </div> |
| 246 | </div> |
| 247 | |
| 248 | <!-- Settings Search --> |
| 249 | <div class="superbaddons-settings-search-wrapper"> |
| 250 | <input type="text" class="superbaddons-settings-search" placeholder="<?php echo esc_attr__('Search settings...', 'superb-blocks'); ?>" /> |
| 251 | </div> |
| 252 | |
| 253 | <!-- Settings Tabs --> |
| 254 | <div class="superbaddons-settings-tabs"> |
| 255 | <button class="superbaddons-settings-tab superbaddons-settings-tab--active" data-tab="license" type="button"><?php echo esc_html__('License & Account', 'superb-blocks'); ?></button> |
| 256 | <button class="superbaddons-settings-tab" data-tab="modules" type="button"><?php echo esc_html__('Blocks & Enhancements', 'superb-blocks'); ?></button> |
| 257 | <button class="superbaddons-settings-tab" data-tab="integrations" type="button"><?php echo esc_html__('Integrations', 'superb-blocks'); ?></button> |
| 258 | <button class="superbaddons-settings-tab" data-tab="forms" type="button"><?php echo esc_html__('Forms', 'superb-blocks'); ?></button> |
| 259 | <button class="superbaddons-settings-tab" data-tab="advanced" type="button"><?php echo esc_html__('Advanced', 'superb-blocks'); ?></button> |
| 260 | </div> |
| 261 | |
| 262 | <div class="superbaddons-admindashboard-sidebarlayout"> |
| 263 | <div class="superbaddons-admindashboard-sidebarlayout-left"> |
| 264 | |
| 265 | <!-- Tab: License & Account --> |
| 266 | <div class="superbaddons-settings-tab-content superbaddons-settings-tab-content--active" data-tab-content="license"> |
| 267 | <div class="superbaddons-license-key-wrapper superbaddons-settings-section"> |
| 268 | <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("License Key", "superb-blocks"); ?></h4> |
| 269 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Manage your Superb Addons license key.", "superb-blocks"); ?></p> |
| 270 | <?php $this->MaybeDisplayRewriteIssue(); ?> |
| 271 | <?php if ($this->HasRegisteredKey) : ?> |
| 272 | <div class="superbaddons-license-key-body"> |
| 273 | <?php $this->MaybeDisplayKeyIssue(); ?> |
| 274 | <?php $this->MaybeDisplayPremiumPluginMissingNotice(); ?> |
| 275 | <p class="superbaddons-element-text-sm"><?php echo esc_html__('Current License: ', "superb-blocks"); ?><span class="superbaddons-element-text-800"><?php echo esc_html($this->KeyTypeLabel); ?></span></p> |
| 276 | <button id="spbaddons-license-remove-btn" class="superbaddons-element-button spbaddons-admin-btn-danger" type="button"><?php echo esc_html__('Remove License Key', "superb-blocks"); ?></button> |
| 277 | </div> |
| 278 | <?php else : ?> |
| 279 | <div class="superbaddons-license-key-body superbaddons-license-key-body-flex"> |
| 280 | <div class="superbaddons-license-key-input-wrapper"> |
| 281 | <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;" /> |
| 282 | <input id="superbaddons-license-key-input" type="text" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" maxlength="23" /> |
| 283 | </div> |
| 284 | <button id="spbaddons-license-submit-btn" class="superbaddons-element-button" type="button" disabled><?php echo esc_html__('Add License Key', "superb-blocks"); ?></button> |
| 285 | </div> |
| 286 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-license-key-help"> |
| 287 | <a href="<?php echo esc_url(AdminLinkUtil::GetLink(AdminLinkSource::SETTINGS, array("url" => "https://superbthemes.com/license-key/"))); ?>" target="_blank" rel="noopener"><?php echo esc_html__("Where do I find my license key?", "superb-blocks"); ?></a> |
| 288 | </p> |
| 289 | <?php endif; ?> |
| 290 | <div class="superbaddons-spinner-wrapper" style="display:none;"> |
| 291 | <img class="spbaddons-spinner" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/blocks-spinner.svg"); ?>" /> |
| 292 | </div> |
| 293 | </div> |
| 294 | <div class="superbaddons-admindashboard-linkbox-wrapper"> |
| 295 | <?php new SupportLinkBoxes(); ?> |
| 296 | </div> |
| 297 | </div> |
| 298 | |
| 299 | <!-- Tab: Modules --> |
| 300 | <div class="superbaddons-settings-tab-content" data-tab-content="modules"> |
| 301 | <div class="superbaddons-settings-section"> |
| 302 | <div class="superbaddons-dashboard-section-header"> |
| 303 | <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("Gutenberg Blocks", "superb-blocks"); ?></h4> |
| 304 | <span class="superbaddons-dashboard-count-badge"><?php echo esc_html(sprintf( |
| 305 | /* translators: %1$d: active, %2$d: total */ |
| 306 | __('%1$d/%2$d Active', 'superb-blocks'), |
| 307 | $this->ActiveBlockCount, |
| 308 | $this->TotalBlockCount |
| 309 | )); ?></span> |
| 310 | </div> |
| 311 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Toggle blocks on or off. Disabled blocks can no longer be inserted, but existing content will continue to render.", "superb-blocks"); ?></p> |
| 312 | <div class="superbaddons-modules-block-grid"> |
| 313 | <?php |
| 314 | $block_data = array( |
| 315 | 'author-box' => array('label' => __('About the Author', 'superb-blocks'), 'icon' => 'purple-identification-badge.svg'), |
| 316 | 'ratings' => array('label' => __('Rating Block', 'superb-blocks'), 'icon' => 'purple-star.svg'), |
| 317 | 'table-of-contents' => array('label' => __('Table of Contents', 'superb-blocks'), 'icon' => 'purple-list-bullets.svg'), |
| 318 | 'recent-posts' => array('label' => __('Recent Posts', 'superb-blocks'), 'icon' => 'purple-note.svg'), |
| 319 | 'cover-image' => array('label' => __('Cover Image', 'superb-blocks'), 'icon' => 'purple-image.svg'), |
| 320 | 'google-maps' => array('label' => __('Google Maps', 'superb-blocks'), 'icon' => 'purple-pin.svg'), |
| 321 | 'reveal-buttons' => array('label' => __('Reveal Buttons', 'superb-blocks'), 'icon' => 'purple-pointing.svg'), |
| 322 | 'accordion' => array('label' => __('Toggle', 'superb-blocks'), 'icon' => 'accordion-icon-purple.svg'), |
| 323 | 'carousel' => array('label' => __('Carousel Slider', 'superb-blocks'), 'icon' => 'icon-carousel.svg'), |
| 324 | 'countdown' => array('label' => __('Countdown', 'superb-blocks'), 'icon' => 'icon-countdown.svg'), |
| 325 | 'progress-bar' => array('label' => __('Progress Bar', 'superb-blocks'), 'icon' => 'icon-progressbar.svg'), |
| 326 | 'popup' => array('label' => __('Popup', 'superb-blocks'), 'icon' => 'icon-popup.svg'), |
| 327 | 'form' => array('label' => __('Form & Multi-Step Form', 'superb-blocks'), 'icon' => 'icon-form.svg'), |
| 328 | 'add-to-cart' => array('label' => __('Add to Cart & Buy Now', 'superb-blocks'), 'icon' => 'purple-shopping-cart.svg'), |
| 329 | ); |
| 330 | foreach (GutenbergController::TOGGLEABLE_BLOCKS as $block_slug) : |
| 331 | $is_enabled = !in_array($block_slug, $this->DisabledBlocks, true); |
| 332 | $data = isset($block_data[$block_slug]) ? $block_data[$block_slug] : array('label' => $block_slug, 'icon' => 'purple-cube.svg'); |
| 333 | ?> |
| 334 | <div class="superb-addons-checkbox-input-wrapper superbaddons-modules-block-item"> |
| 335 | <label class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-inlineflex-center superbaddons-element-relative"> |
| 336 | <input name="superbaddons-block-<?php echo esc_attr($block_slug); ?>" class="superbaddons-inputcheckbox-input superbaddons-block-toggle-input" data-block="<?php echo esc_attr($block_slug); ?>" type="checkbox" <?php echo $is_enabled ? 'checked="checked"' : ''; ?> /> |
| 337 | <span class="superb-addons-checkbox-checkmark"><img class="superbaddons-admindashboard-content-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" /></span> |
| 338 | <img class="superbaddons-modules-block-item-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/' . $data['icon']); ?>" aria-hidden="true" /> |
| 339 | <span><?php echo esc_html($data['label']); ?></span> |
| 340 | </label> |
| 341 | </div> |
| 342 | <?php endforeach; ?> |
| 343 | </div> |
| 344 | </div> |
| 345 | <div class="superbaddons-settings-section"> |
| 346 | <div class="superbaddons-dashboard-section-header"> |
| 347 | <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("Editor Enhancements", "superb-blocks"); ?></h4> |
| 348 | <span class="superbaddons-dashboard-count-badge"><?php echo esc_html(sprintf( |
| 349 | /* translators: %1$d: active, %2$d: total */ |
| 350 | __('%1$d/%2$d Active', 'superb-blocks'), |
| 351 | $this->GlobalEnabledCount, |
| 352 | $this->GlobalTotalCount |
| 353 | )); ?></span> |
| 354 | </div> |
| 355 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Toggle editor enhancements on or off. These settings apply to all users on the site.", "superb-blocks"); ?></p> |
| 356 | <div class="superbaddons-modules-block-grid superbaddons-modules-block-grid--enhancements"> |
| 357 | <?php |
| 358 | $enhancement_data = array( |
| 359 | array('id' => 'superbaddons-enhancement-responsive-input', 'key' => GutenbergEnhancementsController::RESPONSIVE_KEY, 'label' => __('Responsive Controls', 'superb-blocks'), 'icon' => 'devices-duotone.svg', 'desc' => __('Per-device visibility toggles, spacing, font size, alignment overrides, and more for all blocks.', 'superb-blocks')), |
| 360 | array('id' => 'superbaddons-enhancement-animations-input', 'key' => GutenbergEnhancementsController::ANIMATIONS_KEY, 'label' => __('Animations', 'superb-blocks'), 'icon' => 'sneaker-move-duotone.svg', 'desc' => __('40+ block animations, letter effects, and typing & counting animations for all blocks.', 'superb-blocks')), |
| 361 | array('id' => 'superbaddons-enhancement-conditions-input', 'key' => GutenbergEnhancementsController::CONDITIONS_KEY, 'label' => __('Block Conditions', 'superb-blocks'), 'icon' => 'target-duotone.svg', 'desc' => __('Show or hide blocks based on user status, roles, post type, categories, and more.', 'superb-blocks')), |
| 362 | array('id' => 'superbaddons-enhancement-dynamiccontent-input', 'key' => GutenbergEnhancementsController::DYNAMIC_CONTENT_KEY, 'label' => __('Dynamic Content', 'superb-blocks'), 'icon' => 'brackets-curly-duotone.svg', 'desc' => __('Insert post data, author info, dates, and custom fields dynamically into any text block.', 'superb-blocks')), |
| 363 | array('id' => 'superbaddons-enhancement-navigation-input', 'key' => GutenbergEnhancementsController::NAVIGATION_KEY, 'label' => __('Navigation Enhancements', 'superb-blocks'), 'icon' => 'purple-list-bullets.svg', 'desc' => __('Mobile overlay justification options and submenu layout improvements for the navigation block.', 'superb-blocks')), |
| 364 | array('id' => 'superbaddons-enhancement-richtext-input', 'key' => GutenbergEnhancementsController::RICHTEXT_KEY, 'label' => __('Rich Text', 'superb-blocks'), 'icon' => 'purple-aa.svg', 'desc' => __('Rich text enhancements such as justify text alignment for text-based blocks.', 'superb-blocks')), |
| 365 | array('id' => 'superbaddons-enhancement-socialicons-input', 'key' => GutenbergEnhancementsController::SOCIAL_ICONS_KEY, 'label' => __('Extra Social Icons', 'superb-blocks'), 'icon' => 'purple-chat.svg', 'desc' => __('Adds 20+ additional icons to the core Social Icons block (Bilibili, Ko-fi, Signal, Slack, Steam, Substack, and more).', 'superb-blocks')), |
| 366 | array('id' => 'superbaddons-enhancement-dashboardshortcuts-input', 'key' => GutenbergEnhancementsController::DASHBOARD_SHORTCUTS_KEY, 'label' => __('Admin Shortcuts', 'superb-blocks'), 'icon' => 'purple-gauge.svg', 'desc' => __('Adds handy block theme shortcuts such as Edit Front Page and Style Book.', 'superb-blocks')), |
| 367 | array('id' => 'superbaddons-enhancement-sticky-input', 'key' => GutenbergEnhancementsController::STICKY_KEY, 'label' => __('Sticky Positioning', 'superb-blocks'), 'icon' => 'pushpin-duotone.svg', 'desc' => __('Pin any block to the top or bottom of the screen as visitors scroll, with scope and per-device control.', 'superb-blocks')), |
| 368 | array('id' => 'superbaddons-enhancement-zindex-input', 'key' => GutenbergEnhancementsController::Z_INDEX_KEY, 'label' => __('Stacking Order', 'superb-blocks'), 'icon' => 'stack-simple-duotone.svg', 'desc' => __('Adds a z-index control to the Advanced panel of any block, with quick presets for common stacking levels.', 'superb-blocks')), |
| 369 | ); |
| 370 | foreach ($enhancement_data as $enh) : |
| 371 | $is_enabled = isset($this->GlobalEnhancementOptions[$enh['key']]) && $this->GlobalEnhancementOptions[$enh['key']]; |
| 372 | ?> |
| 373 | <div class="superb-addons-checkbox-input-wrapper superbaddons-modules-block-item"> |
| 374 | <label class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-inlineflex-center superbaddons-element-relative"> |
| 375 | <input id="<?php echo esc_attr($enh['id']); ?>" name="<?php echo esc_attr($enh['id']); ?>" class="superbaddons-inputcheckbox-input" data-action="<?php echo esc_attr($enh['key']); ?>" type="checkbox" <?php echo $is_enabled ? 'checked="checked"' : ''; ?> /> |
| 376 | <span class="superb-addons-checkbox-checkmark"><img class="superbaddons-admindashboard-content-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" /></span> |
| 377 | <img class="superbaddons-modules-block-item-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/' . $enh['icon']); ?>" aria-hidden="true" /> |
| 378 | <span><?php echo esc_html($enh['label']); ?></span> |
| 379 | <button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button> |
| 380 | </label> |
| 381 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text"><?php echo esc_html($enh['desc']); ?></p> |
| 382 | </div> |
| 383 | <?php endforeach; ?> |
| 384 | </div> |
| 385 | </div> |
| 386 | <div class="superbaddons-editor-settings-wrapper superbaddons-settings-section"> |
| 387 | <?php new EnhancementSettingsComponent(); ?> |
| 388 | </div> |
| 389 | </div> |
| 390 | |
| 391 | <!-- Tab: Integrations --> |
| 392 | <div class="superbaddons-settings-tab-content" data-tab-content="integrations"> |
| 393 | <div class="superbaddons-form-settings-wrapper superbaddons-settings-section" id="form-settings"> |
| 394 | <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("Integrations", "superb-blocks"); ?></h4> |
| 395 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Connect third-party services to your website.", "superb-blocks"); ?></p> |
| 396 | <?php new EncryptionNotice(); ?> |
| 397 | <div class="superbaddons-integration-cards"> |
| 398 | <?php |
| 399 | new InputApiKey( |
| 400 | 'superbaddons-mailchimp-key', |
| 401 | 'mailchimp', |
| 402 | __("Mailchimp", "superb-blocks"), |
| 403 | __("Connect form submissions to your Mailchimp audiences.", "superb-blocks"), |
| 404 | 'https://admin.mailchimp.com/account/api/', |
| 405 | __("Get API key from Mailchimp", "superb-blocks"), |
| 406 | $this->MailchimpConfigured, |
| 407 | $this->MailchimpMaskedKey, |
| 408 | __("Enter Mailchimp API key", "superb-blocks") |
| 409 | ); |
| 410 | new InputApiKey( |
| 411 | 'superbaddons-brevo-key', |
| 412 | 'brevo', |
| 413 | __("Brevo (Sendinblue)", "superb-blocks"), |
| 414 | __("Connect form submissions to your Brevo contact lists.", "superb-blocks"), |
| 415 | 'https://app.brevo.com/settings/keys/api', |
| 416 | __("Get API key from Brevo", "superb-blocks"), |
| 417 | $this->BrevoConfigured, |
| 418 | $this->BrevoMaskedKey, |
| 419 | __("Enter Brevo API key", "superb-blocks") |
| 420 | ); |
| 421 | $this->RenderGoogleSheetsCard(); |
| 422 | $this->RenderCaptchaCard('hcaptcha', __('hCaptcha', 'superb-blocks'), __('Privacy-focused challenge widget for your forms.', 'superb-blocks'), $this->HcaptchaConfigured, $this->HcaptchaSiteKey, $this->HcaptchaMaskedSecret, 'https://dashboard.hcaptcha.com/signup', __('Get keys from hCaptcha Dashboard', 'superb-blocks')); |
| 423 | $this->RenderCaptchaCard('recaptcha', __('reCAPTCHA (Google)', 'superb-blocks'), __('Works with both reCAPTCHA v2 and v3 for your forms.', 'superb-blocks'), $this->RecaptchaConfigured, $this->RecaptchaSiteKey, $this->RecaptchaMaskedSecret, 'https://www.google.com/recaptcha/admin', __('Get keys from Google reCAPTCHA', 'superb-blocks')); |
| 424 | $this->RenderCaptchaCard('turnstile', __('Cloudflare Turnstile', 'superb-blocks'), __('Non-intrusive Cloudflare challenge for your forms.', 'superb-blocks'), $this->TurnstileConfigured, $this->TurnstileSiteKey, $this->TurnstileMaskedSecret, 'https://dash.cloudflare.com/?to=:/turnstile', __('Get keys from Cloudflare Dashboard', 'superb-blocks')); |
| 425 | ?> |
| 426 | </div> |
| 427 | </div> |
| 428 | </div> |
| 429 | |
| 430 | <!-- Tab: Forms --> |
| 431 | <div class="superbaddons-settings-tab-content" data-tab-content="forms"> |
| 432 | <?php $this->RenderFormsTabContent(); ?> |
| 433 | </div> |
| 434 | |
| 435 | <!-- Tab: Advanced --> |
| 436 | <div class="superbaddons-settings-tab-content" data-tab-content="advanced"> |
| 437 | <div class="superbaddons-additional-content-wrapper superbaddons-settings-section"> |
| 438 | <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> |
| 439 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Manage your advanced settings for Superb Addons.", "superb-blocks"); ?></p> |
| 440 | |
| 441 | <div class="superbaddons-error-logs-settings-wrapper"> |
| 442 | <!-- Error Logs Settings --> |
| 443 | <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> |
| 444 | <?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]); ?> |
| 445 | <div class="superbaddons-maybe-hide-element" <?php echo $this->Settings[SettingsOptionKey::LOGS_ENABLED] ? '' : 'style="display:none;"'; ?>> |
| 446 | <?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'); ?> |
| 447 | </div> |
| 448 | <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> |
| 449 | </div> |
| 450 | |
| 451 | <div class="superbaddons-compatibility-settings-wrapper"> |
| 452 | <!-- Compatibility Settings --> |
| 453 | <?php if (count($this->Incompatibilities) > 0) : ?> |
| 454 | <div class="superbaddons-element-separator"></div> |
| 455 | <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> |
| 456 | <?php if (isset($this->Incompatibilities[CompatibilitySettingsOptionKey::SPECTRA_BLOCK_SPACING])) : |
| 457 | 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]); |
| 458 | endif; ?> |
| 459 | <?php endif; ?> |
| 460 | </div> |
| 461 | </div> |
| 462 | |
| 463 | <!-- Danger Zone --> |
| 464 | <div class="superbaddons-danger-zone"> |
| 465 | <h5 class="superbaddons-danger-zone-title"> |
| 466 | <img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'); ?>" /> |
| 467 | <?php echo esc_html__("Danger Zone", "superb-blocks"); ?> |
| 468 | </h5> |
| 469 | <div class="superbaddons-danger-zone-item"> |
| 470 | <div class="superbaddons-danger-zone-item-info"> |
| 471 | <strong><?php echo esc_html__("Clear Cache", "superb-blocks"); ?></strong> |
| 472 | <p><?php echo esc_html__("Removes all cached plugin data. Only clear if experiencing issues.", "superb-blocks"); ?></p> |
| 473 | </div> |
| 474 | <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-button-sm" 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", "superb-blocks"); ?></button> |
| 475 | </div> |
| 476 | <div class="superbaddons-danger-zone-item"> |
| 477 | <div class="superbaddons-danger-zone-item-info"> |
| 478 | <strong><?php echo esc_html__("Clear Restoration Points", "superb-blocks"); ?></strong> |
| 479 | <p><?php echo esc_html__("Removes all saved theme designer template restore points. Auto-deleted after 2 months.", "superb-blocks"); ?></p> |
| 480 | </div> |
| 481 | <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-button-sm" 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", "superb-blocks"); ?></button> |
| 482 | </div> |
| 483 | <div class="superbaddons-danger-zone-item"> |
| 484 | <div class="superbaddons-danger-zone-item-info"> |
| 485 | <strong><?php echo esc_html__("Clear Error Logs", "superb-blocks"); ?></strong> |
| 486 | <p><?php echo esc_html__("Permanently deletes all recorded error logs.", "superb-blocks"); ?></p> |
| 487 | </div> |
| 488 | <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-button-sm" 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", "superb-blocks"); ?></button> |
| 489 | </div> |
| 490 | <div class="superbaddons-danger-zone-item"> |
| 491 | <div class="superbaddons-danger-zone-item-info"> |
| 492 | <strong><?php echo esc_html__("Remove All Plugin Data", "superb-blocks"); ?></strong> |
| 493 | <p><?php echo esc_html__("Permanently removes every plugin option, setting, user preference, integration key, license, and scheduled task. Use this before uninstalling for a clean removal.", "superb-blocks"); ?></p> |
| 494 | </div> |
| 495 | <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-button-sm" id="superbaddons-remove-all-data-btn"><img class="superbaddons-element-button-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?php echo esc_html__("Remove", "superb-blocks"); ?></button> |
| 496 | </div> |
| 497 | </div> |
| 498 | </div> |
| 499 | |
| 500 | </div> |
| 501 | <div class="superbaddons-admindashboard-sidebarlayout-right"> |
| 502 | <?php new PremiumBox(AdminLinkSource::SETTINGS); ?> |
| 503 | <!-- Sidebar: License tab --> |
| 504 | <div class="superbaddons-settings-tab-sidebar superbaddons-settings-tab-sidebar--active" data-tab-sidebar="license"> |
| 505 | <?php new ReviewBox(); ?> |
| 506 | </div> |
| 507 | <!-- Sidebar: Editor tab --> |
| 508 | <div class="superbaddons-settings-tab-sidebar" data-tab-sidebar="modules"> |
| 509 | <?php new ReviewBox(); ?> |
| 510 | </div> |
| 511 | <!-- Sidebar: Integrations tab --> |
| 512 | <div class="superbaddons-settings-tab-sidebar" data-tab-sidebar="integrations"> |
| 513 | <?php new SupportBox(); ?> |
| 514 | </div> |
| 515 | <!-- Sidebar: Forms tab --> |
| 516 | <div class="superbaddons-settings-tab-sidebar" data-tab-sidebar="forms"> |
| 517 | <?php new SupportBox(); ?> |
| 518 | </div> |
| 519 | <!-- Sidebar: Advanced tab --> |
| 520 | <div class="superbaddons-settings-tab-sidebar" data-tab-sidebar="advanced"> |
| 521 | <?php new SupportBox(); ?> |
| 522 | </div> |
| 523 | </div> |
| 524 | </div> |
| 525 | <?php new Modal(); ?> |
| 526 | <?php |
| 527 | } |
| 528 | |
| 529 | private function RenderGoogleSheetsCard() |
| 530 | { |
| 531 | ?> |
| 532 | <div class="superbaddons-integration-card <?php echo $this->GoogleSheetsConfigured ? 'superbaddons-integration-card--connected' : ''; ?>" data-integration="google_sheets"> |
| 533 | <div class="superbaddons-integration-card-header"> |
| 534 | <img class="superbaddons-integration-card-logo" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/google-sheets-icon.svg'); ?>" /> |
| 535 | <h5 class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("Google Sheets", "superb-blocks"); ?></h5> |
| 536 | <?php if ($this->GoogleSheetsConfigured) : ?> |
| 537 | <span class="superbaddons-integration-card-badge superbaddons-integration-card-badge--connected"><?php echo esc_html__("Connected", "superb-blocks"); ?></span> |
| 538 | <?php else : ?> |
| 539 | <span class="superbaddons-integration-card-badge"><?php echo esc_html__("Not Connected", "superb-blocks"); ?></span> |
| 540 | <?php endif; ?> |
| 541 | </div> |
| 542 | <div class="superbaddons-integration-card-body"> |
| 543 | <?php if ($this->GoogleSheetsConfigured) : ?> |
| 544 | <div class="superbaddons-integration-card-connected-info"> |
| 545 | <code class="superbaddons-input-api-key-masked"><?php echo esc_html($this->GoogleSheetsClientEmail); ?></code> |
| 546 | <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-element-button-sm superbaddons-input-api-key-remove-btn" id="superbaddons-google-sheets-key-remove-btn"><img class="superbaddons-element-button-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?php echo esc_html__("Disconnect", "superb-blocks"); ?></button> |
| 547 | </div> |
| 548 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-gs-share-hint"><?php echo esc_html__("Share your spreadsheet with this email address (as an Editor) so it can add rows.", "superb-blocks"); ?></p> |
| 549 | <?php else : ?> |
| 550 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-integration-card-description" style="flex:0;"><?php echo esc_html__("Append form submissions as rows to a Google spreadsheet.", "superb-blocks"); ?><button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button></p> |
| 551 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text"><?php echo esc_html__("Create a Service Account in Google Cloud and enable the Google Sheets API, then create a JSON key for it and download the file. Paste the entire file contents here and click Connect. After connecting, share your spreadsheet with the service account email (shown once connected) as an Editor so it can add rows.", "superb-blocks"); ?></p> |
| 552 | <div class="superbaddons-input-api-key-input-row" style="flex:1;"> |
| 553 | <textarea id="superbaddons-google-sheets-key-input" class="superbaddons-input-api-key-input" rows="3" placeholder="<?php echo esc_attr__("Paste Service Account JSON key", "superb-blocks"); ?>" autocomplete="off"></textarea> |
| 554 | <button type="button" class="superbaddons-element-button superbaddons-element-button-sm superbaddons-input-api-key-save-btn" id="superbaddons-google-sheets-key-save-btn" disabled><?php echo esc_html__("Connect", "superb-blocks"); ?></button> |
| 555 | </div> |
| 556 | |
| 557 | <div class="superbaddons-spinner-wrapper superbaddons-input-api-key-spinner" id="superbaddons-google-sheets-key-spinner" style="display:none;"> |
| 558 | <img class="spbaddons-spinner" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/blocks-spinner.svg"); ?>" /> |
| 559 | </div> |
| 560 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><a href="https://console.cloud.google.com/iam-admin/serviceaccounts" target="_blank" rel="noopener noreferrer"><?php echo esc_html__("Create a Service Account in Google Cloud Console", "superb-blocks"); ?></a></p> |
| 561 | <?php endif; ?> |
| 562 | </div> |
| 563 | </div> |
| 564 | <?php |
| 565 | } |
| 566 | |
| 567 | private function RenderCaptchaCard($provider, $title, $description, $configured, $site_key, $masked_secret, $dashboard_url, $dashboard_label) |
| 568 | { |
| 569 | $usage_count = FormSettings::CountFormsUsingCaptchaProvider($provider); |
| 570 | $icon_path = SUPERBADDONS_ASSETS_PATH . '/img/' . $provider . '-icon.svg'; |
| 571 | ?> |
| 572 | <div class="superbaddons-captcha-card <?php echo $configured ? 'superbaddons-captcha-card--connected' : ''; ?>" data-captcha-provider="<?php echo esc_attr($provider); ?>"> |
| 573 | <div class="superbaddons-captcha-card-header"> |
| 574 | <img class="superbaddons-integration-card-logo" src="<?php echo esc_url($icon_path); ?>" /> |
| 575 | <h5 class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html($title); ?></h5> |
| 576 | <?php if ($configured) : ?> |
| 577 | <span class="superbaddons-integration-card-badge superbaddons-integration-card-badge--connected"><?php echo esc_html__("Connected", "superb-blocks"); ?></span> |
| 578 | <?php else : ?> |
| 579 | <span class="superbaddons-integration-card-badge"><?php echo esc_html__("Not Connected", "superb-blocks"); ?></span> |
| 580 | <?php endif; ?> |
| 581 | <?php if ($usage_count > 0) : ?> |
| 582 | <span class="superbaddons-integration-usage-badge" data-usage-count="<?php echo intval($usage_count); ?>"><?php echo esc_html(sprintf( |
| 583 | /* translators: %d: number of forms */ |
| 584 | __('In use on %d forms', 'superb-blocks'), |
| 585 | $usage_count |
| 586 | )); ?></span> |
| 587 | <?php endif; ?> |
| 588 | </div> |
| 589 | <div class="superbaddons-captcha-card-body"> |
| 590 | <?php if ($configured) : ?> |
| 591 | <div class="superbaddons-captcha-card-connected-info"> |
| 592 | <div class="superbaddons-captcha-card-field"> |
| 593 | <label class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("Site Key", "superb-blocks"); ?></label> |
| 594 | <code class="superbaddons-input-api-key-masked"><?php echo esc_html($site_key); ?></code> |
| 595 | </div> |
| 596 | <div class="superbaddons-captcha-card-field"> |
| 597 | <label class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("Secret Key", "superb-blocks"); ?></label> |
| 598 | <code class="superbaddons-input-api-key-masked"><?php echo esc_html($masked_secret); ?></code> |
| 599 | </div> |
| 600 | <button type="button" class="superbaddons-element-button spbaddons-admin-btn-danger superbaddons-input-api-key-save-btn superbaddons-captcha-remove-btn" |
| 601 | data-provider="<?php echo esc_attr($provider); ?>" |
| 602 | data-usage-count="<?php echo intval($usage_count); ?>"> |
| 603 | <img class="superbaddons-element-button-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/trash-light.svg'); ?>" /><?php echo esc_html__("Remove Keys", "superb-blocks"); ?> |
| 604 | </button> |
| 605 | </div> |
| 606 | <?php else : ?> |
| 607 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-captcha-card-description"><?php echo esc_html($description); ?></p> |
| 608 | <div class="superbaddons-captcha-key-inputs"> |
| 609 | <div class="superbaddons-captcha-input-row"> |
| 610 | <input id="superbaddons-captcha-<?php echo esc_attr($provider); ?>-site-key" type="text" class="superbaddons-input-api-key-input superbaddons-captcha-site-key-input" placeholder="<?php echo esc_attr__("Enter site key", "superb-blocks"); ?>" autocomplete="off" /> |
| 611 | </div> |
| 612 | <div class="superbaddons-captcha-input-row"> |
| 613 | <input id="superbaddons-captcha-<?php echo esc_attr($provider); ?>-secret-key" type="text" class="superbaddons-input-api-key-input superbaddons-captcha-secret-key-input superbaddons-input-masked" placeholder="<?php echo esc_attr__("Enter secret key", "superb-blocks"); ?>" autocomplete="off" /> |
| 614 | </div> |
| 615 | <button type="button" class="superbaddons-element-button superbaddons-input-api-key-save-btn superbaddons-captcha-save-btn" data-provider="<?php echo esc_attr($provider); ?>" disabled> |
| 616 | <?php echo esc_html__("Save Keys", "superb-blocks"); ?> |
| 617 | </button> |
| 618 | </div> |
| 619 | <div class="superbaddons-spinner-wrapper superbaddons-captcha-spinner" style="display:none;"> |
| 620 | <img class="spbaddons-spinner" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/blocks-spinner.svg"); ?>" /> |
| 621 | </div> |
| 622 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><a href="<?php echo esc_url($dashboard_url); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html($dashboard_label); ?></a></p> |
| 623 | <?php endif; ?> |
| 624 | </div> |
| 625 | </div> |
| 626 | <?php |
| 627 | } |
| 628 | |
| 629 | private function RenderFormsTabContent() |
| 630 | { |
| 631 | $configurable_roles = FormPermissions::GetConfigurableRoles(); |
| 632 | $access_control_enabled = FormAccessControl::IsEnabled(); |
| 633 | |
| 634 | $cap_labels = array( |
| 635 | 'view' => __('View Forms & Submissions', 'superb-blocks'), |
| 636 | 'delete' => __('Delete Submissions', 'superb-blocks'), |
| 637 | 'export' => __('Export Submissions', 'superb-blocks'), |
| 638 | 'sensitive' => __('View Sensitive Fields', 'superb-blocks'), |
| 639 | 'notes' => __('Manage Notes', 'superb-blocks'), |
| 640 | 'spam' => __('Manage Spam', 'superb-blocks'), |
| 641 | 'create' => __('Create Forms', 'superb-blocks'), |
| 642 | 'edit' => __('Edit Forms', 'superb-blocks'), |
| 643 | 'configure' => __('Configure Forms', 'superb-blocks'), |
| 644 | ); |
| 645 | $cap_descriptions = array( |
| 646 | 'view' => __('Access the Forms admin page, view forms and their submissions lists, and read individual form entries.', 'superb-blocks'), |
| 647 | 'delete' => __('Permanently remove individual or multiple submissions.', 'superb-blocks'), |
| 648 | 'export' => __('Export & download submissions.', 'superb-blocks'), |
| 649 | 'sensitive' => __('View the full value of fields marked as sensitive. If disabled, see masked values.', 'superb-blocks'), |
| 650 | 'notes' => __('Add, view, and delete internal notes on submissions.', 'superb-blocks'), |
| 651 | 'spam' => __('View spam-filtered submissions and mark them as valid.', 'superb-blocks'), |
| 652 | 'create' => __('Insert new form blocks into posts and pages. If disabled, form blocks are hidden from the block inserter.', 'superb-blocks'), |
| 653 | 'edit' => __('Allow editing of form field structure, labels, display settings, colors, and validation rules on existing forms.', 'superb-blocks'), |
| 654 | 'configure' => __('Allow editing of sensitive form settings: email recipients, anti-spam, integrations, data storage, redirect URLs, and the sensitive field attribute.', 'superb-blocks'), |
| 655 | ); |
| 656 | |
| 657 | // Split capabilities into groups |
| 658 | $submission_caps = array('view', 'delete', 'export', 'sensitive', 'notes', 'spam'); |
| 659 | $editor_caps = array('create', 'edit', 'configure'); |
| 660 | ?> |
| 661 | <!-- Section A: Access Control --> |
| 662 | <div class="superbaddons-settings-section"> |
| 663 | <div class="superbaddons-section-header superbaddons-section-header--sticky"> |
| 664 | <h4 class="superbaddons-element-flex-center superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"> |
| 665 | <img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-shield-check.svg'); ?>" aria-hidden="true" /><?php echo esc_html__("Access Control", "superb-blocks"); ?> |
| 666 | </h4> |
| 667 | <div class="superbaddons-save-wrap" id="superbaddons-permissions-save-wrap"> |
| 668 | <span class="superbaddons-unsaved-label" style="display:none;"><?php echo esc_html__("You have unsaved changes", "superb-blocks"); ?></span> |
| 669 | <button type="button" class="superbaddons-element-button superbaddons-element-m0" id="superbaddons-save-permissions-btn"><?php echo esc_html__("Save Access Settings", "superb-blocks"); ?></button> |
| 670 | </div> |
| 671 | </div> |
| 672 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray"><?php echo esc_html__("Control which roles can access forms, form submissions, and related features. By default, all roles with editor access have full permissions.", "superb-blocks"); ?></p> |
| 673 | |
| 674 | <!-- Editor Restrictions Toggle --> |
| 675 | <div class="superb-addons-checkbox-input-wrapper" style="margin-bottom: 16px;"> |
| 676 | <label class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-inlineflex-center superbaddons-element-relative"> |
| 677 | <input type="checkbox" id="superbaddons-form-access-control-toggle" <?php echo $access_control_enabled ? 'checked' : ''; ?> /> |
| 678 | <span class="superb-addons-checkbox-checkmark"><img class="superbaddons-admindashboard-content-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" /></span> |
| 679 | <span><?php echo esc_html__("Restrict form access by role", "superb-blocks"); ?></span> |
| 680 | <button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button> |
| 681 | </label> |
| 682 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text superbaddons-help-text--expanded"> |
| 683 | <?php echo esc_html__("When disabled, all roles with editor access have full form and forms page permissions by default.", "superb-blocks"); ?> |
| 684 | <span style="display: block; margin-top: 4px;"><?php echo esc_html__("When enabled, each role must be granted permissions explicitly. Only administrators and roles with explicit permissions can access forms, create new form blocks, or modify settings on existing form blocks.", "superb-blocks"); ?></span> |
| 685 | </p> |
| 686 | </div> |
| 687 | |
| 688 | <div class="superbaddons-role-cards-actions"> |
| 689 | <button type="button" class="superbaddons-element-colorlink" id="superbaddons-roles-expand-all"><?php echo esc_html__("Expand All", "superb-blocks"); ?></button> |
| 690 | <span class="superbaddons-role-cards-actions-separator"></span> |
| 691 | <button type="button" class="superbaddons-element-colorlink" id="superbaddons-roles-collapse-all"><?php echo esc_html__("Collapse All", "superb-blocks"); ?></button> |
| 692 | </div> |
| 693 | |
| 694 | <div class="superbaddons-role-cards"> |
| 695 | <!-- Administrator card (locked) --> |
| 696 | <details class="superbaddons-role-card superbaddons-role-card--locked"> |
| 697 | <summary class="superbaddons-role-card-header"> |
| 698 | <span class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-text-800"><?php echo esc_html__("Administrator", "superb-blocks"); ?></span> |
| 699 | <div class="superbaddons-role-badges"> |
| 700 | <span class="superbaddons-role-badge superbaddons-role-badge--green"><?php echo esc_html__("Full Forms Page Access", "superb-blocks"); ?></span> |
| 701 | <span class="superbaddons-role-badge superbaddons-role-badge--green"><?php echo esc_html__("Full Block Access", "superb-blocks"); ?></span> |
| 702 | </div> |
| 703 | </summary> |
| 704 | <div class="superbaddons-role-card-caps"> |
| 705 | <p class="superbaddons-default-access-notice superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("Administrators always have full access to all form features.", "superb-blocks"); ?></p> |
| 706 | <span class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-text-700"><?php echo esc_html__("Forms Page Permissions", "superb-blocks"); ?></span> |
| 707 | <?php foreach ($submission_caps as $cap) : ?> |
| 708 | <div class="superb-addons-checkbox-input-wrapper"> |
| 709 | <label class="spbaddons-checkbox-wrap superbaddons-element-text-gray"> |
| 710 | <input type="checkbox" checked disabled /> |
| 711 | <span class="spbaddons-checkbox-mark"><img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" alt="" aria-hidden="true" /></span> |
| 712 | <?php echo esc_html(isset($cap_labels[$cap]) ? $cap_labels[$cap] : $cap); ?> |
| 713 | <button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button> |
| 714 | </label> |
| 715 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text"><?php echo esc_html(isset($cap_descriptions[$cap]) ? $cap_descriptions[$cap] : ''); ?></p> |
| 716 | </div> |
| 717 | <?php endforeach; ?> |
| 718 | <div class="superbaddons-editor-caps-group"> |
| 719 | <span class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-text-700"><?php echo esc_html__("Form Block Permissions", "superb-blocks"); ?></span> |
| 720 | <?php foreach ($editor_caps as $cap) : ?> |
| 721 | <div class="superb-addons-checkbox-input-wrapper"> |
| 722 | <label class="spbaddons-checkbox-wrap superbaddons-element-text-gray"> |
| 723 | <input type="checkbox" checked disabled /> |
| 724 | <span class="spbaddons-checkbox-mark"><img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" alt="" aria-hidden="true" /></span> |
| 725 | <?php echo esc_html(isset($cap_labels[$cap]) ? $cap_labels[$cap] : $cap); ?> |
| 726 | <button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button> |
| 727 | </label> |
| 728 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text"><?php echo esc_html(isset($cap_descriptions[$cap]) ? $cap_descriptions[$cap] : ''); ?></p> |
| 729 | </div> |
| 730 | <?php endforeach; ?> |
| 731 | </div> |
| 732 | </div> |
| 733 | </details> |
| 734 | <!-- Configurable role cards --> |
| 735 | <?php foreach ($configurable_roles as $role_slug => $role_name) : |
| 736 | $role_obj = get_role($role_slug); |
| 737 | $has_edit_posts = $role_obj && $role_obj->has_cap('edit_posts'); |
| 738 | $has_default_access = !$access_control_enabled && $has_edit_posts; |
| 739 | ?> |
| 740 | <details class="superbaddons-role-card" data-role="<?php echo esc_attr($role_slug); ?>" data-has-editor="<?php echo $has_edit_posts ? '1' : '0'; ?>"> |
| 741 | <summary class="superbaddons-role-card-header"> |
| 742 | <span class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-element-text-800"><?php echo esc_html($role_name); ?></span> |
| 743 | <div class="superbaddons-role-badges"></div> |
| 744 | </summary> |
| 745 | <div class="superbaddons-role-card-caps"> |
| 746 | <?php if (!$has_edit_posts) : ?> |
| 747 | <p class="superbaddons-default-access-notice superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("This role does not have editor access. Form block permissions are not available.", "superb-blocks"); ?></p> |
| 748 | <?php elseif ($has_default_access) : ?> |
| 749 | <p class="superbaddons-default-access-notice superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("This role has full access by default. Enable access control above to customize permissions.", "superb-blocks"); ?></p> |
| 750 | <?php else : ?> |
| 751 | <p class="superbaddons-default-access-notice superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("Configure which form features this role can access.", "superb-blocks"); ?></p> |
| 752 | <?php endif; ?> |
| 753 | <span class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-text-700"><?php echo esc_html__("Forms Page Permissions", "superb-blocks"); ?></span> |
| 754 | <?php foreach ($submission_caps as $cap) : |
| 755 | $checked = isset($this->FormPermissions[$role_slug][$cap]) && $this->FormPermissions[$role_slug][$cap]; |
| 756 | ?> |
| 757 | <div class="superb-addons-checkbox-input-wrapper"> |
| 758 | <label class="spbaddons-checkbox-wrap superbaddons-element-text-gray"> |
| 759 | <input type="checkbox" class="superbaddons-permission-checkbox" |
| 760 | data-role="<?php echo esc_attr($role_slug); ?>" |
| 761 | data-cap="<?php echo esc_attr($cap); ?>" |
| 762 | data-saved="<?php echo $checked ? '1' : '0'; ?>" |
| 763 | <?php echo ($has_default_access || $checked) ? 'checked' : ''; ?> |
| 764 | <?php echo $has_default_access ? 'disabled' : ''; ?> /> |
| 765 | <span class="spbaddons-checkbox-mark"><img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" alt="" aria-hidden="true" /></span> |
| 766 | <?php echo esc_html(isset($cap_labels[$cap]) ? $cap_labels[$cap] : $cap); ?> |
| 767 | <button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button> |
| 768 | </label> |
| 769 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text"><?php echo esc_html(isset($cap_descriptions[$cap]) ? $cap_descriptions[$cap] : ''); ?></p> |
| 770 | </div> |
| 771 | <?php endforeach; ?> |
| 772 | <div class="superbaddons-editor-caps-group" style="<?php echo ($access_control_enabled || $has_default_access || !$has_edit_posts) ? '' : 'display:none;'; ?>"> |
| 773 | <span class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-text-700"><?php echo esc_html__("Form Block Permissions", "superb-blocks"); ?></span> |
| 774 | <?php foreach ($editor_caps as $cap) : |
| 775 | $checked = isset($this->FormPermissions[$role_slug][$cap]) && $this->FormPermissions[$role_slug][$cap]; |
| 776 | $force_disabled = $has_default_access || !$has_edit_posts; |
| 777 | ?> |
| 778 | <div class="superb-addons-checkbox-input-wrapper<?php echo !$has_edit_posts ? ' superbaddons-cap-disabled' : ''; ?>"> |
| 779 | <label class="spbaddons-checkbox-wrap superbaddons-element-text-gray"> |
| 780 | <input type="checkbox" class="superbaddons-permission-checkbox" |
| 781 | data-role="<?php echo esc_attr($role_slug); ?>" |
| 782 | data-cap="<?php echo esc_attr($cap); ?>" |
| 783 | data-saved="<?php echo $checked ? '1' : '0'; ?>" |
| 784 | <?php echo ($has_default_access || $checked) && $has_edit_posts ? 'checked' : ''; ?> |
| 785 | <?php echo $force_disabled ? 'disabled' : ''; ?> /> |
| 786 | <span class="spbaddons-checkbox-mark"><img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/checkmark.svg'); ?>" alt="" aria-hidden="true" /></span> |
| 787 | <?php echo esc_html(isset($cap_labels[$cap]) ? $cap_labels[$cap] : $cap); ?> |
| 788 | <button type="button" class="superbaddons-help-toggle" aria-label="<?php echo esc_attr__('Toggle help text', 'superb-blocks'); ?>">i</button> |
| 789 | </label> |
| 790 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-help-text"><?php echo esc_html(isset($cap_descriptions[$cap]) ? $cap_descriptions[$cap] : ''); ?></p> |
| 791 | </div> |
| 792 | <?php endforeach; ?> |
| 793 | </div> |
| 794 | </div> |
| 795 | </details> |
| 796 | <?php endforeach; ?> |
| 797 | </div> |
| 798 | </div> |
| 799 | |
| 800 | <!-- Section B: Outgoing Email --> |
| 801 | <div class="superbaddons-settings-section"> |
| 802 | <div class="superbaddons-section-header"> |
| 803 | <h4 class="superbaddons-element-flex-center superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"> |
| 804 | <img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-envelope-simple.svg'); ?>" aria-hidden="true" /><?php echo esc_html__("Outgoing Email", "superb-blocks"); ?> |
| 805 | </h4> |
| 806 | <div class="superbaddons-save-wrap" id="superbaddons-email-save-wrap"> |
| 807 | <span class="superbaddons-unsaved-label" style="display:none;"><?php echo esc_html__("You have unsaved changes", "superb-blocks"); ?></span> |
| 808 | <button type="button" class="superbaddons-element-button superbaddons-element-m0" id="superbaddons-save-default-email-btn"><?php echo esc_html__("Save Email Settings", "superb-blocks"); ?></button> |
| 809 | </div> |
| 810 | </div> |
| 811 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Configure sender details for all form notification emails.", "superb-blocks"); ?></p> |
| 812 | |
| 813 | <div class="superbaddons-general-settings"> |
| 814 | <div class="superbaddons-setting-row"> |
| 815 | <div class="superbaddons-setting-row-label"> |
| 816 | <label class="superbaddons-element-text-xs superbaddons-element-text-gray" for="superbaddons-default-from-name"><?php echo esc_html__('"From" Name', "superb-blocks"); ?></label> |
| 817 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("The sender name used in form notification emails.", "superb-blocks"); ?></p> |
| 818 | </div> |
| 819 | <div class="superbaddons-setting-row-control"> |
| 820 | <input id="superbaddons-default-from-name" type="text" class="superbaddons-input-api-key-input" |
| 821 | value="<?php echo esc_attr(isset($this->DefaultEmail['from_name']) ? $this->DefaultEmail['from_name'] : ''); ?>" |
| 822 | placeholder="<?php echo esc_attr(get_bloginfo('name')); ?>" |
| 823 | maxlength="100" /> |
| 824 | <p class="superbaddons-field-error" id="superbaddons-from-name-error"></p> |
| 825 | </div> |
| 826 | </div> |
| 827 | |
| 828 | <div class="superbaddons-setting-row"> |
| 829 | <div class="superbaddons-setting-row-label"> |
| 830 | <label class="superbaddons-element-text-xs superbaddons-element-text-gray" for="superbaddons-default-from-email"><?php echo esc_html__('"From" Email', "superb-blocks"); ?></label> |
| 831 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("The sender address used in form notification emails.", "superb-blocks"); ?></p> |
| 832 | </div> |
| 833 | <div class="superbaddons-setting-row-control"> |
| 834 | <input id="superbaddons-default-from-email" type="email" class="superbaddons-input-api-key-input" |
| 835 | value="<?php echo esc_attr(isset($this->DefaultEmail['from_email']) ? $this->DefaultEmail['from_email'] : ''); ?>" |
| 836 | placeholder="<?php echo esc_attr(get_option('admin_email')); ?>" /> |
| 837 | <p class="superbaddons-field-error" id="superbaddons-from-email-error"></p> |
| 838 | </div> |
| 839 | </div> |
| 840 | |
| 841 | </div> |
| 842 | </div> |
| 843 | |
| 844 | <!-- Section C: Data Retention --> |
| 845 | <div class="superbaddons-settings-section"> |
| 846 | <h4 class="superbaddons-element-flex-center superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"> |
| 847 | <img class="superbaddons-admindashboard-content-icon superbaddons-element-mr1" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-clock-countdown.svg'); ?>" aria-hidden="true" /><?php echo esc_html__("Data Retention", "superb-blocks"); ?> |
| 848 | </h4> |
| 849 | <p class="superbaddons-element-text-xs superbaddons-element-text-gray superbaddons-help-text-inline"><?php echo esc_html__("Automatically delete old submissions for GDPR compliance. Spam entries have their own 30-day purge cycle.", "superb-blocks"); ?></p> |
| 850 | |
| 851 | <div class="superbaddons-general-settings"> |
| 852 | <div class="superbaddons-setting-row"> |
| 853 | <div class="superbaddons-setting-row-label"> |
| 854 | <label class="superbaddons-element-text-xs superbaddons-element-text-gray" for="superbaddons-data-retention-select"><?php echo esc_html__("Delete submissions", "superb-blocks"); ?></label> |
| 855 | </div> |
| 856 | <div class="superbaddons-setting-row-control"> |
| 857 | <div class="superbaddons-data-retention-wrapper"> |
| 858 | <select id="superbaddons-data-retention-select" class="superbaddons-data-retention-select"> |
| 859 | <option value="0" <?php selected($this->DataRetentionDays, 0); ?>><?php echo esc_html__("Never", "superb-blocks"); ?></option> |
| 860 | <option value="30" <?php selected($this->DataRetentionDays, 30); ?>><?php echo esc_html__("After 30 days", "superb-blocks"); ?></option> |
| 861 | <option value="60" <?php selected($this->DataRetentionDays, 60); ?>><?php echo esc_html__("After 60 days", "superb-blocks"); ?></option> |
| 862 | <option value="90" <?php selected($this->DataRetentionDays, 90); ?>><?php echo esc_html__("After 90 days", "superb-blocks"); ?></option> |
| 863 | <option value="180" <?php selected($this->DataRetentionDays, 180); ?>><?php echo esc_html__("After 180 days", "superb-blocks"); ?></option> |
| 864 | <option value="365" <?php selected($this->DataRetentionDays, 365); ?>><?php echo esc_html__("After 365 days", "superb-blocks"); ?></option> |
| 865 | </select> |
| 866 | <?php if ($this->DataRetentionDays > 0) : ?> |
| 867 | <div class="superbaddons-data-retention-warning" id="superbaddons-data-retention-warning"> |
| 868 | <img class="superbaddons-admindashboard-content-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'); ?>" /> |
| 869 | <span class="superbaddons-element-text-xxs"><?php echo esc_html(sprintf( |
| 870 | /* translators: %d: number of days */ |
| 871 | __('Submissions older than %d days are automatically deleted.', 'superb-blocks'), |
| 872 | $this->DataRetentionDays |
| 873 | )); ?></span> |
| 874 | </div> |
| 875 | <?php endif; ?> |
| 876 | </div> |
| 877 | </div> |
| 878 | </div> |
| 879 | </div> |
| 880 | </div> |
| 881 | <?php |
| 882 | } |
| 883 | |
| 884 | private function MaybeDisplayKeyIssue() |
| 885 | { |
| 886 | if (!$this->KeyHasIssue) { |
| 887 | return; |
| 888 | } |
| 889 | ?> |
| 890 | <div class="spbaddons-license-issue-wrapper"> |
| 891 | <?php printf('<img src="%s" alt="%s"/>', esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'), esc_attr__("Issue Detected", "superb-blocks")); ?> |
| 892 | <p> |
| 893 | <?php |
| 894 | if ( |
| 895 | $this->KeyStatus['expired'] |
| 896 | ) { |
| 897 | esc_html_e('It looks like your subscription has expired. Please renew your subscription or contact support for assistance.', "superb-blocks"); |
| 898 | } elseif ( |
| 899 | !$this->KeyStatus['active'] |
| 900 | ) { |
| 901 | esc_html_e('It looks like your license key has been disabled. Please contact support for assistance.', "superb-blocks"); |
| 902 | } elseif ( |
| 903 | !$this->KeyStatus['verified'] |
| 904 | ) { |
| 905 | esc_html_e('It seems that your license key verification for this website is no longer valid. Run the automatic scan on the Get Help page to resolve this automatically.', "superb-blocks"); |
| 906 | } elseif ( |
| 907 | $this->KeyStatus['exceeded'] |
| 908 | ) { |
| 909 | 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"); |
| 910 | } |
| 911 | ?> |
| 912 | <?php if ($this->KeyStatus['expired'] || $this->KeyStatus['exceeded']): ?> |
| 913 | <br /> |
| 914 | <a href="<?php echo esc_url(AdminLinkUtil::GetLink(AdminLinkSource::DEFAULT, array("url" => "https://superbthemes.com/renew-subscription/"))); ?>" target="_blank" class="superbaddons-element-colorlink"> |
| 915 | <?php echo esc_html__("Renew License", "superb-blocks"); ?> |
| 916 | </a> |
| 917 | <br /> |
| 918 | <small> |
| 919 | <?php echo esc_html__("If you have already renewed your subscription, run the automatic scan to re-verify your license.", "superb-blocks"); ?> |
| 920 | <a href="<?php echo esc_url(admin_url('admin.php?page=' . DashboardController::SUPPORT)); ?>" class="superbaddons-element-colorlink"> |
| 921 | <?php echo esc_html__("Run Automatic Scan", "superb-blocks"); ?> |
| 922 | </a> |
| 923 | </small> |
| 924 | <?php endif; ?> |
| 925 | </p> |
| 926 | <?php |
| 927 | if (!$this->KeyStatus['verified']) : ?> |
| 928 | <a href="<?php echo esc_url(admin_url('admin.php?page=' . DashboardController::SUPPORT)); ?>" class="superbaddons-element-button"> |
| 929 | <?php echo esc_html__("Run Automatic Scan", "superb-blocks"); ?> |
| 930 | </a> |
| 931 | <?php endif; ?> |
| 932 | </div> |
| 933 | <?php |
| 934 | } |
| 935 | |
| 936 | private function MaybeDisplayPremiumPluginMissingNotice() |
| 937 | { |
| 938 | if (!KeyController::HasValidKey()) { |
| 939 | return; |
| 940 | } |
| 941 | ?> |
| 942 | <div id="spbaddons-premium-plugin-missing-notice" class="spbaddons-license-issue-wrapper" style="display:none;"> |
| 943 | <?php printf('<img src="%s" alt="%s"/>', esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'), esc_attr__("Premium Plugin Required", "superb-blocks")); ?> |
| 944 | <p> |
| 945 | <?php esc_html_e('Your license key is active, but the required premium plugin is not installed on this site. Some premium features will not be available until it is installed and activated.', "superb-blocks"); ?> |
| 946 | </p> |
| 947 | <a href="<?php echo esc_url(AdminLinkUtil::GetLink(AdminLinkSource::DEFAULT, array("url" => "https://superbthemes.com/license-key/"))); ?>" target="_blank" rel="noopener" class="superbaddons-element-button"> |
| 948 | <?php echo esc_html__("View Installation Guide", "superb-blocks"); ?> |
| 949 | </a> |
| 950 | </div> |
| 951 | <?php |
| 952 | } |
| 953 | |
| 954 | private function MaybeDisplayRewriteIssue() |
| 955 | { |
| 956 | if (!RewriteCheckController::HasDetectedIssue()) { |
| 957 | return; |
| 958 | } |
| 959 | ?> |
| 960 | <div class="spbaddons-license-issue-wrapper"> |
| 961 | <?php printf('<img src="%s" alt="%s"/>', esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'), esc_attr__("Issue Detected", "superb-blocks")); ?> |
| 962 | <p> |
| 963 | <?php esc_html_e('A permalink configuration issue has been detected that may prevent license key activation and other features from working correctly. This can be resolved automatically on the Get Help page.', "superb-blocks"); ?> |
| 964 | </p> |
| 965 | <a href="<?php echo esc_url(admin_url('admin.php?page=' . DashboardController::SUPPORT)); ?>" class="superbaddons-element-button"> |
| 966 | <?php echo esc_html__("Go to Get Help", "superb-blocks"); ?> |
| 967 | </a> |
| 968 | </div> |
| 969 | <?php |
| 970 | } |
| 971 | } |
| 972 |