$current_site =
new stdClass();
$current_site->id =
defined( 'SITE_ID_CURRENT_SITE'
) ? SITE_ID_CURRENT_SITE : 1;
$current_site->domain = DOMAIN_CURRENT_SITE;
$current_site->path = PATH_CURRENT_SITE;
if ( defined( 'BLOG_ID_CURRENT_SITE'
) ) { $current_site->blog_id = BLOG_ID_CURRENT_SITE;
} elseif ( defined( 'BLOGID_CURRENT_SITE'
) ) { // Deprecated.
$current_site->blog_id = BLOGID_CURRENT_SITE;
} if ( 0 ===
strcasecmp( $current_site->domain,
$domain ) && 0 ===
strcasecmp( $current_site->path,
$path ) ) { $current_blog =
get_site_by_path( $domain,
$path );
} elseif ( '/' !==
$current_site->path && 0 ===
strcasecmp( $current_site->domain,
$domain ) && 0 ===
stripos( $path,
$current_site->path
) ) { /*
* If the current network has a path and also matches the domain and path of the request,
* we need to look for a site using the first path segment following the network's path.
*/
$current_blog =
get_site_by_path( $domain,
$path, 1 +
count( explode( '/',
trim( $current_site->path, '/'
) ) ) );
} else { // Otherwise, use the first path segment (as usual).
$current_blog =
get_site_by_path( $domain,
$path, 1
);
} } elseif ( !
$subdomain ) {