Refactoring

This commit is contained in:
thanghv 2020-05-14 19:43:10 +07:00
parent f2bf358b3a
commit d130ab7e5f
21 changed files with 62 additions and 56 deletions

View file

@ -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;
}
}