wizard
2 months ago
class-page-additional-css.php
2 months ago
class-page-dashboard.php
2 months ago
class-page-form.php
2 months ago
class-page-settings.php
2 months ago
class-page-support.php
2 months ago
class-page-dashboard.php
397 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\Wizard\WizardController; |
| 9 | use SuperbAddons\Admin\Utils\AdminLinkSource; |
| 10 | use SuperbAddons\Admin\Utils\AdminLinkUtil; |
| 11 | use SuperbAddons\Components\Admin\NewsletterForm; |
| 12 | use SuperbAddons\Components\Admin\PremiumBox; |
| 13 | use SuperbAddons\Components\Admin\ReviewBox; |
| 14 | use SuperbAddons\Components\Admin\SupportBox; |
| 15 | use SuperbAddons\Data\Controllers\KeyController; |
| 16 | use SuperbAddons\Data\Controllers\OptionController; |
| 17 | use SuperbAddons\Data\Utils\Wizard\WizardActionParameter; |
| 18 | use SuperbAddons\Gutenberg\Controllers\GutenbergController; |
| 19 | use SuperbAddons\Gutenberg\Controllers\GutenbergEnhancementsController; |
| 20 | use SuperbAddons\Components\Admin\Modal; |
| 21 | use SuperbAddons\Gutenberg\Form\FormSettings; |
| 22 | |
| 23 | class DashboardPage |
| 24 | { |
| 25 | private $theme_designer_url; |
| 26 | private $add_new_pages_url; |
| 27 | private $custom_css_url; |
| 28 | private $woocommerce_header_url; |
| 29 | private $header_footer_url; |
| 30 | private $forms_url; |
| 31 | private $settings_modules_url; |
| 32 | private $EditorOptions; |
| 33 | private $EditorTotalCount = 0; |
| 34 | private $EditorEnabledCount = 0; |
| 35 | private $IntegrationCount = 0; |
| 36 | private $IntegrationTotalCount = 0; |
| 37 | private $DisabledBlocks = array(); |
| 38 | private $ActiveBlockCount = 0; |
| 39 | private $TotalBlockCount = 0; |
| 40 | private $WizardCompleted = false; |
| 41 | |
| 42 | public function __construct() |
| 43 | { |
| 44 | $this->theme_designer_url = WizardController::GetWizardURL(WizardActionParameter::INTRO); |
| 45 | $this->add_new_pages_url = WizardController::GetWizardURL(WizardActionParameter::ADD_NEW_PAGES); |
| 46 | $this->woocommerce_header_url = WizardController::GetWizardURL(WizardActionParameter::WOOCOMMERCE_HEADER); |
| 47 | $this->header_footer_url = WizardController::GetWizardURL(WizardActionParameter::HEADER_FOOTER); |
| 48 | $this->custom_css_url = add_query_arg(array('page' => DashboardController::ADDITIONAL_CSS), admin_url("admin.php")); |
| 49 | $this->forms_url = add_query_arg(array('page' => DashboardController::FORMS), admin_url("admin.php")); |
| 50 | $this->settings_modules_url = add_query_arg(array('page' => DashboardController::SETTINGS), admin_url("admin.php")) . '#modules'; |
| 51 | |
| 52 | // Editor enhancement status: merged view for card display and counts |
| 53 | // Dashboard shows all enhancements (including per-user ones like outlines) |
| 54 | $this->EditorOptions = GutenbergEnhancementsController::GetEnhancementsOptions(get_current_user_id()); |
| 55 | $enhancement_keys = array( |
| 56 | GutenbergEnhancementsController::HIGHLIGHTS_KEY, |
| 57 | GutenbergEnhancementsController::RESPONSIVE_KEY, |
| 58 | GutenbergEnhancementsController::ANIMATIONS_KEY, |
| 59 | GutenbergEnhancementsController::CONDITIONS_KEY, |
| 60 | GutenbergEnhancementsController::DYNAMIC_CONTENT_KEY, |
| 61 | GutenbergEnhancementsController::NAVIGATION_KEY, |
| 62 | GutenbergEnhancementsController::RICHTEXT_KEY, |
| 63 | GutenbergEnhancementsController::SOCIAL_ICONS_KEY, |
| 64 | GutenbergEnhancementsController::DASHBOARD_SHORTCUTS_KEY, |
| 65 | GutenbergEnhancementsController::STICKY_KEY, |
| 66 | GutenbergEnhancementsController::Z_INDEX_KEY, |
| 67 | ); |
| 68 | $this->EditorTotalCount = count($enhancement_keys); |
| 69 | foreach ($enhancement_keys as $key) { |
| 70 | if (isset($this->EditorOptions[$key]) && $this->EditorOptions[$key]) { |
| 71 | $this->EditorEnabledCount++; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // Integration count |
| 76 | $this->IntegrationTotalCount++; |
| 77 | if (FormSettings::HasValue(FormSettings::OPTION_MAILCHIMP_API_KEY)) { |
| 78 | $this->IntegrationCount++; |
| 79 | } |
| 80 | $this->IntegrationTotalCount++; |
| 81 | if (FormSettings::HasValue(FormSettings::OPTION_BREVO_API_KEY)) { |
| 82 | $this->IntegrationCount++; |
| 83 | } |
| 84 | $this->IntegrationTotalCount++; |
| 85 | if (FormSettings::HasValue(FormSettings::OPTION_GOOGLE_SHEETS_CLIENT_EMAIL) && FormSettings::HasValue(FormSettings::OPTION_GOOGLE_SHEETS_PRIVATE_KEY)) { |
| 86 | $this->IntegrationCount++; |
| 87 | } |
| 88 | // CAPTCHA settings |
| 89 | $this->IntegrationTotalCount++; |
| 90 | if (FormSettings::HasValue(FormSettings::OPTION_HCAPTCHA_SITE_KEY) && FormSettings::HasValue(FormSettings::OPTION_HCAPTCHA_SECRET_KEY)) { |
| 91 | $this->IntegrationCount++; |
| 92 | } |
| 93 | $this->IntegrationTotalCount++; |
| 94 | if (FormSettings::HasValue(FormSettings::OPTION_RECAPTCHA_SITE_KEY) && FormSettings::HasValue(FormSettings::OPTION_RECAPTCHA_SECRET_KEY)) { |
| 95 | $this->IntegrationCount++; |
| 96 | } |
| 97 | $this->IntegrationTotalCount++; |
| 98 | if (FormSettings::HasValue(FormSettings::OPTION_TURNSTILE_SITE_KEY) && FormSettings::HasValue(FormSettings::OPTION_TURNSTILE_SECRET_KEY)) { |
| 99 | $this->IntegrationCount++; |
| 100 | } |
| 101 | |
| 102 | // Block status |
| 103 | $this->DisabledBlocks = OptionController::GetDisabledBlocks(); |
| 104 | $this->TotalBlockCount = GutenbergController::GetDiscoverableBlockTotal(); |
| 105 | $this->ActiveBlockCount = GutenbergController::GetDiscoverableBlockActiveCount($this->DisabledBlocks); |
| 106 | |
| 107 | // Wizard completion status |
| 108 | $this->WizardCompleted = WizardController::ThemeHasCompletedWizard(); |
| 109 | |
| 110 | $this->Render(); |
| 111 | } |
| 112 | |
| 113 | private function Render() |
| 114 | { |
| 115 | $enhancement_dot = 'superbaddons-status-dot--gray'; |
| 116 | if ($this->EditorEnabledCount >= 4) { |
| 117 | $enhancement_dot = 'superbaddons-status-dot--green'; |
| 118 | } elseif ($this->EditorEnabledCount > 0) { |
| 119 | $enhancement_dot = 'superbaddons-status-dot--yellow'; |
| 120 | } |
| 121 | $integration_dot = 'superbaddons-status-dot--gray'; |
| 122 | if ($this->IntegrationCount >= 1) { |
| 123 | $integration_dot = 'superbaddons-status-dot--green'; |
| 124 | } |
| 125 | ?> |
| 126 | <!-- Welcome + Stats Strip --> |
| 127 | <div class="superbaddons-dashboard-welcome-strip"> |
| 128 | <span class="superbaddons-dashboard-welcome-title"><?php echo esc_html__("Welcome to Superb Addons", "superb-blocks"); ?></span> |
| 129 | <div class="superbaddons-dashboard-stat-items"> |
| 130 | <span class="superbaddons-dashboard-stat-item"> |
| 131 | <span class="superbaddons-status-dot <?php echo $this->ActiveBlockCount >= $this->TotalBlockCount ? 'superbaddons-status-dot--green' : ($this->ActiveBlockCount > 0 ? 'superbaddons-status-dot--yellow' : 'superbaddons-status-dot--gray'); ?>"></span> |
| 132 | <?php |
| 133 | /* translators: 1: number of active blocks, 2: total number of blocks */ |
| 134 | echo esc_html(sprintf(__('%1$d/%2$d Blocks', 'superb-blocks'), $this->ActiveBlockCount, $this->TotalBlockCount)); |
| 135 | ?> |
| 136 | </span> |
| 137 | <span class="superbaddons-dashboard-stat-item"> |
| 138 | <span class="superbaddons-status-dot <?php echo esc_attr($enhancement_dot); ?>"></span> |
| 139 | <?php |
| 140 | /* translators: 1: number of enabled editor enhancements, 2: total number of editor enhancements */ |
| 141 | echo esc_html(sprintf(__('%1$d/%2$d Enhancements', 'superb-blocks'), $this->EditorEnabledCount, $this->EditorTotalCount)); |
| 142 | ?> |
| 143 | </span> |
| 144 | <span class="superbaddons-dashboard-stat-item"> |
| 145 | <span class="superbaddons-status-dot superbaddons-status-dot--purple"></span> |
| 146 | <?php echo esc_html__("200+ Patterns", "superb-blocks"); ?> |
| 147 | </span> |
| 148 | <span class="superbaddons-dashboard-stat-item"> |
| 149 | <span class="superbaddons-status-dot <?php echo esc_attr($integration_dot); ?>"></span> |
| 150 | <?php |
| 151 | /* translators: 1: number of connected integrations, 2: total number of integrations */ |
| 152 | echo esc_html(sprintf(__('%1$d/%2$d Integrations', 'superb-blocks'), $this->IntegrationCount, $this->IntegrationTotalCount)); |
| 153 | ?> |
| 154 | </span> |
| 155 | </div> |
| 156 | </div> |
| 157 | |
| 158 | <div class="superbaddons-admindashboard-sidebarlayout"> |
| 159 | <div class="superbaddons-admindashboard-sidebarlayout-left"> |
| 160 | |
| 161 | <!-- Quick Actions --> |
| 162 | <div class="superbaddons-dashboard-quick-actions"> |
| 163 | <div class="superbaddons-dashboard-quick-action-card<?php echo !$this->WizardCompleted ? ' superbaddons-dashboard-quick-action-card--recommended' : ''; ?>" id="superbaddons-dashboard-theme-designer-card"> |
| 164 | <?php if (!$this->WizardCompleted) : ?> |
| 165 | <span class="superbaddons-dashboard-recommended-badge"><?php echo esc_html__("Recommended", "superb-blocks"); ?></span> |
| 166 | <?php endif; ?> |
| 167 | <img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/theme-designer-icon.svg'); ?>" aria-hidden="true" width="48" height="48" /> |
| 168 | <h5 class="superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800"><?php echo esc_html__("Theme Designer", "superb-blocks"); ?></h5> |
| 169 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("Design your entire site in minutes. Pick styles for header, footer, and pages, and the wizard builds it all.", "superb-blocks"); ?></p> |
| 170 | <a class="superbaddons-element-button" href="<?php echo esc_url($this->theme_designer_url); ?>"><?php echo esc_html__("Launch Theme Designer", "superb-blocks"); ?></a> |
| 171 | </div> |
| 172 | <div class="superbaddons-dashboard-quick-action-card"> |
| 173 | <img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/template-page-icon.svg'); ?>" aria-hidden="true" width="48" height="48" /> |
| 174 | <h5 class="superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800"><?php echo esc_html__("Page Templates", "superb-blocks"); ?></h5> |
| 175 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("Launch a new page in seconds from a library of professional designs.", "superb-blocks"); ?></p> |
| 176 | <a class="superbaddons-element-button" href="<?php echo esc_url($this->add_new_pages_url); ?>"><?php echo esc_html__("Add New Template Page", "superb-blocks"); ?></a> |
| 177 | </div> |
| 178 | <div class="superbaddons-dashboard-quick-action-card" id="superbaddons-dashboard-forms-card"> |
| 179 | <img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/gutenberg-patterns-icon.svg'); ?>" aria-hidden="true" width="48" height="48" /> |
| 180 | <h5 class="superbaddons-element-text-xs superbaddons-element-text-dark superbaddons-element-text-800"><?php echo esc_html__("Forms", "superb-blocks"); ?></h5> |
| 181 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray"><?php echo esc_html__("A full form builder with file uploads, conditional logic, spam protection, and more. All free.", "superb-blocks"); ?></p> |
| 182 | <a class="superbaddons-element-button" href="<?php echo esc_url($this->forms_url); ?>"><?php echo esc_html__("Manage Forms", "superb-blocks"); ?></a> |
| 183 | </div> |
| 184 | </div> |
| 185 | |
| 186 | <!-- Gutenberg Blocks --> |
| 187 | <div class="superbaddons-settings-section"> |
| 188 | <div class="superbaddons-dashboard-section-header"> |
| 189 | <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> |
| 190 | <span class="superbaddons-dashboard-count-badge"><?php |
| 191 | /* translators: 1: number of active blocks, 2: total number of blocks */ |
| 192 | echo esc_html(sprintf(__('%1$d/%2$d Active', 'superb-blocks'), $this->ActiveBlockCount, $this->TotalBlockCount)); |
| 193 | ?></span> |
| 194 | </div> |
| 195 | <div class="superbaddons-dashboard-block-grid"> |
| 196 | <?php |
| 197 | $blocks = array( |
| 198 | array('slug' => 'ratings', 'icon' => 'purple-star.svg', 'name' => __('Rating Block', 'superb-blocks'), 'desc' => __('Add star ratings with partial fills to posts and pages.', 'superb-blocks')), |
| 199 | array('slug' => 'author-box', 'icon' => 'purple-identification-badge.svg', 'name' => __('About the Author', 'superb-blocks'), 'desc' => __('Showcase post authors with avatar, bio, and social links.', 'superb-blocks')), |
| 200 | array('slug' => 'table-of-contents', 'icon' => 'purple-list-bullets.svg', 'name' => __('Table of Contents', 'superb-blocks'), 'desc' => __('Auto-generated navigation from your headings.', 'superb-blocks')), |
| 201 | array('slug' => 'recent-posts', 'icon' => 'purple-note.svg', 'name' => __('Recent Posts', 'superb-blocks'), 'desc' => __('Display your latest posts with thumbnails and excerpts.', 'superb-blocks')), |
| 202 | array('slug' => 'google-maps', 'icon' => 'purple-pin.svg', 'name' => __('Google Maps', 'superb-blocks'), 'desc' => __('Embed interactive maps with no API key required.', 'superb-blocks')), |
| 203 | array('slug' => 'cover-image', 'icon' => 'purple-image.svg', 'name' => __('Cover Image', 'superb-blocks'), 'desc' => __('Hero sections with focal point control and responsive height.', 'superb-blocks')), |
| 204 | array('slug' => 'reveal-buttons', 'icon' => 'purple-pointing.svg', 'name' => __('Reveal Buttons', 'superb-blocks'), 'desc' => __('Click-to-reveal buttons for coupons and hidden content.', 'superb-blocks')), |
| 205 | array('slug' => 'accordion', 'icon' => 'accordion-icon-purple.svg', 'name' => __('Toggle', 'superb-blocks'), 'desc' => __('Collapsible toggle section for FAQs and hiding content.', 'superb-blocks')), |
| 206 | array('slug' => 'carousel', 'icon' => 'icon-carousel.svg', 'name' => __('Carousel Slider', 'superb-blocks'), 'desc' => __('Content carousel with arrow and dot navigation.', 'superb-blocks')), |
| 207 | array('slug' => 'countdown', 'icon' => 'icon-countdown.svg', 'name' => __('Countdown', 'superb-blocks'), 'desc' => __('Countdown timer with 6 visual styles.', 'superb-blocks')), |
| 208 | array('slug' => 'progress-bar', 'icon' => 'icon-progressbar.svg', 'name' => __('Progress Bar', 'superb-blocks'), 'desc' => __('Progress indicators with bars, circles, and milestones.', 'superb-blocks')), |
| 209 | array('slug' => 'popup', 'icon' => 'icon-popup.svg', 'name' => __('Popup', 'superb-blocks'), 'desc' => __('Create popups with any content and smart trigger options.', 'superb-blocks')), |
| 210 | array('slug' => 'form', 'icon' => 'icon-form.svg', 'name' => __('Form', 'superb-blocks'), 'desc' => __('Form builder with validation, file uploads, and integrations.', 'superb-blocks')), |
| 211 | array('slug' => 'multistep-form', 'toggle_slug' => 'form', 'icon' => 'icon-multistepform.svg', 'name' => __('Multi-Step Form', 'superb-blocks'), 'desc' => __('Split forms into steps with progress tracking.', 'superb-blocks'), 'premium' => true), |
| 212 | array('slug' => 'add-to-cart', 'icon' => 'purple-shopping-cart.svg', 'name' => __('Add to Cart', 'superb-blocks'), 'desc' => __('AJAX button that adds WooCommerce products to the cart with optional popup trigger.', 'superb-blocks'), 'requires' => 'woocommerce'), |
| 213 | array('slug' => 'buy-now', 'toggle_slug' => 'add-to-cart', 'icon' => 'purple-shopping-cart-simple.svg', 'name' => __('Buy Now', 'superb-blocks'), 'desc' => __('Direct-checkout button that skips the cart and takes customers straight to checkout.', 'superb-blocks'), 'premium' => true, 'requires' => 'woocommerce'), |
| 214 | ); |
| 215 | foreach ($blocks as $block) : |
| 216 | $toggle_slug = isset($block['toggle_slug']) ? $block['toggle_slug'] : $block['slug']; |
| 217 | $is_disabled = in_array($toggle_slug, $this->DisabledBlocks, true); |
| 218 | ?> |
| 219 | <div class="superbaddons-dashboard-block-card <?php echo $is_disabled ? 'superbaddons-dashboard-block-card--disabled' : ''; ?>"> |
| 220 | <?php if (!empty($block['premium']) || $is_disabled || !empty($block['requires'])) : ?> |
| 221 | <div class="superbaddons-dashboard-card-badges"> |
| 222 | <?php if (!empty($block['premium'])) : ?> |
| 223 | <span class="superbaddons-dashboard-premium-badge"><img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-crown.svg'); ?>" aria-hidden="true" /><?php echo esc_html__("Premium", "superb-blocks"); ?></span> |
| 224 | <?php elseif ($is_disabled) : ?> |
| 225 | <span class="superbaddons-dashboard-disabled-badge"><?php echo esc_html__("Disabled", "superb-blocks"); ?></span> |
| 226 | <?php endif; ?> |
| 227 | <?php if (!empty($block['requires'])) $this->RenderIntegrationBadge($block['requires']); ?> |
| 228 | </div> |
| 229 | <?php endif; ?> |
| 230 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/' . $block['icon']); ?>" aria-hidden="true" /> |
| 231 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html($block['name']); ?></strong> |
| 232 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html($block['desc']); ?></p> |
| 233 | </div> |
| 234 | <?php endforeach; ?> |
| 235 | <?php $this->RenderSuggestCard( |
| 236 | __('Have a block idea?', 'superb-blocks'), |
| 237 | __('We\'re always looking for new block ideas. Let us know what you\'d like to see.', 'superb-blocks') |
| 238 | ); ?> |
| 239 | </div> |
| 240 | <a href="<?php echo esc_url($this->settings_modules_url); ?>" class="superbaddons-element-colorlink superbaddons-dashboard-configure-link"><?php echo esc_html__("Configure in Settings", "superb-blocks"); ?> →</a> |
| 241 | </div> |
| 242 | |
| 243 | <!-- Editor Enhancements --> |
| 244 | <div class="superbaddons-settings-section"> |
| 245 | <div class="superbaddons-dashboard-section-header"> |
| 246 | <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> |
| 247 | <span class="superbaddons-dashboard-count-badge"><?php |
| 248 | /* translators: 1: number of enabled editor enhancements, 2: total number of editor enhancements */ |
| 249 | echo esc_html(sprintf(__('%1$d/%2$d Active', 'superb-blocks'), $this->EditorEnabledCount, $this->EditorTotalCount)); |
| 250 | ?></span> |
| 251 | </div> |
| 252 | <div class="superbaddons-dashboard-enhancement-grid"> |
| 253 | <?php |
| 254 | $enhancements = array( |
| 255 | array('icon' => 'purple-selection-plus.svg', 'name' => __('Editor Outlines', 'superb-blocks'), 'desc' => __('Outlines around blocks and child blocks to easily visualize your layout structure.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::HIGHLIGHTS_KEY), |
| 256 | array('icon' => 'devices-duotone.svg', 'name' => __('Responsive Controls', 'superb-blocks'), 'desc' => __('Per-device visibility, spacing, font size, alignment, and layout overrides for any block.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::RESPONSIVE_KEY), |
| 257 | array('icon' => 'sneaker-move-duotone.svg', 'name' => __('Animations', 'superb-blocks'), 'desc' => __('40+ block animations, letter effects, and typing & counting animations.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::ANIMATIONS_KEY), |
| 258 | array('icon' => 'target-duotone.svg', 'name' => __('Block Conditions', 'superb-blocks'), 'desc' => __('Show or hide blocks based on user roles, schedules, content, WooCommerce data, and more.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::CONDITIONS_KEY), |
| 259 | array('icon' => 'purple-list-bullets.svg', 'name' => __('Navigation Enhancements', 'superb-blocks'), 'desc' => __('Mobile overlay and submenu improvements for the navigation block.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::NAVIGATION_KEY), |
| 260 | array('icon' => 'brackets-curly-duotone.svg', 'name' => __('Dynamic Content', 'superb-blocks'), 'desc' => __('Insert post data, author info, and custom fields dynamically into any text.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::DYNAMIC_CONTENT_KEY), |
| 261 | array('icon' => 'purple-aa.svg', 'name' => __('Rich Text', 'superb-blocks'), 'desc' => __('Rich text enhancements such as justify text alignment for text-based blocks.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::RICHTEXT_KEY), |
| 262 | array('icon' => 'purple-chat.svg', 'name' => __('Extra Social Icons', 'superb-blocks'), 'desc' => __('Adds 20+ additional icons to the core Social Icons block (Bilibili, Ko-fi, Signal, Slack, Steam, Substack, and more).', 'superb-blocks'), 'key' => GutenbergEnhancementsController::SOCIAL_ICONS_KEY), |
| 263 | array('icon' => 'purple-gauge.svg', 'name' => __('Admin Shortcuts', 'superb-blocks'), 'desc' => __('Adds handy block theme shortcuts such as Edit Front Page and Style Book.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::DASHBOARD_SHORTCUTS_KEY), |
| 264 | array('icon' => 'pushpin-duotone.svg', 'name' => __('Sticky Positioning', 'superb-blocks'), 'desc' => __('Pin any block to the top or bottom of the screen as visitors scroll, with scope and per-device control.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::STICKY_KEY), |
| 265 | array('icon' => 'stack-simple-duotone.svg', 'name' => __('Stacking Order', 'superb-blocks'), 'desc' => __('Adds a z-index control to the Advanced panel of any block, with quick presets for common stacking levels.', 'superb-blocks'), 'key' => GutenbergEnhancementsController::Z_INDEX_KEY), |
| 266 | ); |
| 267 | foreach ($enhancements as $enh) : |
| 268 | $has_key = isset($enh['key']); |
| 269 | $is_enabled = $has_key && isset($this->EditorOptions[$enh['key']]) && $this->EditorOptions[$enh['key']]; |
| 270 | ?> |
| 271 | <div class="superbaddons-dashboard-enhancement-card <?php echo $is_enabled ? 'superbaddons-dashboard-enhancement-card--enabled' : ''; ?>"> |
| 272 | <div class="superbaddons-dashboard-enhancement-card-header"> |
| 273 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/' . $enh['icon']); ?>" aria-hidden="true" /> |
| 274 | <?php if ($is_enabled) : ?> |
| 275 | <span class="superbaddons-integration-card-badge superbaddons-integration-card-badge--connected"><?php echo esc_html__("Enabled", "superb-blocks"); ?></span> |
| 276 | <?php else : ?> |
| 277 | <span class="superbaddons-integration-card-badge"><?php echo esc_html__("Disabled", "superb-blocks"); ?></span> |
| 278 | <?php endif; ?> |
| 279 | </div> |
| 280 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html($enh['name']); ?></strong> |
| 281 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html($enh['desc']); ?></p> |
| 282 | </div> |
| 283 | <?php endforeach; ?> |
| 284 | <?php $this->RenderSuggestCard( |
| 285 | __('Suggest an enhancement', 'superb-blocks'), |
| 286 | __('Have an idea for a new editor enhancement? We\'d love to hear from you.', 'superb-blocks') |
| 287 | ); ?> |
| 288 | </div> |
| 289 | <a href="<?php echo esc_url($this->settings_modules_url); ?>" class="superbaddons-element-colorlink superbaddons-dashboard-configure-link"><?php echo esc_html__("Configure in Settings", "superb-blocks"); ?> →</a> |
| 290 | </div> |
| 291 | |
| 292 | <!-- More Features --> |
| 293 | <div class="superbaddons-settings-section"> |
| 294 | <div class="superbaddons-dashboard-section-header"> |
| 295 | <h4 class="superbaddons-element-text-sm superbaddons-element-text-dark superbaddons-element-text-800 superbaddons-element-m0"><?php echo esc_html__("More Features", "superb-blocks"); ?></h4> |
| 296 | </div> |
| 297 | <div class="superbaddons-dashboard-feature-grid"> |
| 298 | <div class="superbaddons-dashboard-feature-card" id="superbaddons-dashboard-design-library-card"> |
| 299 | <div class="superbaddons-dashboard-feature-card-header"> |
| 300 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/superb-blocks.svg'); ?>" aria-hidden="true" /> |
| 301 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html__("Design Library", "superb-blocks"); ?></strong> |
| 302 | </div> |
| 303 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html__("200+ pre-built patterns you can insert with one click.", "superb-blocks"); ?></p> |
| 304 | <button type="button" class="superbaddons-element-button superbaddons-element-button-sm" id="gutenberg-lib-modal-btn"><?php echo esc_html__("Explore Design Library", "superb-blocks"); ?></button> |
| 305 | </div> |
| 306 | <div class="superbaddons-dashboard-feature-card" id="superbaddons-dashboard-custom-css-card"> |
| 307 | <div class="superbaddons-dashboard-feature-card-header"> |
| 308 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/dashboard-custom-css.svg'); ?>" aria-hidden="true" /> |
| 309 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html__("Custom CSS", "superb-blocks"); ?></strong> |
| 310 | </div> |
| 311 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html__("Target specific pages or templates with CSS blocks, auto-combined and loaded only where needed.", "superb-blocks"); ?></p> |
| 312 | <a href="<?php echo esc_url($this->custom_css_url); ?>" class="superbaddons-element-button superbaddons-element-button-sm"><?php echo esc_html__("Manage CSS", "superb-blocks"); ?></a> |
| 313 | </div> |
| 314 | <div class="superbaddons-dashboard-feature-card"> |
| 315 | <div class="superbaddons-dashboard-feature-card-header"> |
| 316 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/dashboard-header-footer.svg'); ?>" aria-hidden="true" /> |
| 317 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html__("Header & Footer Templates", "superb-blocks"); ?></strong> |
| 318 | </div> |
| 319 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html__("Select your website's header and footer templates.", "superb-blocks"); ?></p> |
| 320 | <a href="<?php echo esc_url($this->header_footer_url); ?>" class="superbaddons-element-button superbaddons-element-button-sm"><?php echo esc_html__("Select Header & Footer", "superb-blocks"); ?></a> |
| 321 | </div> |
| 322 | <div class="superbaddons-dashboard-feature-card <?php echo !is_plugin_active('woocommerce/woocommerce.php') ? 'superbaddons-dashboard-feature-card--inactive' : ''; ?>"> |
| 323 | <div class="superbaddons-dashboard-feature-card-header"> |
| 324 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/dashboard-wc-icon.svg'); ?>" aria-hidden="true" /> |
| 325 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html__("WooCommerce Headers", "superb-blocks"); ?></strong> |
| 326 | </div> |
| 327 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html__("WooCommerce compatible header templates and navigation.", "superb-blocks"); ?></p> |
| 328 | <?php if (is_plugin_active('woocommerce/woocommerce.php')) : ?> |
| 329 | <a href="<?php echo esc_url($this->woocommerce_header_url); ?>" class="superbaddons-element-button superbaddons-element-button-sm"><?php echo esc_html__("Select Header", "superb-blocks"); ?></a> |
| 330 | <?php else : ?> |
| 331 | <span class="superbaddons-integration-card-badge"><?php echo esc_html__("Requires WooCommerce", "superb-blocks"); ?></span> |
| 332 | <?php endif; ?> |
| 333 | </div> |
| 334 | <div class="superbaddons-dashboard-feature-card <?php echo !defined('ELEMENTOR_VERSION') ? 'superbaddons-dashboard-feature-card--inactive' : ''; ?>"> |
| 335 | <div class="superbaddons-dashboard-feature-card-header"> |
| 336 | <img class="superbaddons-dashboard-block-card-icon" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/elementor-sections.svg'); ?>" aria-hidden="true" /> |
| 337 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html__("Elementor Sections", "superb-blocks"); ?></strong> |
| 338 | </div> |
| 339 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html__("300+ pre-built Elementor sections for fast site building.", "superb-blocks"); ?></p> |
| 340 | <?php if (defined('ELEMENTOR_VERSION')) : ?> |
| 341 | <button type="button" class="superbaddons-element-button superbaddons-element-button-sm" id="elementor-lib-modal-btn"><?php echo esc_html__("Explore Sections", "superb-blocks"); ?></button> |
| 342 | <?php else : ?> |
| 343 | <span class="superbaddons-integration-card-badge"><?php echo esc_html__("Requires Elementor", "superb-blocks"); ?></span> |
| 344 | <?php endif; ?> |
| 345 | </div> |
| 346 | <?php $this->RenderSuggestCard( |
| 347 | __('Have a feature idea?', 'superb-blocks'), |
| 348 | __('Tell us what features would make your workflow better.', 'superb-blocks'), |
| 349 | true |
| 350 | ); ?> |
| 351 | </div> |
| 352 | </div> |
| 353 | </div> |
| 354 | <div class="superbaddons-admindashboard-sidebarlayout-right"> |
| 355 | <?php new NewsletterForm(__("Stay updated with new features and freebies.", "superb-blocks"), true); ?> |
| 356 | <?php new ReviewBox(); ?> |
| 357 | <?php new SupportBox(); ?> |
| 358 | <?php new PremiumBox(AdminLinkSource::DEFAULT); ?> |
| 359 | </div> |
| 360 | </div> |
| 361 | <?php |
| 362 | new Modal(); |
| 363 | } |
| 364 | |
| 365 | private function RenderIntegrationBadge($integration) |
| 366 | { |
| 367 | if ($integration === 'woocommerce') : |
| 368 | ?> |
| 369 | <span class="superbaddons-dashboard-integration-badge superbaddons-dashboard-integration-badge--woo" title="<?php echo esc_attr__('Requires WooCommerce', 'superb-blocks'); ?>"> |
| 370 | <svg role="img" viewBox="0 9.58 24 4.84" xmlns="http://www.w3.org/2000/svg" aria-label="<?php echo esc_attr__('Requires WooCommerce', 'superb-blocks'); ?>"> |
| 371 | <path d="M.754 9.58a.754.754 0 00-.754.758v2.525c0 .42.339.758.758.758h3.135l1.431.799-.326-.799h2.373a.757.757 0 00.758-.758v-2.525a.757.757 0 00-.758-.758H.754zm2.709.445h.03c.065.001.124.023.179.067a.26.26 0 01.103.19.29.29 0 01-.033.16c-.13.239-.236.64-.322 1.199-.083.541-.114.965-.094 1.267a.392.392 0 01-.039.219.213.213 0 01-.176.12c-.086.006-.177-.034-.263-.124-.31-.316-.555-.788-.735-1.416-.216.425-.375.744-.478.957-.196.376-.363.568-.502.578-.09.007-.166-.069-.233-.228-.17-.436-.352-1.277-.548-2.524a.297.297 0 01.054-.222c.047-.064.116-.095.21-.102.169-.013.265.065.288.238.103.695.217 1.284.336 1.766l.727-1.387c.066-.126.15-.192.25-.199.146-.01.237.083.273.28.083.441.188.817.315 1.136.086-.844.233-1.453.44-1.828a.255.255 0 01.218-.147zm1.293.36c.056 0 .116.006.18.02.232.05.411.177.53.386.107.18.161.395.161.654 0 .343-.087.654-.26.94-.2.332-.459.5-.781.5a.88.88 0 01-.18-.022.763.763 0 01-.531-.384 1.287 1.287 0 01-.158-.659c0-.342.085-.655.258-.937.202-.333.462-.498.78-.498zm2.084 0c.056 0 .116.006.18.02.236.05.411.177.53.386.107.18.16.395.16.654 0 .343-.086.654-.259.94-.2.332-.459.5-.781.5a.88.88 0 01-.18-.022.763.763 0 01-.531-.384 1.287 1.287 0 01-.16-.659c0-.342.087-.655.26-.937.202-.333.462-.498.78-.498zm4.437.047c-.305 0-.546.102-.718.304-.173.203-.256.49-.256.856 0 .395.086.697.256.906.17.21.418.316.744.316.315 0 .559-.107.728-.316.17-.21.256-.504.256-.883s-.087-.673-.26-.879c-.176-.202-.424-.304-.75-.304zm-1.466.002a1.13 1.13 0 00-.84.326c-.223.22-.332.499-.332.838 0 .362.108.658.328.88.22.223.505.336.861.336.103 0 .22-.016.346-.052v-.54c-.117.034-.216.051-.303.051a.545.545 0 01-.422-.177c-.106-.12-.16-.278-.16-.48 0-.19.053-.348.156-.468a.498.498 0 01.397-.181c.103 0 .212.015.332.049v-.537a1.394 1.394 0 00-.363-.045zm12.414 0a1.135 1.135 0 00-.84.326c-.223.22-.332.499-.332.838 0 .362.108.658.328.88.22.223.506.336.861.336.103 0 .22-.016.346-.052v-.54c-.116.034-.216.051-.303.051a.545.545 0 01-.422-.177c-.106-.12-.16-.278-.16-.48 0-.19.053-.348.156-.468a.498.498 0 01.397-.181c.103 0 .212.015.332.049v-.537a1.394 1.394 0 00-.363-.045zm-9.598.06l-.29 2.264h.579l.156-1.559.395 1.559h.412l.379-1.555.164 1.555h.603l-.304-2.264h-.791l-.12.508c-.03.13-.06.264-.087.4l-.067.352a29.97 29.97 0 00-.258-1.26h-.771zm2.768 0l-.29 2.264h.579l.156-1.559.396 1.559h.412l.375-1.555.165 1.555h.603l-.305-2.264h-.789l-.119.508c-.03.13-.06.264-.086.4l-.066.352c-.063-.352-.15-.771-.26-1.26h-.771zm3.988 0v2.264h.611v-1.031h.012l.494 1.03h.645l-.489-1.019a.61.61 0 00.37-.552.598.598 0 00-.25-.506c-.167-.123-.394-.186-.68-.186h-.713zm3.377 0v2.264H24v-.483h-.63v-.414h.54v-.468h-.54v-.416h.626v-.483H22.76zm-4.793.004v2.264h1.24v-.483h-.627v-.416h.541v-.468h-.54v-.415h.622v-.482h-1.236zm2.025.432c.146.003.25.025.313.072.063.046.091.12.091.227 0 .156-.135.236-.404.24v-.54zm-15.22.011c-.104 0-.205.069-.301.211a1.078 1.078 0 00-.2.639c0 .096.02.2.06.303.049.13.117.198.196.215.083.016.173-.02.27-.106.123-.11.205-.273.252-.492.016-.077.023-.16.023-.246 0-.097-.02-.2-.06-.303-.05-.13-.116-.198-.196-.215a.246.246 0 00-.045-.006zm2.083 0c-.103 0-.204.069-.3.211a1.078 1.078 0 00-.2.639c0 .096.02.2.06.303.049.13.117.198.196.215.083.016.173-.02.27-.106.123-.11.205-.273.252-.492.013-.077.023-.16.023-.246 0-.097-.02-.2-.06-.303-.05-.13-.116-.198-.196-.215a.246.246 0 00-.045-.006zm4.428.006c.233 0 .354.218.354.66-.004.273-.038.46-.098.553a.293.293 0 01-.262.139.266.266 0 01-.242-.139c-.056-.093-.084-.28-.084-.562 0-.436.11-.65.332-.65Z" /> |
| 372 | </svg> |
| 373 | </span> |
| 374 | <?php |
| 375 | endif; |
| 376 | } |
| 377 | |
| 378 | private function RenderSuggestCard($title, $description, $stacked = false) |
| 379 | { |
| 380 | ?> |
| 381 | <div class="superbaddons-dashboard-suggest-card"> |
| 382 | <img src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-bulb.svg'); ?>" aria-hidden="true" /> |
| 383 | <div class="superbaddons-dashboard-suggest-card-content<?php echo $stacked ? ' superbaddons-dashboard-suggest-card-content-stacked' : ''; ?>"> |
| 384 | <strong class="superbaddons-element-text-xxs superbaddons-element-text-dark"><?php echo esc_html($title); ?></strong> |
| 385 | <p class="superbaddons-element-text-xxs superbaddons-element-text-gray superbaddons-element-m0"><?php echo esc_html($description); ?></p> |
| 386 | <?php if ($stacked) : ?> |
| 387 | <a href="<?php echo esc_url(AdminLinkUtil::GetLink(AdminLinkSource::DEFAULT, array("url" => "https://superbthemes.com/contact/", "anchor" => "create-ticket"))); ?>" target="_blank" class="superbaddons-element-colorlink superbaddons-element-text-xxs"><?php echo esc_html__("Request Feature", "superb-blocks"); ?> →</a> |
| 388 | <?php endif; ?> |
| 389 | </div> |
| 390 | <?php if (!$stacked) : ?> |
| 391 | <a href="<?php echo esc_url(AdminLinkUtil::GetLink(AdminLinkSource::DEFAULT, array("url" => "https://superbthemes.com/contact/", "anchor" => "create-ticket"))); ?>" target="_blank" class="superbaddons-element-colorlink superbaddons-element-text-xxs"><?php echo esc_html__("Request Feature", "superb-blocks"); ?> →</a> |
| 392 | <?php endif; ?> |
| 393 | </div> |
| 394 | <?php |
| 395 | } |
| 396 | } |
| 397 |