PluginProbe
Inactive Logout / trunk
Inactive Logout vtrunk
3.6.3 trunk 1.9.9 2.0.2 3.3.1 3.3.2 3.3.3 3.3.4 3.4.0 3.4.1 3.4.10 3.4.11 3.4.12 3.4.13 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 All 31 releases
inactive-logout / core / Controllers / Admin / TabController.php

TabController.php in Inactive Logout trunk, at core/Controllers/Admin/TabController.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Codemanas\InactiveLogout\Controllers\Admin;
4
5 use Codemanas\InactiveLogout\Helpers;
6
7 class TabController {
8
9 protected array $tabTemplates = [];
10
11 protected function __construct() {
12 $this->tabTemplates = [
13 'ina-basic' => 'tpl-inactive-logout-basic.php',
14 'ina-support' => 'tpl-inactive-logout-support.php',
15 'ina-advanced' => 'tpl-inactive-logout-advanced.php',
16 'ina-user-based' => 'tpl-inactive-logout-user-based.php'
17 ];
18 }
19
20 public function getActiveTab() {
21 $tab = filter_input( INPUT_GET, 'tab' );
22
23 return $tab ?? 'ina-basic';
24 }
25
26 public function handleTabRouter() {
27 $tab = $this->getActiveTab();
28
29 if ( array_key_exists( $tab, $this->tabTemplates ) ) {
30 if ( Helpers::is_pro_version_active() && $tab == "ina-user-based" ) {
31 require_once INLOGOUT_ADDON_PLUGIN_VIEWS . $this->tabTemplates[ $tab ];
32 } else {
33 require_once INACTIVE_LOGOUT_VIEWS . '/tabs/' . $this->tabTemplates[ $tab ];
34 }
35 }
36
37 do_action( 'ina_after_settings_wrapper', $tab );
38 }
39
40 private static ?TabController $_instance = null;
41
42 public static function getInstance(): ?TabController {
43 if ( is_null( self::$_instance ) ) {
44 self::$_instance = new self();
45 }
46
47 return self::$_instance;
48 }
49 }