mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-08-31 03:53:15 +08:00
Refactoring
This commit is contained in:
parent
f2bf358b3a
commit
d130ab7e5f
21 changed files with 62 additions and 56 deletions
|
@ -4,7 +4,8 @@ namespace MainWP\Child;
|
|||
|
||||
class MainWP_Connect {
|
||||
|
||||
public static $instance = null;
|
||||
public static $instance = null;
|
||||
private $maxHistory = 5;
|
||||
|
||||
/**
|
||||
* Method get_class_name()
|
||||
|
@ -459,4 +460,24 @@ class MainWP_Connect {
|
|||
MainWP_Helper::update_option( 'mainwp_child_auth', $auths, 'yes' );
|
||||
}
|
||||
}
|
||||
|
||||
public function is_valid_auth( $key ) {
|
||||
$auths = get_option( 'mainwp_child_auth' );
|
||||
if ( ! $auths ) {
|
||||
return false;
|
||||
}
|
||||
for ( $i = 0; $i <= $this->maxHistory; $i ++ ) {
|
||||
if ( isset( $auths[ $i ] ) && ( $auths[ $i ] === $key ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function get_max_history() {
|
||||
return $this->maxHistory;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue