main-settings.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | use WPStaging\Core\WPStaging; |
| 4 | use WPStaging\Framework\Facades\Sanitize; |
| 5 | use WPStaging\Framework\SiteInfo; |
| 6 | |
| 7 | $siteInfo = WPStaging::make(SiteInfo::class); |
| 8 | settings_errors(); ?> |
| 9 | <div class="wpstg_admin" id="wpstg-clonepage-wrapper"> |
| 10 | <?php |
| 11 | require_once(WPSTG_VIEWS_DIR . (defined('WPSTGPRO_VERSION') ? 'pro/_main/header.php' : '_main/header.php')); |
| 12 | |
| 13 | $isActiveSettingsPage = true; |
| 14 | $wpstgDeferCompatNotice = true; |
| 15 | require_once(WPSTG_VIEWS_DIR . '_main/main-navigation.php'); |
| 16 | ?> |
| 17 | <div class="wpstg-loading-bar-container"> |
| 18 | <div class="wpstg-loading-bar"></div> |
| 19 | </div> |
| 20 | <div class="wpstg-tabs-container" id="wpstg-settings"> |
| 21 | |
| 22 | <ul class="wpstg-nav-tab-wrapper"> |
| 23 | |
| 24 | <?php |
| 25 | $tabs = \WPStaging\Core\WPStaging::getInstance()->get("tabs")->get(); |
| 26 | if (empty($tabs['temporary-login'])) { |
| 27 | $tabs['temporary-login'] = esc_html__("Temporary Logins", "wp-staging"); |
| 28 | } |
| 29 | |
| 30 | if (empty($tabs['remote-sync-settings'])) { |
| 31 | $tabs['remote-sync-settings'] = esc_html__("Remote Sync Connection Key", "wp-staging"); |
| 32 | } |
| 33 | |
| 34 | $activeTab = (isset($_GET["tab"]) && array_key_exists($_GET["tab"], $tabs)) ? Sanitize::sanitizeString($_GET["tab"]) : "general"; |
| 35 | |
| 36 | $currentUrl = remove_query_arg('sub-tab'); |
| 37 | # Loop through tabs |
| 38 | foreach ($tabs as $id => $name) : |
| 39 | $url = esc_url( |
| 40 | add_query_arg( |
| 41 | [ |
| 42 | "settings-updated" => false, |
| 43 | "tab" => $id, |
| 44 | ], |
| 45 | $currentUrl |
| 46 | ) |
| 47 | ); |
| 48 | |
| 49 | $activeClass = ($activeTab === $id) ? " wpstg-nav-tab-active" : ''; |
| 50 | ?> |
| 51 | <li> |
| 52 | <a href="<?php |
| 53 | echo esc_url($url) ?>" title="<?php |
| 54 | echo esc_attr($name) ?>" class="wpstg-nav-tab<?php |
| 55 | echo esc_attr($activeClass) ?>"> |
| 56 | <?php |
| 57 | echo esc_html($name) ?> |
| 58 | </a> |
| 59 | </li> |
| 60 | <?php |
| 61 | unset($url, $activeClass); |
| 62 | endforeach; |
| 63 | ?> |
| 64 | </ul> |
| 65 | <?php |
| 66 | $containerClass = ''; |
| 67 | if ($activeTab === 'general') { |
| 68 | $containerClass = 'wpstg-settings-container'; |
| 69 | } |
| 70 | ?> |
| 71 | |
| 72 | <div class="wpstg-metabox-holder <?php echo esc_html($containerClass); ?>"> |
| 73 | <?php |
| 74 | if (file_exists(WPSTG_VIEWS_DIR . "pro/settings/tabs/" . $activeTab . ".php")) { |
| 75 | require_once WPSTG_VIEWS_DIR . "pro/settings/tabs/" . $activeTab . ".php"; |
| 76 | } else { |
| 77 | require_once WPSTG_VIEWS_DIR . "settings/tabs/" . $activeTab . ".php"; |
| 78 | } |
| 79 | ?> |
| 80 | </div> |
| 81 | </div> |
| 82 | <?php |
| 83 | require_once WPSTG_VIEWS_DIR . "_main/footer.php"; |
| 84 | ?> |
| 85 | </div> |
| 86 | |
| 87 |