| @@ -5,18 +5,30 @@ | ||
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | // Determine the active tab and account activation state. |
| 9 | -$tabs = array( 'hardening', 'firewall', 'login', 'cookienotice', 'logs', 'license', 'multisite' ); | |
| 10 | -$active_tab = isset( $_GET['tab'] ) && in_array( $_GET['tab'], $tabs ) ? esc_attr( $_GET['tab'] ) : 'hardening'; // default active tab | |
| 11 | -$activated = ( ( isset( $_GET['activated'] ) && $_GET['activated'] == 1 ) || ( isset( $_GET['active'] ) && $_GET['active'] == 1 ) ); | |
| 9 | +$tabs = [ 'hardening', 'firewall', 'login', 'cookienotice', 'logs', 'license', 'multisite' ]; | |
| 10 | +$active_tab = isset( $_GET['tab'] ) && in_array( $_GET['tab'], $tabs ) ? esc_attr( $_GET['tab'] ) : 'license'; // default active tab | |
| 11 | +$activated = ( ( isset( $_GET['ps_activated'] ) && $_GET['ps_activated'] == 1 ) || ( isset( $_GET['active'] ) && $_GET['active'] == 1 ) ); | |
| 12 | 12 | $status = ( get_option( 'patchstack_license_expiry', '' ) == '' || time() >= strtotime( get_option( 'patchstack_license_expiry', '' ) ) ); |
| 13 | -$show_settings = $this->get_option( 'patchstack_show_settings', 0 ) == 1; | |
| 13 | +$show_settings = $this->get_option( 'patchstack_show_settings', 0 ) == 1 && !isset($_GET['tab']) || isset($_GET['tab']) && $_GET['tab'] != 'license'; | |
| 14 | +$is_free = $this->get_option( 'patchstack_license_free', 0 ) == 1; | |
| 15 | +$class = get_option( 'patchstack_subscription_class', '' ); | |
| 16 | +$managed = get_option( 'patchstack_managed', false ); | |
| 17 | +$managed_text = get_option( 'patchstack_managed_text', '' ); | |
| 14 | 18 | |
| 15 | 19 | if ( ( ! $show_settings && $_GET['page'] != 'patchstack-multisite-settings' ) || ( $status && $active_tab != 'license' && $_GET['page'] != 'patchstack-multisite-settings' ) ) { |
| 16 | 20 | $_GET['tab'] = $active_tab = 'license'; |
| 17 | 21 | } |
| 18 | 22 | |
| 23 | +if ( ( $is_free || ! $is_free && $status ) && $active_tab != 'license' && $_GET['page'] == 'patchstack-multisite-settings' ) { | |
| 24 | + $_GET['tab'] = $active_tab = 'multisite'; | |
| 25 | +} | |
| 26 | + | |
| 27 | +if ($active_tab == 'license') { | |
| 28 | + $show_settings = false; | |
| 29 | +} | |
| 30 | + | |
| 19 | 31 | // Determine the URL's. |
| 20 | 32 | $page = $_GET['page'] == 'patchstack-multisite-settings' ? 'patchstack-multisite-settings' : $this->plugin->name; |
| 21 | 33 | ?> |
| 22 | 34 | <div class="patchstack-content-wrap<?php echo ( ! $show_settings || $this->get_option( 'patchstack_license_free', 0 ) == 1 ? ' patchstack-free' : '' ); ?>"> |
| @@ -23,18 +35,21 @@ | ||
| 23 | 35 | <div class="patchstack-top"> |
| 24 | 36 | <div class="patchstack-top-logo" |
| 25 | 37 | <?php |
| 26 | 38 | if ( $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 1 ) { |
| 27 | - echo ' style="float: right; width: 80%; margin-right: -15px;"'; } | |
| 39 | + echo ' style="float: right; width: 80%; margin-right: -15px;"'; | |
| 40 | + } | |
| 28 | 41 | ?> |
| 29 | 42 | > |
| 30 | 43 | <img src="<?php echo esc_url( $this->plugin->url ); ?>assets/images/logo.svg" alt=""> |
| 31 | 44 | </div> |
| 32 | - <h1><?php echo __( 'Protect your sites from vulnerabilities', 'patchstack' ); ?></h1> | |
| 45 | + <h1 <?php echo $show_settings || !$managed ? 'style="display: none;"' : ''; ?>> | |
| 46 | + <?php echo $managed_text; ?> | |
| 47 | + </h1> | |
| 33 | 48 | <?php |
| 34 | 49 | if ( $_GET['page'] != 'patchstack-multisite-settings' && $show_settings && is_multisite() ) { |
| 35 | 50 | $site_info = get_blog_details(); |
| 36 | - echo "<h2 style='color:white;padding-left: 95px; margin-left: 95px;padding-top: 4px;'>" . esc_html( $site_info->domain ) . '</h2>'; | |
| 51 | + echo "<h2 style='color:white;padding-left: 95px; margin-top: -12px; margin-left: 150px;'>" . esc_html( $site_info->domain ) . '</h2>'; | |
| 37 | 52 | } |
| 38 | 53 | ?> |
| 39 | 54 | </div> |
| 40 | 55 | |
| @@ -59,12 +74,14 @@ | ||
| 59 | 74 | if ( ! $show_settings ) { |
| 60 | 75 | echo ' style="display: none;"'; } |
| 61 | 76 | ?> |
| 62 | 77 | > |
| 78 | + <?php if ( $class >= 1 || $class === '' ) { ?> | |
| 63 | 79 | <a href="?page=<?php echo esc_attr( $page ); ?>&tab=hardening" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'hardening' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 64 | 80 | <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-services white"></span></span> |
| 65 | 81 | <span class="patchstack-icon-text"><?php echo __( 'Hardening', 'patchstack' ); ?><br /><span>General Security Tweaks</span></span> |
| 66 | 82 | </a> |
| 83 | + <?php } ?> | |
| 67 | 84 | |
| 68 | 85 | <a href="?page=<?php echo esc_attr( $page ); ?>&tab=firewall" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'firewall' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 69 | 86 | <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-firewall white"></span></span> |
| 70 | 87 | <span class="patchstack-icon-text"><?php echo __( 'Firewall', 'patchstack' ); ?><br /><span>Whitelist & Blacklist & Firewall</span></span> |
| @@ -69,17 +86,21 @@ | ||
| 69 | 86 | <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-firewall white"></span></span> |
| 70 | 87 | <span class="patchstack-icon-text"><?php echo __( 'Firewall', 'patchstack' ); ?><br /><span>Whitelist & Blacklist & Firewall</span></span> |
| 71 | 88 | </a> |
| 72 | 89 | |
| 90 | + <?php if ( $class >= 1 || $class === '' ) { ?> | |
| 73 | 91 | <a href="?page=<?php echo esc_attr( $page ); ?>&tab=login" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'login' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 74 | 92 | <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-login white"></span></span> |
| 75 | 93 | <span class="patchstack-icon-text"><?php echo __( 'Login Protection', 'patchstack' ); ?><br /><span>Protect your login page</span></span> |
| 76 | 94 | </a> |
| 95 | + <?php } ?> | |
| 77 | 96 | |
| 97 | + <?php if ( $class >= 1 || $class === '' ) { ?> | |
| 78 | 98 | <a href="?page=<?php echo esc_attr( $page ); ?>&tab=cookienotice" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'cookienotice' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 79 | 99 | <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-cookies white"></span></span> |
| 80 | 100 | <span class="patchstack-icon-text"><?php echo __( 'Cookie Notice', 'patchstack' ); ?><br /><span>Inform your users</span></span> |
| 81 | 101 | </a> |
| 102 | + <?php } ?> | |
| 82 | 103 | |
| 83 | 104 | <?php if ( $page != 'patchstack-multisite-settings' ) { ?> |
| 84 | 105 | <a href="?page=<?php echo esc_attr( $page ); ?>&tab=logs" class="nav-tab patchstack-nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active patchstack-nav-tab-active' : ''; ?>"> |
| 85 | 106 | <span class="patchstack-icon-wrapper"><span class="patchstack-nav-tab-icon ic-logs white"></span></span> |
| @@ -95,11 +116,8 @@ | ||
| 95 | 116 | <?php } ?> |
| 96 | 117 | </h2> |
| 97 | 118 | <div class="patchstack-content-inner patchstack-active-tab-<?php echo esc_attr( $active_tab ); ?> <?php echo ! $show_settings && $this->get_option( 'patchstack_license_free', 0 ) == 0 ? 'patchstack-premium' : ''; ?>"> |
| 98 | 119 | <?php |
| 99 | - if ( $this->get_option( 'patchstack_license_free', 0 ) == 1 ) { | |
| 100 | - require 'license-free.php'; | |
| 101 | - } else { | |
| 102 | 120 | if ( $status && $_GET['page'] != 'patchstack-multisite-settings' ) { |
| 103 | 121 | require 'license.php'; |
| 104 | 122 | } else { |
| 105 | 123 | $form_action = is_multisite() ? '' : 'options.php'; |
| @@ -125,12 +143,12 @@ | ||
| 125 | 143 | case 'multisite': |
| 126 | 144 | require 'multisite-activation.php'; |
| 127 | 145 | break; |
| 128 | 146 | default: |
| 147 | + require 'license.php'; | |
| 129 | 148 | break; |
| 130 | 149 | } |
| 131 | 150 | } |
| 132 | - } | |
| 133 | 151 | ?> |
| 134 | 152 | </div> |
| 135 | 153 | </div> |
| 136 | 154 | </div> |