Change PHP keywords to comply with PSR2 (#116)

Signed-off-by: CodeLingoBot <bot@codelingo.io>
isekai
Shane Mulligan 6 years ago committed by Jonathan Daggerhart
parent 6ecb69f1cb
commit 0b51e9c1e5

@ -121,7 +121,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
return; return;
} }
$current_time = current_time( 'timestamp', TRUE ); $current_time = current_time( 'timestamp', true );
$refresh_token_info = $session[ $this->cookie_token_refresh_key ]; $refresh_token_info = $session[ $this->cookie_token_refresh_key ];
$next_access_token_refresh_time = $refresh_token_info[ 'next_access_token_refresh_time' ]; $next_access_token_refresh_time = $refresh_token_info[ 'next_access_token_refresh_time' ];
@ -261,7 +261,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
} }
if ( $this->settings->no_sslverify ) { if ( $this->settings->no_sslverify ) {
$request['sslverify'] = FALSE; $request['sslverify'] = false;
} }
return $request; return $request;
@ -383,7 +383,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
$this->logger->log( "Successful login for: {$user->user_login} ({$user->ID})", 'login-success' ); $this->logger->log( "Successful login for: {$user->user_login} ({$user->ID})", 'login-success' );
// redirect back to the origin page if enabled // redirect back to the origin page if enabled
$redirect_url = isset( $_COOKIE[ $this->cookie_redirect_key ] ) ? esc_url( $_COOKIE[ $this->cookie_redirect_key ] ) : FALSE; $redirect_url = isset( $_COOKIE[ $this->cookie_redirect_key ] ) ? esc_url( $_COOKIE[ $this->cookie_redirect_key ] ) : false;
if( $this->settings->redirect_user_back && !empty( $redirect_url ) ) { if( $this->settings->redirect_user_back && !empty( $redirect_url ) ) {
do_action( 'openid-connect-generic-redirect-user-back', $redirect_url, $user ); do_action( 'openid-connect-generic-redirect-user-back', $redirect_url, $user );
@ -427,7 +427,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
update_user_meta( $user->ID, 'openid-connect-generic-last-user-claim', $user_claim ); update_user_meta( $user->ID, 'openid-connect-generic-last-user-claim', $user_claim );
// Create the WP session, so we know its token // Create the WP session, so we know its token
$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user->ID, FALSE ); $expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user->ID, false );
$manager = WP_Session_Tokens::get_instance( $user->ID ); $manager = WP_Session_Tokens::get_instance( $user->ID );
$token = $manager->create( $expiration ); $token = $manager->create( $expiration );
@ -435,7 +435,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
$this->save_refresh_token( $manager, $token, $token_response ); $this->save_refresh_token( $manager, $token, $token_response );
// you did great, have a cookie! // you did great, have a cookie!
wp_set_auth_cookie( $user->ID, FALSE, '', $token); wp_set_auth_cookie( $user->ID, false, '', $token);
do_action( 'wp_login', $user->user_login, $user ); do_action( 'wp_login', $user->user_login, $user );
} }
@ -448,7 +448,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
*/ */
function save_refresh_token( $manager, $token, $token_response ) { function save_refresh_token( $manager, $token, $token_response ) {
$session = $manager->get($token); $session = $manager->get($token);
$now = current_time( 'timestamp' , TRUE ); $now = current_time( 'timestamp' , true );
$session[$this->cookie_token_refresh_key] = array( $session[$this->cookie_token_refresh_key] = array(
'next_access_token_refresh_time' => $token_response['expires_in'] + $now, 'next_access_token_refresh_time' => $token_response['expires_in'] + $now,
'refresh_token' => isset( $token_response[ 'refresh_token' ] ) ? $token_response[ 'refresh_token' ] : false, 'refresh_token' => isset( $token_response[ 'refresh_token' ] ) ? $token_response[ 'refresh_token' ] : false,
@ -667,7 +667,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
return new WP_Error( 'bad-user-claim-result', __( 'Bad user claim result' ), $user_claim_result ); return new WP_Error( 'bad-user-claim-result', __( 'Bad user claim result' ), $user_claim_result );
} }
$user_claim = json_decode( $user_claim_result['body'], TRUE ); $user_claim = json_decode( $user_claim_result['body'], true );
} }
$_email = $this->get_email_from_claim( $user_claim, true ); $_email = $this->get_email_from_claim( $user_claim, true );
@ -712,7 +712,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
// allow other plugins / themes to determine authorization // allow other plugins / themes to determine authorization
// of new accounts based on the returned user claim // of new accounts based on the returned user claim
$create_user = apply_filters( 'openid-connect-generic-user-creation-test', TRUE, $user_claim ); $create_user = apply_filters( 'openid-connect-generic-user-creation-test', true, $user_claim );
if ( ! $create_user ) { if ( ! $create_user ) {
return new WP_Error( 'cannot-authorize', __( 'Can not authorize.' ), $create_user ); return new WP_Error( 'cannot-authorize', __( 'Can not authorize.' ), $create_user );
@ -721,7 +721,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
$user_claim = apply_filters( 'openid-connect-generic-alter-user-claim', $user_claim ); $user_claim = apply_filters( 'openid-connect-generic-alter-user-claim', $user_claim );
$user_data = array( $user_data = array(
'user_login' => $username, 'user_login' => $username,
'user_pass' => wp_generate_password( 32, TRUE, TRUE ), 'user_pass' => wp_generate_password( 32, true, true ),
'user_email' => $email, 'user_email' => $email,
'display_name' => $displayname, 'display_name' => $displayname,
'nickname' => $nickname, 'nickname' => $nickname,
@ -742,7 +742,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
$user = get_user_by( 'id', $uid ); $user = get_user_by( 'id', $uid );
// save some meta data about this new user for the future // save some meta data about this new user for the future
add_user_meta( $user->ID, 'openid-connect-generic-subject-identity', (string) $subject_identity, TRUE ); add_user_meta( $user->ID, 'openid-connect-generic-subject-identity', (string) $subject_identity, true );
// log the results // log the results
$this->logger->log( "New user created: {$user->user_login} ($uid)", 'success' ); $this->logger->log( "New user created: {$user->user_login} ($uid)", 'success' );
@ -764,7 +764,7 @@ class OpenID_Connect_Generic_Client_Wrapper {
*/ */
function update_existing_user( $uid, $subject_identity ) { function update_existing_user( $uid, $subject_identity ) {
// add the OpenID Connect meta data // add the OpenID Connect meta data
add_user_meta( $uid, 'openid-connect-generic-subject-identity', (string) $subject_identity, TRUE ); add_user_meta( $uid, 'openid-connect-generic-subject-identity', (string) $subject_identity, true );
// allow plugins / themes to take action on user update // allow plugins / themes to take action on user update
do_action( 'openid-connect-generic-user-update', $uid ); do_action( 'openid-connect-generic-user-update', $uid );

@ -172,7 +172,7 @@ class OpenID_Connect_Generic_Client {
} }
// extract token response from token // extract token response from token
$token_response = json_decode( $token_result['body'], TRUE ); $token_response = json_decode( $token_result['body'], true );
if ( isset( $token_response[ 'error' ] ) ) { if ( isset( $token_response[ 'error' ] ) ) {
$error = $token_response[ 'error' ]; $error = $token_response[ 'error' ];
@ -254,7 +254,7 @@ class OpenID_Connect_Generic_Client {
*/ */
function check_state( $state ) { function check_state( $state ) {
$states = get_option( 'openid-connect-generic-valid-states', array() ); $states = get_option( 'openid-connect-generic-valid-states', array() );
$valid = FALSE; $valid = false;
// remove any expired states // remove any expired states
foreach ( $states as $code => $timestamp ) { foreach ( $states as $code => $timestamp ) {
@ -267,7 +267,7 @@ class OpenID_Connect_Generic_Client {
if ( isset( $states[ $state ] ) ) { if ( isset( $states[ $state ] ) ) {
// state is valid, remove it // state is valid, remove it
unset( $states[ $state ] ); unset( $states[ $state ] );
$valid = TRUE; $valid = true;
} }
// save our altered states // save our altered states
@ -324,7 +324,7 @@ class OpenID_Connect_Generic_Client {
$tmp[1] $tmp[1]
) )
) )
, TRUE , true
); );
return $id_token_claim; return $id_token_claim;
@ -366,7 +366,7 @@ class OpenID_Connect_Generic_Client {
return new WP_Error( 'bad-claim', __( 'Bad user claim' ), $user_claim_result ); return new WP_Error( 'bad-claim', __( 'Bad user claim' ), $user_claim_result );
} }
$user_claim = json_decode( $user_claim_result['body'], TRUE ); $user_claim = json_decode( $user_claim_result['body'], true );
return $user_claim; return $user_claim;
} }
@ -401,7 +401,7 @@ class OpenID_Connect_Generic_Client {
} }
// allow for other plugins to alter the login success // allow for other plugins to alter the login success
$login_user = apply_filters( 'openid-connect-generic-user-login-test', TRUE, $user_claim ); $login_user = apply_filters( 'openid-connect-generic-user-login-test', true, $user_claim );
if ( ! $login_user ) { if ( ! $login_user ) {
return new WP_Error( 'unauthorized', __( 'Unauthorized access' ), $login_user ); return new WP_Error( 'unauthorized', __( 'Unauthorized access' ), $login_user );

@ -68,7 +68,7 @@ class OpenID_Connect_Generic_Login_Form {
$redirect_expiry = current_time('timestamp') + DAY_IN_SECONDS; $redirect_expiry = current_time('timestamp') + DAY_IN_SECONDS;
// default redirect to the homepage // default redirect to the homepage
$redirect_url = home_url( esc_url( add_query_arg( NULL, NULL ) ) ); $redirect_url = home_url( esc_url( add_query_arg( null, null ) ) );
if ( $GLOBALS['pagenow'] == 'wp-login.php' ) { if ( $GLOBALS['pagenow'] == 'wp-login.php' ) {
// if using the login form, default redirect to the admin dashboard // if using the login form, default redirect to the admin dashboard

@ -175,7 +175,7 @@ class OpenID_Connect_Generic_Option_Logger {
private function save_logs( $logs ){ private function save_logs( $logs ){
// save our logs // save our logs
$this->logs = $logs; $this->logs = $logs;
return update_option( $this->option_name, $logs, FALSE ); return update_option( $this->option_name, $logs, false );
} }
/** /**

@ -273,7 +273,7 @@ class OpenID_Connect_Generic_Settings_Page {
foreach ( $this->settings_fields as $key => $field ) { foreach ( $this->settings_fields as $key => $field ) {
// make sure each key exists in the settings array // make sure each key exists in the settings array
if ( ! isset( $this->settings->{ $key } ) ) { if ( ! isset( $this->settings->{ $key } ) ) {
$this->settings->{ $key } = NULL; $this->settings->{ $key } = null;
} }
// determine appropriate output callback // determine appropriate output callback

Loading…
Cancel
Save