Ticket #14867: 14867.diff

File 14867.diff, 1.4 KB (added by scribu, 3 years ago)
Line 
1Index: wp-includes/ms-blogs.php
2===================================================================
3--- wp-includes/ms-blogs.php    (revision 15615)
4+++ wp-includes/ms-blogs.php    (working copy)
5@@ -19,8 +19,9 @@
6 }
7 
8 function get_blogaddress_by_id( $blog_id ) {
9+       $protocol = is_ssl() ? ' https://' : ' http://';
10        $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
11-       return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );
12+       return esc_url( $protocol . $bloginfo->domain . $bloginfo->path );
13 }
14 
15 function get_blogaddress_by_name( $blogname ) {
16@@ -38,20 +39,23 @@
17        return esc_url( $url . '/' );
18 }
19 
20-function get_blogaddress_by_domain( $domain, $path ){
21+function get_blogaddress_by_domain( $domain, $path ) {
22+       $protocol = is_ssl() ? ' https://' : ' http://';
23+
24        if ( is_subdomain_install() ) {
25-               $url = "http://".$domain.$path;
26+               $url = $protocol.$domain.$path;
27        } else {
28                if ( $domain != $_SERVER['HTTP_HOST'] ) {
29                        $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
30-                       $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
31+                       $url = $protocol . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
32                        // we're not installing the main blog
33                        if ( $blogname != 'www.' )
34                                $url .= $blogname . '/';
35                } else { // main blog
36-                       $url = 'http://' . $domain . $path;
37+                       $url = $protocol . $domain . $path;
38                }
39        }
40+
41        return esc_url( $url );
42 }
43