updated plugin Two Factor
version 0.9.1
This commit is contained in:
@ -14,6 +14,23 @@
|
||||
*/
|
||||
abstract class Two_Factor_Provider {
|
||||
|
||||
/**
|
||||
* Ensures only one instance of the provider class exists in memory at any one time.
|
||||
*
|
||||
* @since 0.1-dev
|
||||
*/
|
||||
public static function get_instance() {
|
||||
static $instances = array();
|
||||
|
||||
$class_name = static::class;
|
||||
|
||||
if ( ! isset( $instances[ $class_name ] ) ) {
|
||||
$instances[ $class_name ] = new $class_name;
|
||||
}
|
||||
|
||||
return $instances[ $class_name ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
@ -32,6 +49,21 @@ abstract class Two_Factor_Provider {
|
||||
*/
|
||||
abstract public function get_label();
|
||||
|
||||
/**
|
||||
* Returns the "continue with" text provider for the login screen.
|
||||
*
|
||||
* @since 0.9.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_alternative_provider_label() {
|
||||
return sprintf(
|
||||
/* translators: the two factor provider name */
|
||||
__( 'Use %s', 'two-factor' ),
|
||||
$this->get_label()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the name of the provider.
|
||||
*
|
||||
@ -41,6 +73,17 @@ abstract class Two_Factor_Provider {
|
||||
echo esc_html( $this->get_label() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the provider key / slug.
|
||||
*
|
||||
* @since 0.9.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_key() {
|
||||
return get_class( $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the form that prompts the user to authenticate.
|
||||
*
|
||||
|
Reference in New Issue
Block a user