class-content-box-large.php
1 year ago
class-enhancement-settings-component.php
1 year ago
class-input-checkbox.php
1 year ago
class-link-box.php
1 year ago
class-modal-editor-previews.php
1 year ago
class-modal-feedback.php
1 year ago
class-modal.php
1 year ago
class-navigation.php
1 year ago
class-newsletter-form.php
1 year ago
class-outdated-browser-warning.php
1 year ago
class-premium-box-large.php
1 year ago
class-premium-box.php
1 year ago
class-premium-feature-list.php
1 year ago
class-review-box.php
1 year ago
class-support-box.php
1 year ago
class-support-link-boxes.php
1 year ago
class-navigation.php
92 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SuperbAddons\Components\Admin; |
| 4 | |
| 5 | use SuperbAddons\Admin\Controllers\DashboardController; |
| 6 | use SuperbAddons\Data\Controllers\KeyController; |
| 7 | |
| 8 | defined('ABSPATH') || exit(); |
| 9 | |
| 10 | class Navigation |
| 11 | { |
| 12 | private $pages; |
| 13 | private $active_page; |
| 14 | private $issue_detected = false; |
| 15 | private $has_premium = false; |
| 16 | private $hide_navigation_items = false; |
| 17 | private $subtitle = false; |
| 18 | |
| 19 | public function __construct($hide_navigation_items = false, $subtitle = false) |
| 20 | { |
| 21 | $HasRegisteredKey = KeyController::HasRegisteredKey(); |
| 22 | if ($HasRegisteredKey) { |
| 23 | $this->has_premium = KeyController::HasValidPremiumKey(); |
| 24 | $KeyStatus = KeyController::GetKeyStatus(); |
| 25 | if (!$KeyStatus['active'] || $KeyStatus['expired'] || !$KeyStatus['verified'] || $KeyStatus['exceeded']) { |
| 26 | $this->issue_detected = true; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | $this->subtitle = $subtitle; |
| 31 | |
| 32 | if ($hide_navigation_items) { |
| 33 | $this->hide_navigation_items = true; |
| 34 | $this->pages = array(); |
| 35 | $this->Render(); |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | $this->active_page = isset($_GET['page']) ? $_GET['page'] : DashboardController::DASHBOARD; |
| 40 | $pages = array_merge(array(DashboardController::MENU_SLUG => __("Dashboard", "superb-blocks")), apply_filters('superbaddons/admin/navigation/pages', array())); |
| 41 | $this->pages = array_merge($pages, array( |
| 42 | DashboardController::PAGE_WIZARD => __("Theme Designer", "superb-blocks"), |
| 43 | DashboardController::ADDITIONAL_CSS => __("Custom CSS", "superb-blocks"), |
| 44 | DashboardController::SETTINGS => __("Settings", "superb-blocks"), |
| 45 | DashboardController::SUPPORT => __("Support", "superb-blocks"), |
| 46 | )); |
| 47 | $this->Render(); |
| 48 | } |
| 49 | |
| 50 | private function Render() |
| 51 | { |
| 52 | ?> |
| 53 | <div class="superbaddons-admindashboard-navigation <?= $this->hide_navigation_items ? 'superbaddons-admindashboard-navigation-items-hidden' : ''; ?>"> |
| 54 | <div class="superbaddons-admindashboard-navigation-toplevel"> |
| 55 | <a href="<?= esc_url(admin_url('admin.php?page=' . DashboardController::MENU_SLUG)); ?>" class="superbaddons-admindashboard-navigation-logo-wrapper"> |
| 56 | <img src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/icon-superb.svg'); ?>" /> |
| 57 | <span class="superbaddons-element-text-md superbaddons-element-text-800 superbaddons-element-text-dark">Superb Addons</span> |
| 58 | </a> |
| 59 | <?php if ($this->subtitle) : ?> |
| 60 | <span class="superbthemes-module-purple-badge"><?= $this->subtitle; ?></span> |
| 61 | <?php endif; ?> |
| 62 | <div class="superbaddons-admindashboard-navigation-shortcuts"> |
| 63 | <?php if (!$this->has_premium) : ?> |
| 64 | <a class="superbaddons-admindashboard-navigation-shortcuts-item" target="_blank" href="https://superbthemes.com/superb-addons/" title="<?= esc_attr__("Get Premium", "superb-blocks"); ?>"><img src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-crown.svg'); ?>" alt="<?= esc_attr__("Get Premium", "superb-blocks"); ?>" /></a> |
| 65 | <?php endif; ?> |
| 66 | <a class="superbaddons-admindashboard-navigation-shortcuts-item" target="_blank" href="https://superbthemes.com/customer-support/" title="<?= esc_attr__("Contact Support", "superb-blocks"); ?>"><img src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/help.svg'); ?>" alt="<?= esc_attr__("Contact Support", "superb-blocks"); ?>" /></a> |
| 67 | <a class="superbaddons-admindashboard-navigation-shortcuts-item" target="_blank" href="https://superbthemes.com/documentation/" title="<?= esc_attr__("View Documentation", "superb-blocks"); ?>"><img src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/file.svg'); ?>" alt="<?= esc_attr__("View Documentation", "superb-blocks"); ?>" /></a> |
| 68 | <span class="superbaddons-admindashboard-navigation-shortcuts-item"> |
| 69 | <?= esc_html(SUPERBADDONS_VERSION); ?> |
| 70 | <?php if ($this->has_premium) : ?> |
| 71 | <img class="superbaddons-element-ml1" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/purple-crown.svg'); ?>" alt="<?= esc_attr__("Premium License", "superb-blocks"); ?>" /> |
| 72 | <?php endif; ?> |
| 73 | </span> |
| 74 | </div> |
| 75 | </div> |
| 76 | <?php if (!$this->hide_navigation_items) : ?> |
| 77 | <div class="superbaddons-admindashboard-navigation-bottomlevel"> |
| 78 | <?php foreach ($this->pages as $pagekey => $pagetitle) : ?> |
| 79 | <a href="<?= esc_url(admin_url('admin.php?page=' . $pagekey)); ?>" class="superbaddons-admindashboard-navigation-bottomlevel-item <?= $pagekey == $this->active_page ? 'superbaddons-admindashboard-active' : ''; ?>"> |
| 80 | <?= esc_html($pagetitle); ?> |
| 81 | <?php if ($pagekey == DashboardController::SETTINGS && $this->issue_detected) : ?> |
| 82 | <img class="superbaddons-admindashboard-navigation-bottomlevel-item-issue-img" src="<?= esc_url(SUPERBADDONS_ASSETS_PATH . '/img/color-warning-octagon.svg'); ?>" alt="<?= esc_attr__("Issue Detected", "superb-blocks"); ?>" /> |
| 83 | <?php endif; ?> |
| 84 | </a> |
| 85 | <?php endforeach; ?> |
| 86 | </div> |
| 87 | <?php endif; ?> |
| 88 | </div> |
| 89 | <?php |
| 90 | } |
| 91 | } |
| 92 |