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

Users.php in Inactive Logout trunk, at core/Users.php

42 lines 788 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Codemanas\InactiveLogout;
4
5 class Users {
6
7 /**
8 * Logout the actual session from here
9 *
10 * @since 3.0.0
11 * @author Deepen
12 */
13 public function logoutSession() {
14 check_ajax_referer( '_inaajax', 'security' );
15 if ( is_user_logged_in() ) {
16 $this->setToastMessage();
17 wp_logout();
18 }
19
20 wp_send_json( array(
21 'isLoggedIn' => is_user_logged_in()
22 ) );
23
24 wp_die();
25 }
26
27 private function setToastMessage() {
28 if ( ! empty( Helpers::getSettings( 'show_toast_notification' ) ) ) {
29 setcookie( 'ina_redirection_logged_out', true, time() + 120, "/" );
30 }
31 }
32
33 private static ?Users $_instance = null;
34
35 public static function getInstance(): ?Users {
36 if ( is_null( self::$_instance ) ) {
37 self::$_instance = new self();
38 }
39
40 return self::$_instance;
41 }
42 }