PluginProbe
Hostinger Tools / 2.1.1
Hostinger Tools v2.1.1
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / includes / admin / class-hostinger-admin-redirect.php

class-hostinger-admin-redirect.php in Hostinger Tools 2.1.1, at includes/admin/class-hostinger-admin-redirect.php

38 lines 793 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 class Hostinger_Admin_Redirect {
6 private string $platform;
7 public const PLATFORM_HPANEL = 'hpanel';
8
9 public function __construct() {
10
11 if ( ! Hostinger_Settings::get_setting( 'first_login_at' ) ) {
12 Hostinger_Settings::update_setting( 'first_login_at', gmdate( 'Y-m-d H:i:s' ) );
13 }
14
15 if ( ! isset( $_GET['platform'] ) ) {
16 return;
17 }
18
19 $this->platform = sanitize_text_field( $_GET['platform'] );
20 $this->login_redirect();
21 }
22
23 private function login_redirect(): void {
24 if ( $this->platform === self::PLATFORM_HPANEL ) {
25 add_action(
26 'init',
27 static function () {
28 $redirect_url = admin_url( 'admin.php?page=hostinger' );
29 wp_safe_redirect( $redirect_url );
30 exit;
31 }
32 );
33 }
34 }
35 }
36
37 new Hostinger_Admin_Redirect();
38