| @@ -6,35 +6,34 @@ | ||
| 6 | 6 | |
| 7 | 7 | defined( 'ABSPATH' ) || exit; |
| 8 | 8 | |
| 9 | 9 | class Redirects { |
| 10 | - private string $platform; | |
| 11 | - public const PLATFORM_HPANEL = 'hpanel'; | |
| 10 | + private string $platform; | |
| 11 | + public const PLATFORM_HPANEL = 'hpanel'; | |
| 12 | 12 | |
| 13 | - public function __construct() { | |
| 13 | + public function __construct() { | |
| 14 | 14 | |
| 15 | - if ( ! Settings::get_setting( 'first_login_at' ) ) { | |
| 16 | - Settings::update_setting( 'first_login_at', gmdate( 'Y-m-d H:i:s' ) ); | |
| 17 | - } | |
| 18 | - /** PHPCS:disable WordPress.Security.NonceVerification.Recommended */ | |
| 19 | - if ( ! isset( $_GET['platform'] ) ) { | |
| 20 | - return; | |
| 21 | - } | |
| 15 | + if ( ! Settings::get_setting( 'first_login_at' ) ) { | |
| 16 | + Settings::update_setting( 'first_login_at', gmdate( 'Y-m-d H:i:s' ) ); | |
| 17 | + } | |
| 22 | 18 | |
| 23 | - $this->platform = sanitize_text_field( $_GET['platform'] ); | |
| 24 | - $this->login_redirect(); | |
| 25 | - /** PHPCS:enable */ | |
| 26 | - } | |
| 19 | + if ( ! isset( $_GET['platform'] ) ) { | |
| 20 | + return; | |
| 21 | + } | |
| 27 | 22 | |
| 28 | - public function login_redirect(): void { | |
| 29 | - if ( $this->platform === self::PLATFORM_HPANEL ) { | |
| 30 | - add_action( | |
| 31 | - 'init', | |
| 32 | - static function () { | |
| 33 | - $redirect_url = admin_url( 'admin.php?page=hostinger' ); | |
| 34 | - wp_safe_redirect( $redirect_url ); | |
| 35 | - exit; | |
| 36 | - } | |
| 37 | - ); | |
| 38 | - } | |
| 39 | - } | |
| 23 | + $this->platform = sanitize_text_field( $_GET['platform'] ); | |
| 24 | + $this->login_redirect(); | |
| 25 | + } | |
| 26 | + | |
| 27 | + private function login_redirect(): void { | |
| 28 | + if ( $this->platform === self::PLATFORM_HPANEL ) { | |
| 29 | + add_action( | |
| 30 | + 'init', | |
| 31 | + static function () { | |
| 32 | + $redirect_url = admin_url( 'admin.php?page=hostinger' ); | |
| 33 | + wp_safe_redirect( $redirect_url ); | |
| 34 | + exit; | |
| 35 | + } | |
| 36 | + ); | |
| 37 | + } | |
| 38 | + } | |
| 40 | 39 | } |