Making WordPress.org

Ticket #3108: 3108.diff

File 3108.diff, 1.7 KB (added by obenland, 7 years ago)
  • wp-content/mu-plugins/wporg-sso/class-wporg-sso.php

     
    6161                /**
    6262                 * Returns the SSO login URL, with redirect_to as requested, if deemed valid.
    6363                 *
    64                  * @param string $redirect_to
    65                  * @param string $filter_redirect_to When used with the WP login_url filter, the redirect_to is passed as a 2nd arg instead.
     64                 * @param string $login_url The login URL. Not HTML-encoded.
     65                 * @param string $redirect  The path to redirect to on login, if supplied.
    6666                 * @return string
    67                  *
    68                  * @example Use directly, or through add_action( 'login_url', array( &$wporg_sso, 'login_url' ), 10, 2 );
    6967                 */
    70                 public function login_url( $redirect_to = '', $filter_redirect_to = '' ) {
     68                public function login_url( $login_url, $redirect ) {
    7169                        $login_url = $this->sso_login_url;
    72                         // If 2nd arg is passed, then redirect_to is it.
    73                         if ( ! empty( $filter_redirect_to ) ) {
    74                                 $redirect_to = $filter_redirect_to;
    75                         }
    76                         if ( ! empty( $redirect_to ) && $this->_is_valid_targeted_domain( $redirect_to ) ) {
    77                                 $redirect_to = preg_replace( '/\/wp-(login|signup)\.php\??.*$/', '/', $redirect_to );
    78                                 $login_url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $login_url );
     70
     71                        if ( ! empty( $redirect ) && $this->_is_valid_targeted_domain( $redirect ) ) {
     72                                $redirect  = preg_replace( '/\/wp-(login|signup)\.php\??.*$/', '/', $redirect );
     73                                $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
    7974                        }
    80                         return $login_url;
    8175
     76                        return $login_url;
    8277                }
    8378
    8479                /**