PluginProbe
Hostinger Tools / 3.0.76
Hostinger Tools v3.0.76
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 / Redirects.php

Redirects.php in Hostinger Tools 3.0.76, at includes/Admin/Redirects.php

41 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hostinger\Admin;
4
5 use Hostinger\Settings;
6
7 defined( 'ABSPATH' ) || exit;
8
9 class Redirects {
10 private string $platform;
11 public const PLATFORM_HPANEL = 'hpanel';
12
13 public function __construct() {
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 }
22
23 $this->platform = sanitize_text_field( $_GET['platform'] );
24 $this->login_redirect();
25 /** PHPCS:enable */
26 }
27
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 }
40 }
41