Making WordPress.org

Changeset 6801


Ignore:
Timestamp:
02/28/2018 01:44:53 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: In ::fix_login_url():

  • Only adjust the login URL for Single Sign-On (SSO) plugin if the plugin is active, use the normal redirect_to method otherwise.
  • Use $_SERVER['HTTP_HOST'] instead of hardcoded wordpress.org domain.

Merges [4944] from support forums.
See #3108.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r6592 r6801  
    886886                        // parse_url is used here to remove any additional query args from the REQUEST_URI before redirection
    887887                        // The SSO code handles the urlencoding of the redirect_to parameter
    888                         $url_parts       = parse_url( 'https://wordpress.org' . $_SERVER['REQUEST_URI'] );
     888                        $url_parts       = parse_url( set_url_scheme( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) );
    889889                        $constructed_url = $url_parts['scheme'] . '://' . $url_parts['host'] . ( isset( $url_parts['path'] ) ? $url_parts['path'] : '' );
    890                         $login_url       = $constructed_url;
     890
     891                        if ( class_exists( 'WPOrg_SSO' ) ) {
     892                                $login_url = $constructed_url;
     893                        } else {
     894                                $login_url = add_query_arg( 'redirect_to', urlencode( $constructed_url ), $login_url );
     895                        }
    891896                }
    892897                return $login_url;
Note: See TracChangeset for help on using the changeset viewer.