Use network_*_url(). see #12736
git-svn-id: http://svn.automattic.com/wordpress/trunk@13884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fbf3ee6abc
commit
8e4859a35c
|
@ -43,7 +43,7 @@ get_header();
|
|||
<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
|
||||
|
||||
<h2><?php _e('Activation Key Required') ?></h2>
|
||||
<form name="activateform" id="activateform" method="post" action="<?php echo 'http://' . $current_site->domain . $current_site->path ?>wp-activate.php">
|
||||
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
|
||||
<p>
|
||||
<label for="key"><?php _e('Activation Key:') ?></label>
|
||||
<br /><input type="text" name="key" id="key" value="" size="50" />
|
||||
|
@ -64,9 +64,9 @@ get_header();
|
|||
<h2><?php _e('Your account is now active!'); ?></h2>
|
||||
<?php
|
||||
if ( $signup->domain . $signup->path == '' ) {
|
||||
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');
|
||||
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'));
|
||||
} else {
|
||||
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');
|
||||
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'));
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
|
@ -86,10 +86,10 @@ get_header();
|
|||
<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
|
||||
</div>
|
||||
|
||||
<?php if ( $url != 'http://' . $current_site->domain . $current_site->path ) : ?>
|
||||
<?php if ( $url != network_home_url('', 'http') ) : ?>
|
||||
<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>
|
||||
<?php else: ?>
|
||||
<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>
|
||||
<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>
|
||||
<?php endif;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,6 @@ function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
|
|||
}
|
||||
|
||||
function update_option_new_admin_email($old_value, $value) {
|
||||
global $current_site;
|
||||
if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
|
||||
return;
|
||||
|
||||
|
@ -276,17 +275,17 @@ Regards,
|
|||
All at ###SITENAME###
|
||||
###SITEURL###"), $new_admin_email );
|
||||
|
||||
$content = str_replace('###ADMIN_URL###', esc_url(get_option( "siteurl" ).'/wp-admin/options.php?adminhash='.$hash), $content);
|
||||
$content = str_replace('###ADMIN_URL###', esc_url(admin_url('options.php?adminhash='.$hash)), $content);
|
||||
$content = str_replace('###EMAIL###', $value, $content);
|
||||
$content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
|
||||
$content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);
|
||||
$content = str_replace('###SITEURL###', network_home_url(), $content);
|
||||
|
||||
wp_mail( $value, sprintf(__('[%s] New Admin Email Address'), get_option('blogname')), $content );
|
||||
}
|
||||
add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2);
|
||||
|
||||
function send_confirmation_on_profile_email() {
|
||||
global $errors, $wpdb, $current_user, $current_site;
|
||||
global $errors, $wpdb, $current_user;
|
||||
if ( ! is_object($errors) )
|
||||
$errors = new WP_Error();
|
||||
|
||||
|
@ -327,10 +326,10 @@ Regards,
|
|||
All at ###SITENAME###
|
||||
###SITEURL###"), $new_user_email );
|
||||
|
||||
$content = str_replace('###ADMIN_URL###', esc_url(get_option( "siteurl" ).'/wp-admin/profile.php?newuseremail='.$hash), $content);
|
||||
$content = str_replace('###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail='.$hash)), $content);
|
||||
$content = str_replace('###EMAIL###', $_POST[ 'email' ], $content);
|
||||
$content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
|
||||
$content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);
|
||||
$content = str_replace('###SITEURL###', network_home_url(), $content);
|
||||
|
||||
wp_mail( $_POST[ 'email' ], sprintf(__('[%s] New Email Address'), get_option('blogname')), $content );
|
||||
$_POST[ 'email' ] = $current_user->user_email;
|
||||
|
@ -534,7 +533,7 @@ function sync_category_tag_slugs( $term, $taxonomy ) {
|
|||
add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
|
||||
|
||||
function redirect_user_to_blog() {
|
||||
global $current_user, $current_site;
|
||||
global $current_user;
|
||||
$c = 0;
|
||||
if ( isset( $_GET[ 'c' ] ) )
|
||||
$c = (int)$_GET[ 'c' ];
|
||||
|
@ -547,8 +546,7 @@ function redirect_user_to_blog() {
|
|||
$blog = get_active_blog_for_user( $current_user->ID );
|
||||
$dashboard_blog = get_dashboard_blog();
|
||||
if ( is_object( $blog ) ) {
|
||||
$protocol = ( is_ssl() ? 'https://' : 'http://' );
|
||||
wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
|
||||
wp_redirect( get_admin_url($blog->blog_id, '?c=' . $c) ); // redirect and count to 5, "just in case"
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ if (isset($_GET['updated'])) {
|
|||
<th scope="row"><label for="admin_notice_feed"><?php _e('Admin Notice Feed') ?></label></th>
|
||||
<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 />
|
||||
<?php _e( 'Display the latest post from this RSS or Atom feed on all site dashboards. Leave blank to disable.' ); ?><br />
|
||||
<?php if ( get_site_option( 'admin_notice_feed' ) != 'http://' . $current_site->domain . $current_site->path . 'feed/' )
|
||||
echo __( "A good one to use would be the feed from your main site: " ) . 'http://' . $current_site->domain . $current_site->path . 'feed/'; ?></td>
|
||||
<?php if ( get_site_option( 'admin_notice_feed' ) != network_home_url('feed/', 'http') )
|
||||
echo __( "A good one to use would be the feed from your main site: " ) . network_home_url('feed/'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3><?php _e('Registration Settings'); ?></h3>
|
||||
|
|
|
@ -2037,6 +2037,10 @@ function plugins_url($path = '', $plugin = '') {
|
|||
*/
|
||||
function network_site_url( $path = '', $scheme = null ) {
|
||||
global $current_site;
|
||||
|
||||
if ( !is_multisite() )
|
||||
return site_url($path, $scheme);
|
||||
|
||||
$orig_scheme = $scheme;
|
||||
if ( !in_array($scheme, array('http', 'https')) ) {
|
||||
if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
|
||||
|
@ -2075,6 +2079,10 @@ function network_site_url( $path = '', $scheme = null ) {
|
|||
*/
|
||||
function network_home_url( $path = '', $scheme = null ) {
|
||||
global $current_site;
|
||||
|
||||
if ( !is_multisite() )
|
||||
return home_url($path, $scheme);
|
||||
|
||||
$orig_scheme = $scheme;
|
||||
|
||||
if ( !in_array($scheme, array('http', 'https')) )
|
||||
|
|
|
@ -674,9 +674,9 @@ function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_emai
|
|||
|
||||
// Send email with activation link.
|
||||
if ( !is_subdomain_install() || $current_site->id != 1 )
|
||||
$activate_url = "http://" . $current_site->domain . $current_site->path . "wp-activate.php?key=$key";
|
||||
$activate_url = network_site_url("wp-activate.php?key=$key");
|
||||
else
|
||||
$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key";
|
||||
$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
|
||||
|
||||
$activate_url = esc_url($activate_url);
|
||||
$admin_email = get_site_option( "admin_email" );
|
||||
|
@ -841,7 +841,6 @@ function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id
|
|||
}
|
||||
|
||||
function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
|
||||
global $current_site;
|
||||
if ( get_site_option( 'registrationnotification' ) != 'yes' )
|
||||
return false;
|
||||
|
||||
|
@ -849,11 +848,11 @@ function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
|
|||
if ( is_email($email) == false )
|
||||
return false;
|
||||
|
||||
$options_site_url = esc_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
|
||||
$options_site_url = esc_url(network_admin_url('ms-options.php'));
|
||||
|
||||
switch_to_blog( $blog_id );
|
||||
$blogname = get_option( 'blogname' );
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
$siteurl = site_url();
|
||||
restore_current_blog();
|
||||
|
||||
$msg = sprintf( __( "New Blog: %1s
|
||||
|
@ -868,8 +867,6 @@ Disable these notifications: %4s"), $blogname, $siteurl, $_SERVER['REMOTE_ADDR']
|
|||
}
|
||||
|
||||
function newuser_notify_siteadmin( $user_id ) {
|
||||
global $current_site;
|
||||
|
||||
if ( get_site_option( 'registrationnotification' ) != 'yes' )
|
||||
return false;
|
||||
|
||||
|
@ -880,7 +877,7 @@ function newuser_notify_siteadmin( $user_id ) {
|
|||
|
||||
$user = new WP_User($user_id);
|
||||
|
||||
$options_site_url = esc_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
|
||||
$options_site_url = esc_url(network_admin_url('ms-options.php'));
|
||||
$msg = sprintf(__("New User: %1s
|
||||
Remote IP: %2s
|
||||
|
||||
|
@ -1278,7 +1275,7 @@ function maybe_redirect_404() {
|
|||
global $current_site;
|
||||
if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = NOBLOGREDIRECT ) ) {
|
||||
if ( $destination == '%siteurl%' )
|
||||
$destination = $current_site->domain . $current_site->path;
|
||||
$destination = network_home_url();
|
||||
wp_redirect( $destination );
|
||||
exit();
|
||||
}
|
||||
|
|
12
wp-login.php
12
wp-login.php
|
@ -85,7 +85,7 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
|
|||
<?php if ( !is_multisite() ) { ?>
|
||||
<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>
|
||||
<?php } else { ?>
|
||||
<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>
|
||||
<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>
|
||||
<?php }
|
||||
|
||||
$message = apply_filters('login_message', $message);
|
||||
|
@ -184,16 +184,10 @@ function retrieve_password() {
|
|||
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
|
||||
}
|
||||
$message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
|
||||
if ( !is_multisite() )
|
||||
$message .= get_option('siteurl') . "\r\n\r\n";
|
||||
else
|
||||
$message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "\r\n\r\n";
|
||||
$message .= network_site_url() . "\r\n\r\n";
|
||||
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
||||
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
|
||||
if ( !is_multisite() )
|
||||
$message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
|
||||
else
|
||||
$message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login) . "\r\n";
|
||||
$message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
|
||||
|
||||
if ( is_multisite() )
|
||||
$blogname = $GLOBALS['current_site']->site_name;
|
||||
|
|
Loading…
Reference in New Issue