diff --git a/src/Modules/OneTapLogin.php b/src/Modules/OneTapLogin.php index 8a0efa2..dca7009 100644 --- a/src/Modules/OneTapLogin.php +++ b/src/Modules/OneTapLogin.php @@ -86,17 +86,17 @@ public function name(): string { */ public function init(): void { if ( $this->settings->one_tap_login ) { - add_action( 'login_enqueue_scripts', array( $this, 'one_tap_scripts' ) ); - add_action( 'login_footer', array( $this, 'one_tap_prompt' ) ); - add_action( 'wp_ajax_nopriv_validate_id_token', array( $this, 'validate_token' ) ); - add_action( 'rtcamp.id_token_verified', array( $this, 'authenticate' ) ); + add_action( 'login_enqueue_scripts', [ $this, 'one_tap_scripts' ] ); + add_action( 'login_footer', [ $this, 'one_tap_prompt' ] ); + add_action( 'wp_ajax_nopriv_validate_id_token', [ $this, 'validate_token' ] ); + add_action( 'rtcamp.id_token_verified', [ $this, 'authenticate' ] ); add_action( 'init', function () { if ( ! is_user_logged_in() ) { $hook_prefix = ( 'sitewide' === $this->settings->one_tap_login_screen ) ? 'wp' : 'login'; - add_action( $hook_prefix . '_enqueue_scripts', array( $this, 'one_tap_scripts' ) ); - add_action( $hook_prefix . '_footer', array( $this, 'one_tap_prompt' ), 10000 ); + add_action( $hook_prefix . '_enqueue_scripts', [ $this, 'one_tap_scripts' ] ); + add_action( $hook_prefix . '_footer', [ $this, 'one_tap_prompt' ], 10000 ); } } ); @@ -125,23 +125,23 @@ public function one_tap_scripts(): void { wp_enqueue_script( 'login-with-google-one-tap', 'https://accounts.google.com/gsi/client', - array(), + [], filemtime( trailingslashit( plugin()->path ) . 'assets/build/js/onetap.js' ), true ); - $data = array( + $data = [ 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'state' => $this->google_client->state(), 'homeurl' => get_option( 'home', '' ), - ); + ]; wp_register_script( 'login-with-google-one-tap-js', trailingslashit( plugin()->url ) . 'assets/build/js/' . $filename, - array( + [ 'wp-i18n', - ), + ], filemtime( trailingslashit( plugin()->path ) . 'assets/build/js/onetap.js' ), true ); @@ -188,9 +188,9 @@ public function validate_token(): void { } wp_send_json_success( - array( + [ 'redirect' => $redirect_to, - ) + ] ); die;