| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | * @var string |
| 16 | 16 | */ |
| 17 | 17 | public const SCREEN_NAME = 'dashboard_page_flywp'; |
| 18 | 18 | |
| 19 | - public $fastcgi = null; | |
| 19 | + public $fastcgi = null; | |
| 20 | 20 | public $litespeed = null; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Admin constructor. |
| @@ -102,12 +102,11 @@ | ||
| 102 | 102 | 'optimizations' => __( 'Optimizations', 'flywp' ), |
| 103 | 103 | ]; |
| 104 | 104 | |
| 105 | 105 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 106 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : ''; | |
| 107 | - $active_tab = array_key_exists( $tab, $tabs ) ? $tab : 'cache'; | |
| 108 | - $site_info = $this->fetch_site_info(); | |
| 109 | - $app_site_url = $this->get_site_url( $site_info ); | |
| 106 | + $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ? $_GET['tab'] : 'cache'; | |
| 107 | + $site_info = $this->fetch_site_info(); | |
| 108 | + $app_site_url = $this->get_site_url( $site_info ); | |
| 110 | 109 | |
| 111 | 110 | include FLYWP_PLUGIN_DIR . '/views/admin.php'; |
| 112 | 111 | } |
| 113 | 112 | |
| @@ -119,9 +118,9 @@ | ||
| 119 | 118 | private function fetch_site_info() { |
| 120 | 119 | $transient_key = 'flywp_site_info'; |
| 121 | 120 | $site_info = get_transient( $transient_key ); |
| 122 | 121 | |
| 123 | - if ( ! $site_info ) { | |
| 122 | + if ( false === $site_info ) { | |
| 124 | 123 | $site_info = flywp()->flyapi->site_info(); |
| 125 | 124 | |
| 126 | 125 | if ( isset( $site_info['error'] ) ) { |
| 127 | 126 | return false; |
| @@ -140,14 +139,15 @@ | ||
| 140 | 139 | * |
| 141 | 140 | * @return string |
| 142 | 141 | */ |
| 143 | 142 | private function get_site_url( $info ) { |
| 144 | - if ( ! $info ) { | |
| 143 | + if ( false === $info ) { | |
| 145 | 144 | return 'https://app.flywp.com'; |
| 146 | 145 | } |
| 147 | 146 | |
| 148 | 147 | return sprintf( |
| 149 | - 'https://app.flywp.com/site/%d', | |
| 148 | + 'https://app.flywp.com/servers/%d/sites/%d', | |
| 149 | + $info['server_id'], | |
| 150 | 150 | $info['id'] |
| 151 | 151 | ); |
| 152 | 152 | } |
| 153 | 153 | } |