Make WordPress Core

Ticket #19898: 19898.4.diff

File 19898.4.diff, 2.9 KB (added by scribu, 12 years ago)
  • wp-includes/general-template.php

    diff --git wp-includes/general-template.php wp-includes/general-template.php
    index 939e9de..7c10c58 100644
    function wp_loginout($redirect = '', $echo = true) { 
    197197}
    198198
    199199/**
     200 * Returns the user registration URL
     201 *
     202 * Returns the URL that allows the user to log in to the site
     203 *
     204 * @since 3.5.0
     205 * @uses site_url() To generate the log in URL
     206 * @uses apply_filters() calls 'register_url' hook on final url
     207 *
     208 * @return string
     209 */
     210function wp_register_url($redirect = '') {
     211        if ( is_multisite() )
     212                return apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
     213
     214        return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ), $redirect );
     215}
     216
     217/**
    200218 * Returns the Log Out URL.
    201219 *
    202220 * Returns the URL that allows the user to log out of the site
    function wp_login_url($redirect = '', $force_reauth = false) { 
    247265}
    248266
    249267/**
     268 * Return the full URL of the current page
     269 *
     270 * @since 3.5.0
     271 *
     272 * @return string
     273 */
     274function get_current_url() {
     275        return set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
     276}
     277
     278/**
     279 * Whether the current request is for a login page
     280 *
     281 * @since 3.5.0
     282 *
     283 * @return bool
     284 */
     285function is_login_page() {
     286        $current_url = remove_query_arg( array( 'redirect_to', 'reauth', 'loggedout', 'action' ), get_current_url() );
     287
     288        return wp_login_url() == $current_url;
     289}
     290
     291/**
     292 * Whether the current request is for the registration page
     293 *
     294 * @since 3.5.0
     295 *
     296 * @return bool
     297 */
     298function is_register_page() {
     299        $current_url = remove_query_arg( array( 'action', 'redirect_to', 'loggedout', ), get_current_url() );
     300
     301        $register_url = remove_query_arg( array( 'action' ), wp_register_url() );
     302
     303        return $current_url == $register_url;
     304}
     305
     306/**
    250307 * Provides a simple login form for use anywhere within WordPress. By default, it echoes
    251308 * the HTML immediately. Pass array('echo'=>false) to return the string instead.
    252309 *
    function wp_register( $before = '<li>', $after = '</li>', $echo = true ) { 
    338395
    339396        if ( ! is_user_logged_in() ) {
    340397                if ( get_option('users_can_register') )
    341                         $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
     398                        $link = $before . '<a href="' . wp_register_url() . '">' . __('Register') . '</a>' . $after;
    342399                else
    343400                        $link = '';
    344401        } else {
  • wp-login.php

    diff --git wp-login.php wp-login.php
    index 842cd31..673148d 100644
    case 'rp' : 
    507507<p id="nav">
    508508<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
    509509<?php if ( get_option( 'users_can_register' ) ) : ?>
    510  | <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a>
     510 | <a href="<?php echo esc_url( wp_register_url() ); ?>"><?php _e( 'Register' ); ?></a>
    511511<?php endif; ?>
    512512</p>
    513513