wp/wp-includes/class-wp-network.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-wp-network.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/class-wp-network.php	Mon Oct 14 18:28:13 2019 +0200
@@ -125,7 +125,7 @@
 	 * @param WP_Network|object $network A network object.
 	 */
 	public function __construct( $network ) {
-		foreach( get_object_vars( $network ) as $key => $value ) {
+		foreach ( get_object_vars( $network ) as $key => $value ) {
 			$this->$key = $value;
 		}
 
@@ -254,13 +254,15 @@
 
 			$main_site_id = wp_cache_get( $cache_key, 'site-options' );
 			if ( false === $main_site_id ) {
-				$_sites = get_sites( array(
-					'fields'     => 'ids',
-					'number'     => 1,
-					'domain'     => $this->domain,
-					'path'       => $this->path,
-					'network_id' => $this->id,
-				) );
+				$_sites       = get_sites(
+					array(
+						'fields'     => 'ids',
+						'number'     => 1,
+						'domain'     => $this->domain,
+						'path'       => $this->path,
+						'network_id' => $this->id,
+					)
+				);
 				$main_site_id = ! empty( $_sites ) ? array_shift( $_sites ) : 0;
 
 				wp_cache_add( $cache_key, $main_site_id, 'site-options' );
@@ -282,7 +284,7 @@
 			return;
 		}
 
-		$default = ucfirst( $this->domain );
+		$default         = ucfirst( $this->domain );
 		$this->site_name = get_network_option( $this->id, 'site_name', $default );
 	}
 
@@ -316,7 +318,6 @@
 	 * requested site address.
 	 *
 	 * @since 4.4.0
-	 * @static
 	 *
 	 * @param string   $domain   Domain to check.
 	 * @param string   $path     Path to check.
@@ -350,12 +351,14 @@
 		if ( wp_using_ext_object_cache() ) {
 			$using_paths = wp_cache_get( 'networks_have_paths', 'site-options' );
 			if ( false === $using_paths ) {
-				$using_paths = get_networks( array(
-					'number'       => 1,
-					'count'        => true,
-					'path__not_in' => '/',
-				) );
-				wp_cache_add( 'networks_have_paths', $using_paths, 'site-options'  );
+				$using_paths = get_networks(
+					array(
+						'number'       => 1,
+						'count'        => true,
+						'path__not_in' => '/',
+					)
+				);
+				wp_cache_add( 'networks_have_paths', $using_paths, 'site-options' );
 			}
 		}
 
@@ -400,12 +403,12 @@
 		 *
 		 * @since 3.9.0
 		 *
-		 * @param null|bool|object $network  Network value to return by path.
-		 * @param string           $domain   The requested domain.
-		 * @param string           $path     The requested path, in full.
-		 * @param int|null         $segments The suggested number of paths to consult.
-		 *                                   Default null, meaning the entire path was to be consulted.
-		 * @param array            $paths    The paths to search for, based on $path and $segments.
+		 * @param null|bool|WP_Network $network  Network value to return by path.
+		 * @param string               $domain   The requested domain.
+		 * @param string               $path     The requested path, in full.
+		 * @param int|null             $segments The suggested number of paths to consult.
+		 *                                       Default null, meaning the entire path was to be consulted.
+		 * @param string[]             $paths    Array of paths to search for, based on `$path` and `$segments`.
 		 */
 		$pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths );
 		if ( null !== $pre ) {
@@ -413,13 +416,15 @@
 		}
 
 		if ( ! $using_paths ) {
-			$networks = get_networks( array(
-				'number'     => 1,
-				'orderby'    => array(
-					'domain_length' => 'DESC',
-				),
-				'domain__in' => $domains,
-			) );
+			$networks = get_networks(
+				array(
+					'number'     => 1,
+					'orderby'    => array(
+						'domain_length' => 'DESC',
+					),
+					'domain__in' => $domains,
+				)
+			);
 
 			if ( ! empty( $networks ) ) {
 				return array_shift( $networks );
@@ -428,14 +433,16 @@
 			return false;
 		}
 
-		$networks = get_networks( array(
-			'orderby'    => array(
-				'domain_length' => 'DESC',
-				'path_length'   => 'DESC',
-			),
-			'domain__in' => $domains,
-			'path__in'   => $paths,
-		) );
+		$networks = get_networks(
+			array(
+				'orderby'    => array(
+					'domain_length' => 'DESC',
+					'path_length'   => 'DESC',
+				),
+				'domain__in' => $domains,
+				'path__in'   => $paths,
+			)
+		);
 
 		/*
 		 * Domains are sorted by length of domain, then by length of path.