1 | <?php |
||
2 | namespace Irfa\Lockout\Func; |
||
3 | |||
4 | use Irfa\Lockout\Func\Core; |
||
5 | use View; |
||
6 | |||
7 | class Lockout extends Core { |
||
8 | |||
9 | public function unlock($username){ |
||
10 | if(is_array($username)){ |
||
11 | foreach($username as $key){ |
||
12 | $this->_unlock($key); |
||
13 | } |
||
14 | } else{ |
||
15 | $this->_unlock($username); |
||
16 | } |
||
17 | return true; |
||
18 | } |
||
19 | public function isLocked($username){ |
||
20 | return $this->is_locked($username); |
||
21 | } |
||
22 | public function message(){ |
||
23 | return $this->showMessage(); |
||
24 | } |
||
25 | public function lock($username){ |
||
26 | if(is_array($username)){ |
||
27 | foreach($username as $key){ |
||
28 | $this->_lock($key); |
||
29 | } |
||
30 | } else{ |
||
31 | $this->_lock($username); |
||
32 | } |
||
33 | return true; |
||
34 | } |
||
35 | public function check($username) { |
||
36 | $ret = null; |
||
37 | if(is_array($username)){ |
||
38 | foreach($username as $key){ |
||
39 | $get = $this->_check($key); |
||
40 | if(!empty($get)){ |
||
41 | $ret[] = $get; |
||
42 | } |
||
43 | } |
||
44 | } else{ |
||
45 | $ret = $this->_check($username); |
||
46 | } |
||
47 | $ret = json_encode($ret); |
||
48 | return json_decode($ret); |
||
49 | } |
||
50 | public function clearLocked(){ |
||
51 | return $this->clear_all(); |
||
52 | } |
||
53 | |||
54 | private function _unlock($username){ |
||
55 | $this->unlock_account($username); |
||
56 | } |
||
57 | private function _lock($username){ |
||
58 | $this->lock_account($username); |
||
59 | } |
||
60 | private function _check($username){ |
||
61 | return json_decode($this->check_account($username),true); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
62 | } |
||
63 | } |
||
64 |