Ticket #25158: 25158.diff
File 25158.diff, 37.1 KB (added by , 12 years ago) |
---|
-
src/wp-admin/admin-header.php
12 12 13 13 // In case admin-header.php is included in a function. 14 14 global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version, 15 $ current_site, $update_title, $total_update_count, $parent_file;15 $update_title, $total_update_count, $parent_file; 16 16 17 17 // Catch plugins that include admin-header.php before admin.php completes. 18 18 if ( empty( $current_screen ) ) … … 22 22 $title = esc_html( strip_tags( $title ) ); 23 23 24 24 if ( is_network_admin() ) 25 $admin_title = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) );25 $admin_title = sprintf( __('Network Admin: %s'), esc_html( get_current_site()->site_name ) ); 26 26 elseif ( is_user_admin() ) 27 $admin_title = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) );27 $admin_title = sprintf( __('Global Dashboard: %s'), esc_html( get_current_site()->site_name ) ); 28 28 else 29 29 $admin_title = get_bloginfo( 'name' ); 30 30 -
src/wp-admin/import.php
102 102 esc_attr__('Install importer') . '">' . $data[0] . '</a>'; 103 103 } else { 104 104 $action = $data[0]; 105 $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) );105 $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( get_current_site()->blog_id, 'import.php' ) ); 106 106 } 107 107 } 108 108 } else { -
src/wp-admin/includes/class-wp-ms-sites-list-table.php
21 21 } 22 22 23 23 function prepare_items() { 24 global $s, $mode, $wpdb , $current_site;24 global $s, $mode, $wpdb; 25 25 26 26 $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode']; 27 27 … … 69 69 if ( is_numeric($s) && empty( $wild ) ) { 70 70 $query .= " AND ( {$wpdb->blogs}.blog_id = '{$like_s}' )"; 71 71 } elseif ( is_subdomain_install() ) { 72 $blog_s = str_replace( '.' . $current_site->domain, '', $like_s );73 $blog_s .= $wild . '.' . $current_site->domain;72 $blog_s = str_replace( '.' . get_current_site()->domain, '', $like_s ); 73 $blog_s .= $wild . '.' . get_current_site()->domain; 74 74 $query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ) "; 75 75 } else { 76 if ( $like_s != trim('/', $current_site->path) )77 $blog_s = $current_site->path . $like_s . $wild . '/';76 if ( $like_s != trim('/', get_current_site()->path) ) 77 $blog_s = get_current_site()->path . $like_s . $wild . '/'; 78 78 else 79 79 $blog_s = $like_s; 80 80 $query .= " AND ( {$wpdb->blogs}.path LIKE '$blog_s' )"; … … 168 168 } 169 169 170 170 function display_rows() { 171 global $ current_site, $mode;171 global $mode; 172 172 173 173 $status_list = array( 174 174 'archived' => array( 'site-archived', __( 'Archived' ) ), … … 202 202 } 203 203 echo "<tr class='$class'>"; 204 204 205 $blogname = ( is_subdomain_install() ) ? str_replace( '.'. $current_site->domain, '', $blog['domain'] ) : $blog['path'];205 $blogname = ( is_subdomain_install() ) ? str_replace( '.'.get_current_site()->domain, '', $blog['domain'] ) : $blog['path']; 206 206 207 207 list( $columns, $hidden ) = $this->get_column_info(); 208 208 … … 251 251 252 252 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 253 253 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 254 if ( $current_site->blog_id != $blog['blog_id'] ) {254 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 255 255 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' ) 256 256 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>'; 257 257 else -
src/wp-admin/includes/class-wp-ms-users-list-table.php
133 133 } 134 134 135 135 function display_rows() { 136 global $ current_site, $mode;136 global $mode; 137 137 138 138 $alt = ''; 139 139 $super_admins = get_super_admins(); … … 223 223 224 224 $path = ( $val->path == '/' ) ? '' : $val->path; 225 225 echo '<span class="site-' . $val->site_id . '" >'; 226 echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';226 echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_current_site()->domain, '', $val->domain . $path ) . '</a>'; 227 227 echo ' <small class="row-actions">'; 228 228 $actions = array(); 229 229 $actions['edit'] = '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a>'; -
src/wp-admin/includes/ms.php
52 52 * @return void 53 53 */ 54 54 function wpmu_delete_blog( $blog_id, $drop = false ) { 55 global $wpdb , $current_site;55 global $wpdb; 56 56 57 57 $switch = false; 58 58 if ( get_current_blog_id() != $blog_id ) { … … 76 76 update_blog_status( $blog_id, 'deleted', 1 ); 77 77 78 78 // Don't destroy the initial, main, or root blog. 79 if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) )79 if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == get_current_site()->path && $blog->domain == get_current_site()->domain ) ) ) 80 80 $drop = false; 81 81 82 82 if ( $drop ) { -
src/wp-admin/includes/schema.php
323 323 * @uses $wp_db_version 324 324 */ 325 325 function populate_options() { 326 global $wpdb, $wp_db_version, $ current_site, $wp_current_db_version;326 global $wpdb, $wp_db_version, $wp_current_db_version; 327 327 328 328 $guessurl = wp_guess_url(); 329 329 … … 487 487 // 3.0 multisite 488 488 if ( is_multisite() ) { 489 489 /* translators: blog tagline */ 490 $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), $current_site->site_name );490 $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name ); 491 491 $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/'; 492 492 } 493 493 -
src/wp-admin/includes/upgrade.php
101 101 * @param int $user_id User ID. 102 102 */ 103 103 function wp_install_defaults($user_id) { 104 global $wpdb, $wp_rewrite, $ current_site, $table_prefix;104 global $wpdb, $wp_rewrite, $table_prefix; 105 105 106 106 // Default category 107 107 $cat_name = __('Uncategorized'); … … 135 135 $first_post = __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ); 136 136 137 137 $first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post ); 138 $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );138 $first_post = str_replace( "SITE_NAME", get_current_site()->site_name, $first_post ); 139 139 } else { 140 140 $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'); 141 141 } -
src/wp-admin/ms-delete-site.php
19 19 if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { 20 20 if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { 21 21 wpmu_delete_blog( $wpdb->blogid ); 22 wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) );22 wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), get_current_site()->site_name ) ); 23 23 } else { 24 24 wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); 25 25 } … … 59 59 ###SITE_NAME###" ) ); 60 60 61 61 $content = str_replace( '###URL_DELETE###', $url_delete, $content ); 62 $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );62 $content = str_replace( '###SITE_NAME###', get_current_site()->site_name, $content ); 63 63 64 64 wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content ); 65 65 ?> … … 68 68 69 69 <?php } else { 70 70 ?> 71 <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p>71 <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), get_current_site()->site_name); ?></p> 72 72 <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> 73 73 74 74 <form method="post" name="deletedirect"> -
src/wp-admin/network/admin.php
15 15 if ( ! is_multisite() ) 16 16 wp_die( __( 'Multisite support is not enabled.' ) ); 17 17 18 $redirect_network_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );18 $redirect_network_admin_request = ( ( $current_blog->domain != get_current_site()->domain ) || ( $current_blog->path != get_current_site()->path ) ); 19 19 $redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request ); 20 20 if ( $redirect_network_admin_request ) { 21 21 wp_redirect( network_admin_url() ); -
src/wp-admin/network/settings.php
88 88 <tr valign="top"> 89 89 <th scope="row"><label for="site_name"><?php _e( 'Network Name' ) ?></label></th> 90 90 <td> 91 <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" />91 <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( get_current_site()->site_name ) ?>" /> 92 92 <br /> 93 93 <?php _e( 'What you would like to call this network.' ) ?> 94 94 </td> … … 99 99 <td> 100 100 <input name="admin_email" type="text" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option('admin_email') ) ?>" /> 101 101 <br /> 102 <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), $current_site->domain ); ?>102 <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), get_current_site()->domain ); ?> 103 103 </td> 104 104 </tr> 105 105 </table> -
src/wp-admin/network/site-new.php
61 61 wp_die( __( 'Invalid email address.' ) ); 62 62 63 63 if ( is_subdomain_install() ) { 64 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );65 $path = $current_site->path;64 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', get_current_site()->domain ); 65 $path = get_current_site()->path; 66 66 } else { 67 $newdomain = $current_site->domain;68 $path = $current_site->path . $domain . '/';67 $newdomain = get_current_site()->domain; 68 $path = get_current_site()->path . $domain . '/'; 69 69 } 70 70 71 71 $password = 'N/A'; … … 80 80 } 81 81 82 82 $wpdb->hide_errors(); 83 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );83 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), get_current_site()->id ); 84 84 $wpdb->show_errors(); 85 85 if ( !is_wp_error( $id ) ) { 86 86 if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) … … 89 89 90 90 Address: %2$s 91 91 Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $title ) ); 92 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );92 wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), get_current_site()->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); 93 93 wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); 94 94 wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); 95 95 exit; … … 126 126 <th scope="row"><?php _e( 'Site Address' ) ?></th> 127 127 <td> 128 128 <?php if ( is_subdomain_install() ) { ?> 129 <input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span>129 <input name="blog[domain]" type="text" class="regular-text" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_current_site()->domain ); ?></span> 130 130 <?php } else { 131 echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/>131 echo get_current_site()->domain . get_current_site()->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/> 132 132 <?php } 133 133 echo '<p>' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>'; 134 134 ?> -
src/wp-admin/network/sites.php
58 58 nocache_headers(); 59 59 header( 'Content-Type: text/html; charset=utf-8' ); 60 60 } 61 if ( $current_site->blog_id == $id )61 if ( get_current_site()->blog_id == $id ) 62 62 wp_die( __( 'You are not allowed to change the current site.' ) ); 63 63 ?> 64 64 <!DOCTYPE html> … … 106 106 wp_die( __( 'You do not have permission to access this page.' ) ); 107 107 108 108 $updated_action = 'not_deleted'; 109 if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {109 if ( $id != '0' && $id != get_current_site()->blog_id && current_user_can( 'delete_site', $id ) ) { 110 110 wpmu_delete_blog( $id, true ); 111 111 $updated_action = 'delete'; 112 112 } … … 117 117 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 118 118 119 119 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 120 if ( $val != '0' && $val != $current_site->blog_id ) {120 if ( $val != '0' && $val != get_current_site()->blog_id ) { 121 121 switch ( $doaction ) { 122 122 case 'delete': 123 123 if ( ! current_user_can( 'delete_site', $val ) ) -
src/wp-admin/network/users.php
146 146 $userfunction = 'all_spam'; 147 147 $blogs = get_blogs_of_user( $val, true ); 148 148 foreach ( (array) $blogs as $key => $details ) { 149 if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !149 if ( $details->userblog_id != get_current_site()->blog_id ) // main blog not a spam ! 150 150 update_blog_status( $details->userblog_id, 'spam', '1' ); 151 151 } 152 152 update_user_status( $val, 'spam', '1' ); -
src/wp-admin/user/admin.php
16 16 exit; 17 17 } 18 18 19 $redirect_user_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );19 $redirect_user_admin_request = ( ( $current_blog->domain != get_current_site()->domain ) || ( $current_blog->path != get_current_site()->path ) ); 20 20 $redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request ); 21 21 if ( $redirect_user_admin_request ) { 22 22 wp_redirect( user_admin_url() ); -
src/wp-includes/admin-bar.php
216 216 * @param WP_Admin_Bar $wp_admin_bar 217 217 */ 218 218 function wp_admin_bar_site_menu( $wp_admin_bar ) { 219 global $current_site;220 221 219 // Don't show for logged out users. 222 220 if ( ! is_user_logged_in() ) 223 221 return; … … 232 230 $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); 233 231 234 232 if ( is_network_admin() ) { 235 $blogname = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) );233 $blogname = sprintf( __('Network Admin: %s'), esc_html( get_current_site()->site_name ) ); 236 234 } elseif ( is_user_admin() ) { 237 $blogname = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) );235 $blogname = sprintf( __('Global Dashboard: %s'), esc_html( get_current_site()->site_name ) ); 238 236 } 239 237 240 238 $title = wp_html_excerpt( $blogname, 40, '…' ); -
src/wp-includes/class-wp-xmlrpc-server.php
459 459 * - 'xmlrpc' - url of xmlrpc endpoint 460 460 */ 461 461 function wp_getUsersBlogs( $args ) { 462 global $current_site;463 462 // If this isn't on WPMU then just use blogger_getUsersBlogs 464 463 if ( !is_multisite() ) { 465 464 array_unshift( $args, 1 ); … … 481 480 482 481 foreach ( $blogs as $blog ) { 483 482 // Don't include blogs that aren't hosted at this site 484 if ( $blog->site_id != $current_site->id )483 if ( $blog->site_id != get_current_site()->id ) 485 484 continue; 486 485 487 486 $blog_id = $blog->userblog_id; -
src/wp-includes/http.php
506 506 * @return bool 507 507 */ 508 508 function ms_allowed_http_request_hosts( $is_external, $host ) { 509 global $wpdb , $current_site;509 global $wpdb; 510 510 static $queried = array(); 511 511 if ( $is_external ) 512 512 return $is_external; 513 if ( $host === $current_site->domain )513 if ( $host === get_current_site()->domain ) 514 514 return true; 515 515 if ( isset( $queried[ $host ] ) ) 516 516 return $queried[ $host ]; -
src/wp-includes/link-template.php
2104 2104 * @return string Site url link with optional path appended. 2105 2105 */ 2106 2106 function network_site_url( $path = '', $scheme = null ) { 2107 global $current_site;2108 2109 2107 if ( ! is_multisite() ) 2110 2108 return site_url($path, $scheme); 2111 2109 2112 2110 if ( 'relative' == $scheme ) 2113 $url = $current_site->path;2111 $url = get_current_site()->path; 2114 2112 else 2115 $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );2113 $url = set_url_scheme( 'http://' . get_current_site()->domain . get_current_site()->path, $scheme ); 2116 2114 2117 2115 if ( $path && is_string( $path ) ) 2118 2116 $url .= ltrim( $path, '/' ); … … 2135 2133 * @return string Home url link with optional path appended. 2136 2134 */ 2137 2135 function network_home_url( $path = '', $scheme = null ) { 2138 global $current_site;2139 2140 2136 if ( ! is_multisite() ) 2141 2137 return home_url($path, $scheme); 2142 2138 … … 2146 2142 $scheme = is_ssl() && ! is_admin() ? 'https' : 'http'; 2147 2143 2148 2144 if ( 'relative' == $scheme ) 2149 $url = $current_site->path;2145 $url = get_current_site()->path; 2150 2146 else 2151 $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );2147 $url = set_url_scheme( 'http://' . get_current_site()->domain . get_current_site()->path, $scheme ); 2152 2148 2153 2149 if ( $path && is_string( $path ) ) 2154 2150 $url .= ltrim( $path, '/' ); -
src/wp-includes/ms-blogs.php
90 90 * @return int A blog id 91 91 */ 92 92 function get_id_from_blogname( $slug ) { 93 global $wpdb , $current_site;93 global $wpdb; 94 94 95 95 $slug = trim( $slug, '/' ); 96 96 … … 99 99 return $blog_id; 100 100 101 101 if ( is_subdomain_install() ) { 102 $domain = $slug . '.' . $current_site->domain;103 $path = $current_site->path;102 $domain = $slug . '.' . get_current_site()->domain; 103 $path = get_current_site()->path; 104 104 } else { 105 $domain = $current_site->domain;106 $path = $current_site->path . $slug . '/';105 $domain = get_current_site()->domain; 106 $path = get_current_site()->path . $slug . '/'; 107 107 } 108 108 109 109 $blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $domain, $path) ); -
src/wp-includes/ms-default-constants.php
45 45 * @since 3.0.0 46 46 */ 47 47 function ms_cookie_constants( ) { 48 global $current_site;49 50 48 /** 51 49 * @since 1.2.0 52 50 */ 53 51 if ( !defined( 'COOKIEPATH' ) ) 54 define( 'COOKIEPATH', $current_site->path );52 define( 'COOKIEPATH', get_current_site()->path ); 55 53 56 54 /** 57 55 * @since 1.5.0 58 56 */ 59 57 if ( !defined( 'SITECOOKIEPATH' ) ) 60 define( 'SITECOOKIEPATH', $current_site->path );58 define( 'SITECOOKIEPATH', get_current_site()->path ); 61 59 62 60 /** 63 61 * @since 2.6.0 … … 74 72 * @since 2.0.0 75 73 */ 76 74 if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) { 77 if ( !empty( $current_site->cookie_domain ) )78 define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);75 if ( !empty( get_current_site()->cookie_domain ) ) 76 define('COOKIE_DOMAIN', '.' . get_current_site()->cookie_domain); 79 77 else 80 define('COOKIE_DOMAIN', '.' . $current_site->domain);78 define('COOKIE_DOMAIN', '.' . get_current_site()->domain); 81 79 } 82 80 } 83 81 -
src/wp-includes/ms-functions.php
533 533 * @return array Contains the new site data and error messages. 534 534 */ 535 535 function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { 536 global $wpdb, $domain , $current_site;536 global $wpdb, $domain; 537 537 538 $base = $current_site->path;538 $base = get_current_site()->path; 539 539 540 540 $blog_title = strip_tags( $blog_title ); 541 541 $blog_title = substr( $blog_title, 0, 50 ); … … 567 567 $errors->add( 'blogname', __( 'Sorry, site names may not contain the character “_”!' ) ); 568 568 569 569 // do not allow users to create a blog that conflicts with a page on the main blog. 570 if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )570 if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( get_current_site()->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) 571 571 $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) ); 572 572 573 573 // all numeric? … … 589 589 $mydomain = "$domain"; 590 590 $path = $base.$blogname.'/'; 591 591 } 592 if ( domain_exists( $mydomain, $path, $current_site->id) )592 if ( domain_exists( $mydomain, $path, get_current_site()->id ) ) 593 593 $errors->add( 'blogname', __( 'Sorry, that site already exists!' ) ); 594 594 595 595 if ( username_exists( $blogname ) ) { … … 705 705 * @param string $key The activation key created in wpmu_signup_blog() 706 706 * @return bool 707 707 */ 708 function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = '') { 709 global $current_site; 710 708 function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = '' ) { 711 709 if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) ) 712 710 return false; 713 711 714 712 // Send email with activation link. 715 if ( !is_subdomain_install() || $current_site->id != 1 )713 if ( !is_subdomain_install() || get_current_site()->id != 1 ) 716 714 $activate_url = network_site_url("wp-activate.php?key=$key"); 717 715 else 718 716 $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API … … 1118 1116 * @param int $blog_id The value returned by insert_blog(). 1119 1117 * @param string $blog_title The title of the new site. 1120 1118 */ 1121 function install_blog( $blog_id, $blog_title = '') {1122 global $wpdb, $wp_roles , $current_site;1119 function install_blog( $blog_id, $blog_title = '' ) { 1120 global $wpdb, $wp_roles; 1123 1121 1124 1122 // Cast for security 1125 1123 $blog_id = (int) $blog_id; … … 1147 1145 if ( get_site_option( 'ms_files_rewriting' ) ) 1148 1146 update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); 1149 1147 else 1150 update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) );1148 update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) ); 1151 1149 1152 1150 update_option( 'blogname', wp_unslash( $blog_title ) ); 1153 1151 update_option( 'admin_email', '' ); … … 1200 1198 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. 1201 1199 * @return bool 1202 1200 */ 1203 function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = '') { 1204 global $current_site; 1205 1201 function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = '' ) { 1206 1202 if ( !apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta) ) 1207 1203 return false; 1208 1204 … … 1225 1221 $url = get_blogaddress_by_id($blog_id); 1226 1222 $user = get_userdata( $user_id ); 1227 1223 1228 $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );1224 $welcome_email = str_replace( 'SITE_NAME', get_current_site()->site_name, $welcome_email ); 1229 1225 $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email ); 1230 1226 $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email ); 1231 1227 $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email ); … … 1241 1237 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; 1242 1238 $message = $welcome_email; 1243 1239 1244 if ( empty( $current_site->site_name ) )1245 $current_site->site_name = 'WordPress';1240 if ( empty( get_current_site()->site_name ) ) 1241 get_current_site()->site_name = 'WordPress'; 1246 1242 1247 $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, wp_unslash( $title ) ) );1243 $subject = apply_filters( 'update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), get_current_site()->site_name, wp_unslash( $title ) ) ); 1248 1244 wp_mail($user->user_email, $subject, $message, $message_headers); 1249 1245 return true; 1250 1246 } … … 1264 1260 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization. 1265 1261 * @return bool 1266 1262 */ 1267 function wpmu_welcome_user_notification($user_id, $password, $meta = '') { 1268 global $current_site; 1269 1263 function wpmu_welcome_user_notification( $user_id, $password, $meta = '' ) { 1270 1264 if ( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) ) 1271 1265 return false; 1272 1266 … … 1275 1269 $user = get_userdata( $user_id ); 1276 1270 1277 1271 $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta); 1278 $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );1272 $welcome_email = str_replace( 'SITE_NAME', get_current_site()->site_name, $welcome_email ); 1279 1273 $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email ); 1280 1274 $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email ); 1281 1275 $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email ); … … 1289 1283 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; 1290 1284 $message = $welcome_email; 1291 1285 1292 if ( empty( $current_site->site_name ) )1293 $current_site->site_name = 'WordPress';1286 if ( empty( get_current_site()->site_name ) ) 1287 get_current_site()->site_name = 'WordPress'; 1294 1288 1295 $subject = apply_filters( 'update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login) );1289 $subject = apply_filters( 'update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), get_current_site()->site_name, $user->user_login) ); 1296 1290 wp_mail($user->user_email, $subject, $message, $message_headers); 1297 1291 return true; 1298 1292 } … … 1553 1547 * @return array The current site's domain 1554 1548 */ 1555 1549 function redirect_this_site( $deprecated = '' ) { 1556 global $current_site; 1557 return array( $current_site->domain ); 1550 return array( get_current_site()->domain ); 1558 1551 } 1559 1552 1560 1553 /** … … 1682 1675 * @param array $meta 1683 1676 */ 1684 1677 function add_new_user_to_blog( $user_id, $password, $meta ) { 1685 global $current_site;1686 1678 if ( !empty( $meta[ 'add_to_blog' ] ) ) { 1687 1679 $blog_id = $meta[ 'add_to_blog' ]; 1688 1680 $role = $meta[ 'new_role' ]; 1689 remove_user_from_blog($user_id, $current_site->blog_id); // remove user from main blog.1681 remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog. 1690 1682 add_user_to_blog( $blog_id, $user_id, $role ); 1691 1683 update_user_meta( $user_id, 'primary_blog', $blog_id ); 1692 1684 } … … 1698 1690 * @since MU 1699 1691 */ 1700 1692 function fix_phpmailer_messageid( $phpmailer ) { 1701 global $current_site; 1702 $phpmailer->Hostname = $current_site->domain; 1693 $phpmailer->Hostname = get_current_site()->domain; 1703 1694 } 1704 1695 1705 1696 /** -
src/wp-includes/ms-load.php
69 69 * @return bool|string Returns true on success, or drop-in file to include. 70 70 */ 71 71 function ms_site_check() { 72 global $wpdb , $current_site;72 global $wpdb; 73 73 74 74 $blog = get_blog_details(); 75 75 … … 93 93 if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) 94 94 return WP_CONTENT_DIR . '/blog-inactive.php'; 95 95 else 96 wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}") ) ) );96 wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_current_site()->domain ) ) ) ); 97 97 } 98 98 99 99 if ( $blog->archived == '1' || $blog->spam == '1' ) { -
src/wp-login.php
39 39 * @param WP_Error $wp_error Optional. WordPress Error Object 40 40 */ 41 41 function login_header($title = 'Log In', $message = '', $wp_error = '') { 42 global $error, $interim_login, $ current_site, $action;42 global $error, $interim_login, $action; 43 43 44 44 // Don't index any of these forms 45 45 add_action( 'login_head', 'wp_no_robots' ); … … 82 82 83 83 if ( is_multisite() ) { 84 84 $login_header_url = network_home_url(); 85 $login_header_title = $current_site->site_name;85 $login_header_title = get_current_site()->site_name; 86 86 } else { 87 87 $login_header_url = __( 'http://wordpress.org/' ); 88 88 $login_header_title = __( 'Powered by WordPress' ); … … 197 197 * @return bool|WP_Error True: when finish. WP_Error on error 198 198 */ 199 199 function retrieve_password() { 200 global $wpdb , $current_site;200 global $wpdb; 201 201 202 202 $errors = new WP_Error(); 203 203 -
src/wp-signup.php
78 78 * @param array $errors 79 79 */ 80 80 function show_blog_form($blogname = '', $blog_title = '', $errors = '') { 81 global $current_site;82 81 // Blog name 83 82 if ( !is_subdomain_install() ) 84 83 echo '<label for="blogname">' . __('Site Name:') . '</label>'; … … 90 89 <?php } 91 90 92 91 if ( !is_subdomain_install() ) 93 echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';92 echo '<span class="prefix_address">' . get_current_site()->domain . get_current_site()->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; 94 93 else 95 echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';94 echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', get_current_site()->domain ) ) . '</span><br />'; 96 95 97 96 if ( !is_user_logged_in() ) { 98 97 if ( !is_subdomain_install() ) 99 $site = $current_site->domain . $current_site->path . __( 'sitename' );98 $site = get_current_site()->domain . get_current_site()->path . __( 'sitename' ); 100 99 else 101 $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;100 $site = __( 'domain' ) . '.' . $site_domain . get_current_site()->path; 102 101 echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; 103 102 } 104 103 … … 202 201 * @param array $errors 203 202 */ 204 203 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { 205 global $current_site;206 204 $current_user = wp_get_current_user(); 207 205 208 206 if ( ! is_wp_error($errors) ) { … … 215 213 $blog_title = $filtered_results['blog_title']; 216 214 $errors = $filtered_results['errors']; 217 215 218 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), $current_site->site_name ) . '</h2>';216 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>'; 219 217 220 218 if ( $errors->get_error_code() ) { 221 219 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; … … 312 310 * @param array $errors 313 311 */ 314 312 function signup_user($user_name = '', $user_email = '', $errors = '') { 315 global $ current_site, $active_signup;313 global $active_signup; 316 314 317 315 if ( !is_wp_error($errors) ) 318 316 $errors = new WP_Error(); … … 327 325 328 326 ?> 329 327 330 <h2><?php printf( __( 'Get your own %s account in seconds' ), $current_site->site_name ) ?></h2>328 <h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2> 331 329 <form id="setupform" method="post" action="wp-signup.php"> 332 330 <input type="hidden" name="stage" value="validate-user-signup" /> 333 331 <?php do_action( 'signup_hidden_fields' ); ?>