Making WordPress.org

Changeset 10139

Timestamp:
08/10/2020 07:54:50 AM (4 years ago)
Author:
dd32
Message:

Two Factor: PHP 7.4 compatibility.

This ensures that the class is compatible with that of which it extends.

Props xknown.
See https://github.com/WordPress/wordpress.org/pull/16

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/wporg-two-factor.php

    r6812 r10139  
    2727
    2828        if ( ! is_admin() ) {
    29             add_action( 'edit_user_profile', [ $this, 'user_two_factor_options' ] );
    30             add_action( 'show_user_profile', [ $this, 'user_two_factor_options' ] );
     29            add_action( 'edit_user_profile', [ , 'user_two_factor_options' ] );
     30            add_action( 'show_user_profile', [ , 'user_two_factor_options' ] );
    3131        }
    3232
     
    3939        remove_action( 'login_form_backup_2fa',   [ 'Two_Factor_Core', 'backup_2fa' ] );
    4040
    41         add_action( 'wp_login',                [ $this, 'wp_login' ], 10, 2 );
    42         add_action( 'login_form_validate_2fa', [ $this, 'login_form_validate_2fa' ] );
    43         add_action( 'login_form_backup_2fa',   [ $this, 'backup_2fa' ] );
     41        add_action( 'wp_login',                [ , 'wp_login' ], 10, 2 );
     42        add_action( 'login_form_validate_2fa', [ , 'login_form_validate_2fa' ] );
     43        add_action( 'login_form_backup_2fa',   [ , 'backup_2fa' ] );
    4444
    4545    }
     
    112112
    113113        // At this point we know they have a 2FA account, were already logged in, and had a 2FA cookie
    114         $this->set_2fa_cookies( get_userdata( $user_id ), $expire );
     114        set_2fa_cookies( get_userdata( $user_id ), $expire );
    115115    }
    116116
     
    121121    }
    122122
    123     function set_2fa_cookies( $user, $expiration = false ) {
     123    function set_2fa_cookies( $user, $expiration = false ) {
    124124        if ( ! $expiration ) {
    125125            // Set the Expiration based on the main Authentication cookie
     
    194194        }
    195195
    196         $this->set_2fa_cookies( $user );
     196        set_2fa_cookies( $user );
    197197
    198198        // Must be global because that's how login_header() uses it.
     
    375375        if ( $result && $user_id == get_current_user_id() ) {
    376376            $user = wp_get_current_user();
    377             $this->set_2fa_cookies( $user );
     377            set_2fa_cookies( $user );
    378378        }
    379379
Note: See TracChangeset for help on using the changeset viewer.