Changeset 35446
- Timestamp:
- 10/30/2015 02:01:32 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r35170 r35446 39 39 */ 40 40 function get_blogaddress_by_id( $blog_id ) { 41 $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! 42 return ( $bloginfo ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : ''; 41 $bloginfo = get_blog_details( (int) $blog_id ); 42 43 if ( empty( $bloginfo ) ) { 44 return ''; 45 } 46 47 $scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME ); 48 $scheme = empty( $scheme ) ? 'http' : $scheme; 49 50 return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path ); 43 51 } 44 52 … … 217 225 218 226 switch_to_blog( $blog_id ); 219 $details->blogname = get_option( 'blogname' ); 220 $details->siteurl = get_option( 'siteurl' ); 221 $details->post_count = get_option( 'post_count' ); 227 $details->blogname = get_option( 'blogname' ); 228 $details->siteurl = get_option( 'siteurl' ); 229 $details->post_count = get_option( 'post_count' ); 230 $details->home = get_option( 'home' ); 222 231 restore_current_blog(); 223 232 -
trunk/tests/phpunit/tests/multisite/site.php
r35246 r35446 1000 1000 $blogaddress = get_blogaddress_by_id( 42 ); 1001 1001 $this->assertEquals( '', $blogaddress ); 1002 } 1003 1004 /** 1005 * @ticket 14867 1006 */ 1007 function test_get_blogaddress_by_id_scheme_reflects_blog_scheme() { 1008 $blog = self::factory()->blog->create(); 1009 1010 $this->assertSame( 'http', parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ) ); 1011 1012 update_blog_option( $blog, 'home', set_url_scheme( get_blog_option( $blog, 'home' ), 'https' ) ); 1013 1014 $this->assertSame( 'https', parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ) ); 1015 } 1016 1017 /** 1018 * @ticket 14867 1019 */ 1020 function test_get_blogaddress_by_id_scheme_is_unaffected_by_request() { 1021 $blog = self::factory()->blog->create(); 1022 1023 $this->assertFalse( is_ssl() ); 1024 $this->assertSame( 'http', parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ) ); 1025 1026 $_SERVER['HTTPS'] = 'on'; 1027 1028 $is_ssl = is_ssl(); 1029 $address = parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ); 1030 1031 unset( $_SERVER['HTTPS'] ); 1032 1033 $this->assertTrue( $is_ssl ); 1034 $this->assertSame( 'http', $address ); 1002 1035 } 1003 1036
Note: See TracChangeset
for help on using the changeset viewer.