Make WordPress Core

Ticket #31495: 31495.patch

File 31495.patch, 7.0 KB (added by GregLone, 10 years ago)

Replace some site_url( 'wp-login.php' ) with wp_login_url() and friends

  • wp-activate.php

     
    1414require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    1515
    1616if ( !is_multisite() ) {
    17         wp_redirect( site_url( '/wp-login.php?action=register' ) );
     17        wp_redirect( wp_registration_url() );
    1818        die();
    1919}
    2020
     
    107107                } else {
    108108                        $url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : '';
    109109                        $user = get_userdata( (int) $result['user_id'] );
     110                        switch_to_blog( (int) $result['blog_id'] );
     111                        $login_url = wp_login_url();
     112                        restore_current_blog();
    110113                        ?>
    111114                        <h2><?php _e('Your account is now active!'); ?></h2>
    112115
     
    116119                        </div>
    117120
    118121                        <?php if ( $url && $url != network_home_url( '', 'http' ) ) : ?>
    119                                 <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php' ); ?></p>
     122                                <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, esc_url( $login_url ) ); ?></p>
    120123                        <?php else: ?>
    121124                                <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
    122125                        <?php endif;
  • wp-admin/install.php

     
    156156// Let's check to make sure WP isn't already installed.
    157157if ( is_blog_installed() ) {
    158158        display_header();
    159         die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p><p class="step"><a href="../wp-login.php" class="button button-large">' . __( 'Log In' ) . '</a></p></body></html>' );
     159        die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p><p class="step"><a href="' . esc_url( wp_login_url() ) . '" class="button button-large">' . __( 'Log In' ) . '</a></p></body></html>' );
    160160}
    161161
    162162global $wp_version, $required_php_version, $required_mysql_version;
     
    291291        </tr>
    292292</table>
    293293
    294 <p class="step"><a href="../wp-login.php" class="button button-large"><?php _e( 'Log In' ); ?></a></p>
     294<p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>" class="button button-large"><?php _e( 'Log In' ); ?></a></p>
    295295
    296296<?php
    297297                }
  • wp-admin/network.php

     
    526526        <?php endif; // end IIS/Apache code branches.
    527527
    528528        if ( !is_multisite() ) { ?>
    529                 <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p>
     529                <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p>
    530530<?php
    531531        }
    532532}
  • wp-includes/canonical.php

     
    319319                                /** This filter is documented in wp-login.php */
    320320                                $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
    321321                        } else {
    322                                 $redirect_url = site_url( 'wp-login.php?action=register' );
     322                                $redirect_url = wp_registration_url();
    323323                        }
    324324
    325325                        wp_redirect( $redirect_url, 301 );
     
    576576                site_url( 'login', 'relative' ),
    577577        );
    578578        if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
    579                 wp_redirect( site_url( 'wp-login.php', 'login' ) );
     579                wp_redirect( wp_login_url() );
    580580                exit;
    581581        }
    582582}
  • wp-signup.php

     
    2828add_action( 'wp_head', 'do_signup_header' );
    2929
    3030if ( !is_multisite() ) {
    31         wp_redirect( site_url('wp-login.php?action=register') );
     31        wp_redirect( wp_registration_url() );
    3232        die();
    3333}
    3434
     
    353353         */
    354354        $meta = apply_filters( 'add_signup_meta', $meta_defaults );
    355355
    356         wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
    357         confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
     356        $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
     357
     358        if ( is_wp_error( $blog_id ) ) {
     359                return false;
     360        }
     361
     362        confirm_another_blog_signup( $domain, $path, $blog_title, $blog_id, $current_user->user_login );
    358363        return true;
    359364}
    360365
     
    365370 *
    366371 * @param string $domain The domain URL
    367372 * @param string $path The site root path
     373 * @param string $blog_title The blog title
     374 * @param string $blog_id The blog ID
    368375 * @param string $user_name The username
    369  * @param string $user_email The user's email address
    370  * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
    371376 */
    372 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) {
     377function confirm_another_blog_signup( $domain, $path, $blog_title, $blog_id, $user_name ) {
     378        switch_to_blog( $blog_id );
     379        $login_url = wp_login_url();
     380        restore_current_blog();
    373381        ?>
    374         <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
     382        <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ); ?></h2>
    375383        <p>
    376                 <?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?>
     384                <?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, $login_url, $user_name ); ?>
    377385        </p>
    378386        <?php
    379387        /**
     
    669677if ( $active_signup == 'none' ) {
    670678        _e( 'Registration has been disabled.' );
    671679} elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
    672         $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) );
     680        $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
    673681        echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
    674682} else {
    675683        $stage = isset( $_POST['stage'] ) ?  $_POST['stage'] : 'default';