rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -46,7 +46,7 @@ function wp_get_active_network_plugins() {
foreach ( $active_plugins as $plugin ) {
if ( ! validate_file( $plugin ) // $plugin must validate as file.
&& '.php' === substr( $plugin, -4 ) // $plugin must end with '.php'.
&& str_ends_with( $plugin, '.php' ) // $plugin must end with '.php'.
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
) {
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
@@ -226,10 +226,12 @@ function get_site_by_path( $domain, $path, $segments = null ) {
* then cache whether we can just always ignore paths.
*/
// Either www or non-www is supported, not both. If a www domain is requested,
// query for both to provide the proper redirect.
/*
* Either www or non-www is supported, not both. If a www domain is requested,
* query for both to provide the proper redirect.
*/
$domains = array( $domain );
if ( 'www.' === substr( $domain, 0, 4 ) ) {
if ( str_starts_with( $domain, 'www.' ) ) {
$domains[] = substr( $domain, 4 );
}
@@ -310,8 +312,10 @@ function ms_load_current_site_and_network( $domain, $path, $subdomain = false )
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.
/*
* 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).