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 / AdminController.php

AdminController.php in Inactive Logout trunk, at core/Controllers/AdminController.php

56 lines 1.4 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;
4
5 use Codemanas\InactiveLogout\Backend\Menu;
6 use Codemanas\InactiveLogout\Controllers\Admin\StoreController;
7
8 class AdminController {
9
10 private static ?AdminController $_instance = null;
11
12 public static function getInstance(): ?AdminController {
13 if ( is_null( self::$_instance ) ) {
14 self::$_instance = new self();
15 }
16
17 return self::$_instance;
18 }
19
20 protected function __construct() {
21 $this->init();
22
23 add_action( 'admin_init', [ $this, 'store' ] );
24 add_action( 'ina_before_settings_wrapper', [ $this, 'ina_before_settings_wrap' ] );
25 add_action( 'ina_after_settings_wrapper', [ $this, 'ina_after_settings_wrap' ] );
26 }
27
28 public function init() {
29 Menu::getInstance();
30 }
31
32 public function store() {
33 $adv_submit = filter_input( INPUT_POST, 'adv_submit' );
34 if ( ! empty( $adv_submit ) ) {
35 if ( ! isset( $_REQUEST['_save_timeout_adv_settings'] ) && ! wp_verify_nonce( $_REQUEST['_save_timeout_adv_settings'], '_nonce_action_save_timeout_adv_settings' ) ) {
36 wp_die( __( 'Not allowed', 'inactive-logout' ) );
37 }
38
39 StoreController::getInstance()->saveRoleBasedSettings();
40 }
41 }
42
43 /**
44 * Settings wrapper html element.
45 */
46 public function ina_before_settings_wrap() {
47 echo '<div class="wrap ina-settings-wrapper">';
48 }
49
50 /**
51 * Settings wrapper html element.
52 */
53 public function ina_after_settings_wrap() {
54 echo '</div>';
55 }
56 }