PluginProbe
WebTotem Security / 1.0
WebTotem Security v1.0
3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 2.2.4 All 109 releases
wt-security / library / App.php

App.php in WebTotem Security 1.0, at library/App.php

62 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php defined('ABSPATH') or die("Protected By WT!");
2
3
4 class WTSEC_LIBRARY_App
5 {
6
7 public function __construct()
8 {
9 $this->auth();
10 }
11
12 public function auth(){
13 if(self::getOption('authorized') === false){
14 wp_safe_redirect(wtsec_getUrl('login'));
15 exit;
16 }
17 }
18
19 public static function authorized(){
20 return (boolean) self::getOption('authorized');
21 }
22
23 public static function login($token){
24 self::set('authorized', true);
25 self::set('authToken', $token);
26 }
27
28 public static function logout(){
29 self::set('authorized', false);
30 self::set('authToken', "");
31 }
32
33
34
35 public function getLocalDomains(){
36 return [];
37 }
38
39 public function set($name,$value){
40 return update_option(WTSEC_PLUGIN_PREFIX.$name,$value);
41 }
42
43 public function get($name){
44 return get_option(WTSEC_PLUGIN_PREFIX.$name);
45 }
46
47 public static function getOption($name){
48 return get_option(WTSEC_PLUGIN_PREFIX.$name);
49 }
50
51 public static function deleteOption($name){
52 return delete_option(WTSEC_PLUGIN_PREFIX.$name);
53 }
54
55 public static function getToken(){
56 return self::getOption('authToken');
57 }
58
59 public static function getName(){
60 return self::getOption('username');
61 }
62 }