Make WordPress Core

Changeset 13884


Ignore:
Timestamp:
03/29/2010 09:45:31 PM (15 years ago)
Author:
ryan
Message:

Use network_*_url(). see #12736

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-activate.php

    r13384 r13884  
    4444
    4545        <h2><?php _e('Activation Key Required') ?></h2>
    46         <form name="activateform" id="activateform" method="post" action="<?php echo 'http://' . $current_site->domain . $current_site->path ?>wp-activate.php">
     46        <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
    4747            <p>
    4848                <label for="key"><?php _e('Activation Key:') ?></label>
     
    6565                <?php
    6666                if ( $signup->domain . $signup->path == '' ) {
    67                     printf(__('<p class="lead-in">Your account has been activated. You may now <a href="%1$s">login</a> to the site using your chosen username of "%2$s".  Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.</p>'), 'http://' . $current_site->domain . $current_site->path . 'wp-login.php', $signup->user_login, $signup->user_email, 'http://' . $current_site->domain . $current_site->path . 'wp-login.php?action=lostpassword');
     67                    printf(__('<p class="lead-in">Your account has been activated. You may now <a href="%1$s">login</a> to the site using your chosen username of "%2$s".  Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.</p>'), network_site_url('wp-login.php', 'login'), $signup->user_login, $signup->user_email, network_site_url('wp-login.php?action=lostpassword', 'login'));
    6868                } else {
    69                     printf(__('<p class="lead-in">Your site at <a href="%1$s">%2$s</a> is active. You may now login to your site using your chosen username of "%3$s".  Please check your email inbox at %4$s for your password and login instructions.  If you do not receive an email, please check your junk or spam folder.  If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.</p>'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, 'http://' . $current_site->domain . $current_site->path . 'wp-login.php?action=lostpassword');
     69                    printf(__('<p class="lead-in">Your site at <a href="%1$s">%2$s</a> is active. You may now login to your site using your chosen username of "%3$s".  Please check your email inbox at %4$s for your password and login instructions.  If you do not receive an email, please check your junk or spam folder.  If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.</p>'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, network_site_url('wp-login.php?action=lostpassword'));
    7070                }
    7171            } else {
     
    8787            </div>
    8888
    89             <?php if ( $url != 'http://' . $current_site->domain . $current_site->path ) : ?>
     89            <?php if ( $url != network_home_url('', 'http') ) : ?>
    9090                <p class="view"><?php printf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Login</a>'), $url, $url . 'wp-login.php' ); ?></p>
    9191            <?php else: ?>
    92                 <p class="view"><?php printf( __( 'Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.' ), 'http://' . $current_site->domain . $current_site->path . 'wp-login.php', 'http://' . $current_site->domain . $current_site->path ); ?></p>
     92                <p class="view"><?php printf( __( 'Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
    9393            <?php endif;
    9494        }
  • trunk/wp-admin/includes/ms.php

    r13835 r13884  
    250250
    251251function update_option_new_admin_email($old_value, $value) {
    252     global $current_site;
    253252    if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
    254253        return;
     
    277276###SITEURL###"), $new_admin_email );
    278277
    279     $content = str_replace('###ADMIN_URL###', esc_url(get_option( "siteurl" ).'/wp-admin/options.php?adminhash='.$hash), $content);
     278    $content = str_replace('###ADMIN_URL###', esc_url(admin_url('options.php?adminhash='.$hash)), $content);
    280279    $content = str_replace('###EMAIL###', $value, $content);
    281280    $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
    282     $content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);
     281    $content = str_replace('###SITEURL###', network_home_url(), $content);
    283282
    284283    wp_mail( $value, sprintf(__('[%s] New Admin Email Address'), get_option('blogname')), $content );
     
    287286
    288287function send_confirmation_on_profile_email() {
    289     global $errors, $wpdb, $current_user, $current_site;
     288    global $errors, $wpdb, $current_user;
    290289    if ( ! is_object($errors) )
    291290        $errors = new WP_Error();
     
    328327###SITEURL###"), $new_user_email );
    329328
    330         $content = str_replace('###ADMIN_URL###', esc_url(get_option( "siteurl" ).'/wp-admin/profile.php?newuseremail='.$hash), $content);
     329        $content = str_replace('###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail='.$hash)), $content);
    331330        $content = str_replace('###EMAIL###', $_POST[ 'email' ], $content);
    332331        $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
    333         $content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);
     332        $content = str_replace('###SITEURL###', network_home_url(), $content);
    334333
    335334        wp_mail( $_POST[ 'email' ], sprintf(__('[%s] New Email Address'), get_option('blogname')), $content );
     
    535534
    536535function redirect_user_to_blog() {
    537     global $current_user, $current_site;
     536    global $current_user;
    538537    $c = 0;
    539538    if ( isset( $_GET[ 'c' ] ) )
     
    548547    $dashboard_blog = get_dashboard_blog();
    549548    if ( is_object( $blog ) ) {
    550         $protocol = ( is_ssl() ? 'https://' : 'http://' );
    551         wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
     549        wp_redirect( get_admin_url($blog->blog_id, '?c=' . $c) ); // redirect and count to 5, "just in case"
    552550        exit;
    553551    }
  • trunk/wp-admin/ms-options.php

    r13796 r13884  
    8585                <td><input name="admin_notice_feed" class="large-text" type="text" id="admin_notice_feed" value="<?php echo esc_attr( get_site_option( 'admin_notice_feed' ) ) ?>" size="80" /><br />
    8686                <?php _e( 'Display the latest post from this RSS or Atom feed on all site dashboards. Leave blank to disable.' ); ?><br />
    87                 <?php if ( get_site_option( 'admin_notice_feed' ) != 'http://' . $current_site->domain . $current_site->path . 'feed/' )
    88                     echo __( "A good one to use would be the feed from your main site: " ) . 'http://' . $current_site->domain . $current_site->path . 'feed/'; ?></td>
     87                <?php if ( get_site_option( 'admin_notice_feed' ) != network_home_url('feed/', 'http') )
     88                    echo __( "A good one to use would be the feed from your main site: " ) . network_home_url('feed/'); ?></td>
    8989            </tr>
    9090        </table>
  • trunk/wp-includes/link-template.php

    r13882 r13884  
    20382038function network_site_url( $path = '', $scheme = null ) {
    20392039    global $current_site;
     2040
     2041    if ( !is_multisite() )
     2042        return site_url($path, $scheme);
     2043
    20402044    $orig_scheme = $scheme;
    20412045    if ( !in_array($scheme, array('http', 'https')) ) {
     
    20762080function network_home_url( $path = '', $scheme = null ) {
    20772081    global $current_site;
     2082
     2083    if ( !is_multisite() )
     2084        return home_url($path, $scheme);
     2085
    20782086    $orig_scheme = $scheme;
    20792087
  • trunk/wp-includes/ms-functions.php

    r13715 r13884  
    675675    // Send email with activation link.
    676676    if ( !is_subdomain_install() || $current_site->id != 1 )
    677         $activate_url = "http://" . $current_site->domain . $current_site->path . "wp-activate.php?key=$key";
     677        $activate_url = network_site_url("wp-activate.php?key=$key");
    678678    else
    679         $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key";
     679        $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
    680680
    681681    $activate_url = esc_url($activate_url);
     
    842842
    843843function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
    844     global $current_site;
    845844    if ( get_site_option( 'registrationnotification' ) != 'yes' )
    846845        return false;
     
    850849        return false;
    851850
    852     $options_site_url = esc_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
     851    $options_site_url = esc_url(network_admin_url('ms-options.php'));
    853852
    854853    switch_to_blog( $blog_id );
    855854    $blogname = get_option( 'blogname' );
    856     $siteurl = get_option( 'siteurl' );
     855    $siteurl = site_url();
    857856    restore_current_blog();
    858857
     
    869868
    870869function newuser_notify_siteadmin( $user_id ) {
    871     global $current_site;
    872 
    873870    if ( get_site_option( 'registrationnotification' ) != 'yes' )
    874871        return false;
     
    881878    $user = new WP_User($user_id);
    882879
    883     $options_site_url = esc_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
     880    $options_site_url = esc_url(network_admin_url('ms-options.php'));
    884881    $msg = sprintf(__("New User: %1s
    885882Remote IP: %2s
     
    12791276    if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = NOBLOGREDIRECT ) ) {
    12801277        if ( $destination == '%siteurl%' )
    1281             $destination = $current_site->domain . $current_site->path;
     1278            $destination = network_home_url();
    12821279        wp_redirect( $destination );
    12831280        exit();
  • trunk/wp-login.php

    r13490 r13884  
    8686<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
    8787<?php   } else { ?>
    88 <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
     88<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', network_home_url() ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
    8989<?php   }
    9090
     
    185185    }
    186186    $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
    187         if ( !is_multisite() )
    188             $message .= get_option('siteurl') . "\r\n\r\n";
    189         else
    190                 $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "\r\n\r\n";
     187    $message .= network_site_url() . "\r\n\r\n";
    191188    $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    192189    $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
    193         if ( !is_multisite() )
    194             $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
    195         else
    196             $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login) . "\r\n";
     190    $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
    197191
    198192    if ( is_multisite() )
Note: See TracChangeset for help on using the changeset viewer.